Class: Peddler::APIs::AmazonWarehousingAndDistribution20240509

Inherits:
Peddler::API
  • Object
show all
Defined in:
lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rb

Overview

The Selling Partner API for Amazon Warehousing and Distribution

The Selling Partner API for Amazon Warehousing and Distribution (AWD) provides programmatic access to information about AWD shipments and inventory.

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint, #retries

Instance Method Summary collapse

Methods inherited from Peddler::API

#endpoint_uri, #http, #initialize, #meter, #retriable, #sandbox, #sandbox?, #typed, #typed?, #use, #via

Constructor Details

This class inherits a constructor from Peddler::API

Instance Method Details

#cancel_inbound(order_id, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Cancels an AWD Inbound order and its associated shipment.



64
65
66
67
# File 'lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rb', line 64

def cancel_inbound(order_id, rate_limit: 1.0)
  path = "/awd/2024-05-09/inboundOrders/#{percent_encode(order_id)}/cancellation"
  meter(rate_limit).post(path)
end

#check_inbound_eligibility(body, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Determines if the packages you specify are eligible for an AWD inbound order and contains error details for ineligible packages.



136
137
138
139
140
# File 'lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rb', line 136

def check_inbound_eligibility(body, rate_limit: 1.0)
  path = "/awd/2024-05-09/inboundEligibility"
  parser = Peddler::Types::AmazonWarehousingAndDistribution20240509::InboundEligibility if typed?
  meter(rate_limit).post(path, body:, parser:)
end

#confirm_inbound(order_id, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Confirms an AWD inbound order in ‘DRAFT` status.



75
76
77
78
# File 'lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rb', line 75

def confirm_inbound(order_id, rate_limit: 1.0)
  path = "/awd/2024-05-09/inboundOrders/#{percent_encode(order_id)}/confirmation"
  meter(rate_limit).post(path)
end

#create_inbound(body, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Creates a draft AWD inbound order with a list of packages for inbound shipment. The operation creates one shipment per order.



27
28
29
30
31
# File 'lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rb', line 27

def create_inbound(body, rate_limit: 1.0)
  path = "/awd/2024-05-09/inboundOrders"
  parser = Peddler::Types::AmazonWarehousingAndDistribution20240509::InboundOrderReference if typed?
  meter(rate_limit).post(path, body:, parser:)
end

#get_inbound(order_id, rate_limit: 2.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Retrieves an AWD inbound order.



39
40
41
42
43
# File 'lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rb', line 39

def get_inbound(order_id, rate_limit: 2.0)
  path = "/awd/2024-05-09/inboundOrders/#{percent_encode(order_id)}"
  parser = Peddler::Types::AmazonWarehousingAndDistribution20240509::InboundOrder if typed?
  meter(rate_limit).get(path, parser:)
end

#get_inbound_shipment(shipment_id, sku_quantities: nil, rate_limit: 2.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Retrieves an AWD inbound shipment.



88
89
90
91
92
93
94
95
# File 'lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rb', line 88

def get_inbound_shipment(shipment_id, sku_quantities: nil, rate_limit: 2.0)
  path = "/awd/2024-05-09/inboundShipments/#{percent_encode(shipment_id)}"
  params = {
    "skuQuantities" => sku_quantities,
  }.compact
  parser = Peddler::Types::AmazonWarehousingAndDistribution20240509::InboundShipment if typed?
  meter(rate_limit).get(path, params:, parser:)
end

#get_inbound_shipment_labels(shipment_id, page_type: nil, format_type: nil, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Retrieves the box labels for a shipment ID that you specify. This is an asynchronous operation. If the label status is ‘GENERATED`, then the label URL is available.



107
108
109
110
111
112
113
114
115
# File 'lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rb', line 107

def get_inbound_shipment_labels(shipment_id, page_type: nil, format_type: nil, rate_limit: 1.0)
  path = "/awd/2024-05-09/inboundShipments/#{percent_encode(shipment_id)}/labels"
  params = {
    "pageType" => page_type,
    "formatType" => format_type,
  }.compact
  parser = Peddler::Types::AmazonWarehousingAndDistribution20240509::ShipmentLabels if typed?
  meter(rate_limit).get(path, params:, parser:)
end

#list_inbound_shipments(sort_by: nil, sort_order: nil, shipment_status: nil, updated_after: nil, updated_before: nil, max_results: 25, next_token: nil, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Retrieves a summary of all the inbound AWD shipments associated with a merchant, with the ability to apply optional filters.



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rb', line 162

def list_inbound_shipments(sort_by: nil, sort_order: nil, shipment_status: nil, updated_after: nil,
  updated_before: nil, max_results: 25, next_token: nil, rate_limit: 1.0)
  path = "/awd/2024-05-09/inboundShipments"
  params = {
    "sortBy" => sort_by,
    "sortOrder" => sort_order,
    "shipmentStatus" => shipment_status,
    "updatedAfter" => updated_after,
    "updatedBefore" => updated_before,
    "maxResults" => max_results,
    "nextToken" => next_token,
  }.compact
  parser = Peddler::Types::AmazonWarehousingAndDistribution20240509::ShipmentListing if typed?
  meter(rate_limit).get(path, params:, parser:)
end

#list_inventory(sku: nil, sort_order: nil, details: nil, next_token: nil, max_results: 25, rate_limit: 2.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Lists AWD inventory associated with a merchant with the ability to apply optional filters.



193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rb', line 193

def list_inventory(sku: nil, sort_order: nil, details: nil, next_token: nil, max_results: 25, rate_limit: 2.0)
  path = "/awd/2024-05-09/inventory"
  params = {
    "sku" => sku,
    "sortOrder" => sort_order,
    "details" => details,
    "nextToken" => next_token,
    "maxResults" => max_results,
  }.compact
  parser = Peddler::Types::AmazonWarehousingAndDistribution20240509::InventoryListing if typed?
  meter(rate_limit).get(path, params:, parser:)
end

#update_inbound(order_id, body, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Updates an AWD inbound order that is in ‘DRAFT` status and not yet confirmed. Use this operation to update the `packagesToInbound`, `originAddress` and `preferences` attributes.



53
54
55
56
# File 'lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rb', line 53

def update_inbound(order_id, body, rate_limit: 1.0)
  path = "/awd/2024-05-09/inboundOrders/#{percent_encode(order_id)}"
  meter(rate_limit).put(path, body:)
end

#update_inbound_shipment_transport_details(shipment_id, body, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Updates transport details for an AWD shipment.



124
125
126
127
# File 'lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rb', line 124

def update_inbound_shipment_transport_details(shipment_id, body, rate_limit: 1.0)
  path = "/awd/2024-05-09/inboundShipments/#{percent_encode(shipment_id)}/transport"
  meter(rate_limit).put(path, body:)
end