Class: MuffinMan::VendorDirectFulfillmentOrders::V20211228

Inherits:
SpApiClient
  • Object
show all
Defined in:
lib/muffin_man/vendor_direct_fulfillment_orders/v20211228.rb

Constant Summary collapse

GET_ORDERS_PARAMS =
%w[
  shipFromPartyId
  status
  limit
  sortOrder
  nextToken
  includeDetails
].freeze

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(purchase_order_number) ⇒ Object



26
27
28
29
30
# File 'lib/muffin_man/vendor_direct_fulfillment_orders/v20211228.rb', line 26

def get_order(purchase_order_number)
  @local_var_path = "/vendor/directFulfillment/orders/2021-12-28/purchaseOrders/#{purchase_order_number}"
  @request_type = "GET"
  call_api
end

#get_orders(created_after, created_before, params = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/muffin_man/vendor_direct_fulfillment_orders/v20211228.rb', line 15

def get_orders(created_after, created_before, params = {})
  @local_var_path = "/vendor/directFulfillment/orders/2021-12-28/purchaseOrders"
  @query_params = {
    "createdAfter" => created_after,
    "createdBefore" => created_before
  }
  @query_params.merge!(params.slice(*GET_ORDERS_PARAMS))
  @request_type = "GET"
  call_api
end

#submit_acknowledgement(order_acknowledgements) ⇒ Object



32
33
34
35
36
37
# File 'lib/muffin_man/vendor_direct_fulfillment_orders/v20211228.rb', line 32

def submit_acknowledgement(order_acknowledgements)
  @local_var_path = "/vendor/directFulfillment/orders/2021-12-28/acknowledgements"
  @request_body = { "orderAcknowledgements" => order_acknowledgements }
  @request_type = "POST"
  call_api
end