From 7175e492d49271bc6ee8159a9e6c599ef8432023 Mon Sep 17 00:00:00 2001 From: IhorEhorovCoax Date: Fri, 24 Jul 2020 11:59:02 +0300 Subject: [PATCH 1/2] Change response trash to mash --- lib/veeqo/resources/allocation.rb | 56 ----------------------- lib/veeqo/resources/channel.rb | 62 -------------------------- lib/veeqo/resources/company.rb | 20 --------- lib/veeqo/resources/customer.rb | 8 ---- lib/veeqo/resources/delivery_method.rb | 7 --- lib/veeqo/resources/order.rb | 42 ----------------- lib/veeqo/resources/product.rb | 37 --------------- lib/veeqo/resources/purchase_order.rb | 25 ----------- lib/veeqo/resources/resource.rb | 4 +- lib/veeqo/resources/shipment.rb | 12 ----- lib/veeqo/resources/stock_entry.rb | 13 ------ lib/veeqo/resources/supplier.rb | 26 ----------- lib/veeqo/resources/tag.rb | 5 --- lib/veeqo/resources/warehouse.rb | 22 --------- 14 files changed, 1 insertion(+), 338 deletions(-) diff --git a/lib/veeqo/resources/allocation.rb b/lib/veeqo/resources/allocation.rb index 1aac46a..a11a0df 100644 --- a/lib/veeqo/resources/allocation.rb +++ b/lib/veeqo/resources/allocation.rb @@ -5,61 +5,5 @@ module Veeqo class Allocation < Resource include Veeqo::SubresourceActions.new(uri: 'orders/%d/allocations/%d', disable: %i[destroy_all all find]) - - property :id - property :additional_order_level_taxless_discount - property :allocated_completely - property :allocations - property :allocated_by_id - property :buyer_user_id - property :cancel_reason - property :cancelled_at - property :cancelled_by - property :channel - property :created_at - property :created_by - property :customer - property :customer_note - property :customer_viewable_notes - property :deliver_to - property :delivery_cost - property :delivery_method - property :due_date - property :employee_notes - property :fulfilled_by_amazon - property :fulfillment_channel_order - property :international - property :is_amazon_premium_order - property :is_amazon_prime - property :line_items - property :matched_parcel_properties_criteria - property :notes - property :number - property :order_id - property :packed_completely - property :payment - property :picked_completely - property :receipt_printed - property :recommended_shipping_options - property :refund_amount - property :restock_shipped_items - property :returns - property :send_notification_email - property :send_refund_email - property :shipment - property :shipped_at - property :status - property :subtotal_price - property :tags - property :till_id - property :total_discounts - property :total_fees - property :total_price - property :total_tax - property :total_weight - property :updated_at - property :updated_by - property :weight_unit - property :warehouse end end diff --git a/lib/veeqo/resources/channel.rb b/lib/veeqo/resources/channel.rb index cf35f34..3e2970d 100644 --- a/lib/veeqo/resources/channel.rb +++ b/lib/veeqo/resources/channel.rb @@ -5,67 +5,5 @@ module Veeqo class Channel < Resource include Veeqo::ResourceActions.new(uri: 'channels/%d', disable: [:destroy_all]) - - property :id - property :type_code - property :created_by_id - property :name - property :currency_code - property :state - property :url - property :shopify_url - property :ebay_url - property :ebay_site_code_id - property :country - property :region - property :city - property :address_line_1 - property :address_line_2 - property :post_code - property :pulled_products_at - property :pulled_orders_at - property :pending_setup - property :seller_id - property :marketplace_id - property :mws_auth_token - property :deleted_at - property :deleted_by_id - property :api2cart_store_key - property :bridge_url - property :bridge_verified - property :pull_pending_orders - property :default_send_shipment_email - property :automatic_product_linking_disabled - property :update_remote_order - property :successfully_fetched_stock_levels_at - property :create_product_if_unmatched - property :skip_title_matching - property :email - property :skip_fba_orders_and_products - property :pull_stock_level_required - property :pull_historical_orders - property :adjust_orders_tax_rate - property :send_notification_emails_to_customers - property :end_ebay_listing_on_out_of_stock - property :update_product_attributes - property :max_qty_to_advert - property :min_threshold_qty - property :percent_of_qty - property :always_set_qty - property :veeqo_dictates_stock_level - property :with_fba - property :first_sync_finish_notice_marked_as_read - property :pull_unpaid_shopify_orders - property :create_product_on_ended_listings - property :channel_warehouses - property :warehouses - property :stock_level_update_requests - property :channel_specific - property :time_since_product_sync - property :time_since_order_sync - property :time_since_tried_fetch_stock_level - property :time_since_successfully_fetch_stock_level - property :default_warehouse - property :remote end end diff --git a/lib/veeqo/resources/company.rb b/lib/veeqo/resources/company.rb index b81b483..9521c95 100644 --- a/lib/veeqo/resources/company.rb +++ b/lib/veeqo/resources/company.rb @@ -6,26 +6,6 @@ module Veeqo class Company < Resource include Veeqo::Request.new 'current_company' - property :id - property :name - property :created_at - property :updated_at - property :card_valid - property :stripe_customer_id - property :has_right_to_use_veeqo - property :subscription_status - property :billing_period_started - property :chargify_product_handle - property :chargify_current_plan - property :trial_end_date - property :can_change_subscription_plan - property :has_ever_created_remote_channel - property :owner - property :subscription_plan - property :employees - property :guide_progress - property :settings - def self.info(params = {}) get path.build, params end diff --git a/lib/veeqo/resources/customer.rb b/lib/veeqo/resources/customer.rb index 0d646f4..7201a1d 100644 --- a/lib/veeqo/resources/customer.rb +++ b/lib/veeqo/resources/customer.rb @@ -5,13 +5,5 @@ module Veeqo class Customer < Resource include Veeqo::ResourceActions.new(uri: 'customers/%d', disable: %i[destroy destroy_all]) - - property :id - property :email - property :phone - property :mobile - property :created_by_id - property :billing_address - property :shipping_addresses end end diff --git a/lib/veeqo/resources/delivery_method.rb b/lib/veeqo/resources/delivery_method.rb index 47e0918..cf6e812 100644 --- a/lib/veeqo/resources/delivery_method.rb +++ b/lib/veeqo/resources/delivery_method.rb @@ -5,12 +5,5 @@ module Veeqo class DeliveryMethod < Resource include Veeqo::ResourceActions.new(uri: 'delivery_methods/%d', disable: %i[destroy_all count]) - - property :id - property :cost - property :name - property :user_id - property :created_at - property :updated_at end end diff --git a/lib/veeqo/resources/order.rb b/lib/veeqo/resources/order.rb index b4242f5..3b579a4 100644 --- a/lib/veeqo/resources/order.rb +++ b/lib/veeqo/resources/order.rb @@ -6,48 +6,6 @@ module Veeqo class Order < Resource include Veeqo::ResourceActions.new(uri: 'orders/%d', disable: %i[destroy destroy_all]) - property :id - property :allocated_completely - property :allocations - property :buyer_user_id - property :cancel_reason - property :cancelled_at - property :cancelled_by - property :channel - property :created_at - property :created_by - property :customer - property :customer_note - property :customer_viewable_notes - property :deliver_to - property :delivery_cost - property :delivery_method - property :due_date - property :employee_notes - property :fulfilled_by_amazon - property :international - property :line_items - property :notes - property :number - property :packed_completely - property :payment - property :picked_completely - property :receipt_printed - property :refund_amount - property :returns - property :send_notification_email - property :send_refund_email - property :shipped_at - property :status - property :subtotal_price - property :tags - property :till_id - property :total_discounts - property :total_price - property :total_tax - property :updated_at - property :updated_by - def self.bulk_tagging(resource_ids, tag_ids, params = {}) raise ArgumentError if resource_ids.empty? || tag_ids.empty? post 'https://app.veeqo.com/bulk_tagging', { order_ids: [*resource_ids], tag_ids: [*tag_ids] }.merge(params) diff --git a/lib/veeqo/resources/product.rb b/lib/veeqo/resources/product.rb index e67fe60..63a3ac7 100644 --- a/lib/veeqo/resources/product.rb +++ b/lib/veeqo/resources/product.rb @@ -6,43 +6,6 @@ module Veeqo class Product < Resource include Veeqo::ResourceActions.new uri: 'products/%d' - property :id - property :active_channels - property :brand - property :channel_products - property :created_at - property :created_by_id - property :deleted_at - property :deleted_by_id - property :description - property :estimated_delivery - property :hs_tariff_number - property :image - property :inventory - property :main_image - property :main_image_src - property :notes - property :on_hand_value - property :origin_country - property :product_tax_rate_id - property :sellables - property :stock_level_sync_status - property :tags - property :tax_rate - property :title - property :total_allocated_stock_level - property :total_available_stock_level - property :total_quantity_sold - property :total_stock_level - property :updated_at - property :updated_by_id - property :web_meta_description - property :web_meta_keywords - property :web_meta_title - property :web_page_title - property :web_page_url - property :weight - def self.update_suppliers(resource_id, params = {}) include Veeqo::ResourceActions.new uri: 'supplier_product_variants' raise ArgumentError if resource_id.nil? diff --git a/lib/veeqo/resources/purchase_order.rb b/lib/veeqo/resources/purchase_order.rb index 8c337db..30b01fa 100644 --- a/lib/veeqo/resources/purchase_order.rb +++ b/lib/veeqo/resources/purchase_order.rb @@ -6,31 +6,6 @@ module Veeqo class PurchaseOrder < Resource include Veeqo::ResourceActions.new(uri: 'purchase_orders/%d', disable: %i[update destroy destroy_all]) - property :id - property :number - property :user_id - property :supplier_id - property :destination_warehouse_id - property :state - property :estimated_delivery_days - property :actual_delivery_days - property :estimated_return_days - property :actual_return_days - property :started_at - property :received_at - property :returned_at - property :completed_at - property :started_or_returned_at_calc - property :arrival_at_calc - property :total_calc - property :created_by_id - property :updated_by_id - property :created_at - property :updated_at - property :send_to_supplier - property :line_items - property :supplier - def self.create(params = {}) post path.build, params rescue Oj::ParseError diff --git a/lib/veeqo/resources/resource.rb b/lib/veeqo/resources/resource.rb index a5651a0..b96a26b 100644 --- a/lib/veeqo/resources/resource.rb +++ b/lib/veeqo/resources/resource.rb @@ -3,8 +3,6 @@ require 'veeqo/subresource_actions' module Veeqo - class Resource < Hashie::Trash - include Hashie::Extensions::MethodAccess - include Hashie::Extensions::IgnoreUndeclared + class Resource < Hashie::Mash end end diff --git a/lib/veeqo/resources/shipment.rb b/lib/veeqo/resources/shipment.rb index ece5ab2..c8f5650 100644 --- a/lib/veeqo/resources/shipment.rb +++ b/lib/veeqo/resources/shipment.rb @@ -5,17 +5,5 @@ module Veeqo class Shipment < Resource include Veeqo::ResourceActions.new(uri: 'shipments/%d', disable: %i[find all count destroy_all]) - - property :allocation_id - property :carrier - property :carrier_id - property :created_at - property :id - property :notify_customer - property :order_id - property :shipped_by_id - property :tracking_number - property :update_remote_order - property :weight end end diff --git a/lib/veeqo/resources/stock_entry.rb b/lib/veeqo/resources/stock_entry.rb index 165df93..fd09dfe 100644 --- a/lib/veeqo/resources/stock_entry.rb +++ b/lib/veeqo/resources/stock_entry.rb @@ -5,18 +5,5 @@ module Veeqo class StockEntry < Resource include Veeqo::SubresourceActions.new(uri: 'sellables/%d/warehouses/%d/stock_entry', disable: %i[destroy destroy_all all create]) - property :allocated_stock_level - property :available_stock_level - property :id - property :incoming_stock_level - property :infinite - property :location - property :physical_stock_level - property :sellable_id - property :sellable_on_hand_value - property :stock_running_low - property :updated_at - property :warehouse - property :warehouse_id end end diff --git a/lib/veeqo/resources/supplier.rb b/lib/veeqo/resources/supplier.rb index 336bbc7..db5faab 100644 --- a/lib/veeqo/resources/supplier.rb +++ b/lib/veeqo/resources/supplier.rb @@ -6,32 +6,6 @@ module Veeqo class Supplier < Resource include Veeqo::ResourceActions.new(uri: 'suppliers/%d', disable: %i[find create destroy destroy_all]) - property :id - property :name - property :address_line_1 - property :address_line_2 - property :city - property :region - property :country - property :post_code - property :sales_contact_name - property :sales_contact_email - property :accounting_contact_name - property :accounting_contact_email - property :credit_limit - property :currency_code - property :created_by_id - property :updated_by_id - property :deleted_at - property :deleted_by_id - property :created_at - property :updated_at - property :sales_phone_number - property :accounting_phone_number - property :bank_account_number - property :bank_sort_code - property :bank_name - def self.create(params = {}) post path.build, params rescue Veeqo::NotAccepted diff --git a/lib/veeqo/resources/tag.rb b/lib/veeqo/resources/tag.rb index a3e1390..0c7a601 100644 --- a/lib/veeqo/resources/tag.rb +++ b/lib/veeqo/resources/tag.rb @@ -5,10 +5,5 @@ module Veeqo class Tag < Resource include Veeqo::ResourceActions.new uri: 'tags/%d', disable: %i[destroy_all count] - property :colour - property :company_id - property :id - property :name - property :taggings_count end end diff --git a/lib/veeqo/resources/warehouse.rb b/lib/veeqo/resources/warehouse.rb index 90f0f36..10d432b 100644 --- a/lib/veeqo/resources/warehouse.rb +++ b/lib/veeqo/resources/warehouse.rb @@ -5,27 +5,5 @@ module Veeqo class Warehouse < Resource include Veeqo::ResourceActions.new(uri: 'warehouses/%d', disable: %i[create update destroy destroy_all]) - - property :id - property :address_line_1 - property :address_line_2 - property :city - property :click_and_collect_days - property :click_and_collect_enabled - property :country - property :created_at - property :created_by_id - property :default_min_reorder - property :deleted_at - property :deleted_by_id - property :inventory_type_code - property :name - property :phone - property :post_code - property :region - property :updated_at - property :updated_by_id - property :requested_carrier_account - property :on_hand_value end end From d4432448b376489e42bec027f65470fa650c1844 Mon Sep 17 00:00:00 2001 From: IhorEhorovCoax Date: Fri, 24 Jul 2020 13:05:04 +0300 Subject: [PATCH 2/2] Disable warning --- lib/veeqo/resources/resource.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/veeqo/resources/resource.rb b/lib/veeqo/resources/resource.rb index b96a26b..d567c9c 100644 --- a/lib/veeqo/resources/resource.rb +++ b/lib/veeqo/resources/resource.rb @@ -4,5 +4,6 @@ module Veeqo class Resource < Hashie::Mash + disable_warnings end end