Class: MuffinMan::Orders::V0

Inherits:
SpApiClient show all
Defined in:
lib/muffin_man/orders/v0.rb

Constant Summary collapse

GET_ORDERS_PARAMS =
%w[
  CreatedAfter
  CreatedBefore
  LastUpdatedAfter
  LastUpdatedBefore
  OrderStatuses
  FulfillmentChannels
  PaymentMethods
  BuyerEmail
  SellerOrderId
  MaxResultsPerPage
  EasyShipShipmentStatuses
  NextToken
  AmazonOrderIds
  ActualFulfillmentSupplySourceId
  IsISPU
  StoreChainStoreId
].freeze
GET_ORDER_ITEMS_PARAMS =
%w[
  NextToken
].freeze
PII_DATA_ELEMENTS =
%w[
  buyerInfo shippingAddress buyerTaxInformation
]

Constants inherited from SpApiClient

SpApiClient::ACCESS_TOKEN_URL, SpApiClient::AWS_REGION_MAP, SpApiClient::SERVICE_NAME, SpApiClient::UNPROCESSABLE_ENTITY_STATUS_CODE

Instance Attribute Summary

Attributes inherited from SpApiClient

#access_token_cache_key, #aws_access_key_id, #aws_secret_access_key, #client_id, #client_secret, #config, #credentials, #local_var_path, #pii_data_elements, #query_params, #refresh_token, #region, #request_body, #request_type, #sandbox, #scope, #sts_iam_role_arn

Instance Method Summary collapse

Methods inherited from SpApiClient

#initialize

Constructor Details

This class inherits a constructor from MuffinMan::SpApiClient

Instance Method Details

#get_order(order_id) ⇒ Object



41
42
43
44
45
# File 'lib/muffin_man/orders/v0.rb', line 41

def get_order(order_id)
  @local_var_path = "/orders/v0/orders/#{order_id}"
  @request_type = "GET"
  call_api
end

#get_order_address(order_id) ⇒ Object



54
55
56
57
58
# File 'lib/muffin_man/orders/v0.rb', line 54

def get_order_address(order_id)
  @local_var_path = "/orders/v0/orders/#{order_id}/address"
  @request_type = "GET"
  call_api
end

#get_order_items(order_id, params = {}) ⇒ Object



47
48
49
50
51
52
# File 'lib/muffin_man/orders/v0.rb', line 47

def get_order_items(order_id, params = {})
  @query_params = params.slice(*GET_ORDER_ITEMS_PARAMS)
  @local_var_path = "/orders/v0/orders/#{order_id}/orderItems"
  @request_type = "GET"
  call_api
end

#get_orders(marketplace_ids, params = {}, pii_data_elements: []) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/muffin_man/orders/v0.rb', line 32

def get_orders(marketplace_ids, params = {}, pii_data_elements: [])
  @local_var_path = "/orders/v0/orders"
  @pii_data_elements = pii_data_elements & PII_DATA_ELEMENTS
  @query_params = params.slice(*GET_ORDERS_PARAMS)
  @query_params["MarketplaceIds"] = marketplace_ids
  @request_type = "GET"
  call_api
end