Class: MWS::FulfillmentInboundShipment::Client

Inherits:
Peddler::Client show all
Defined in:
lib/mws/fulfillment_inbound_shipment/client.rb

Overview

With the Fulfillment Inbound Shipment API, you can create and update inbound shipments of inventory in the Amazon Fulfillment Network. You can also request lists of inbound shipments or inbound shipment items based on criteria that you specify.

Instance Attribute Summary

Attributes inherited from Peddler::Client

#auth_token, #body, #marketplace, #merchant_id

Instance Method Summary collapse

Methods inherited from Peddler::Client

#initialize

Constructor Details

This class inherits a constructor from Peddler::Client

Instance Method Details

#confirm_preorder(shipment_id, need_by_date) ⇒ Peddler::XMLParser

Confirms a shipment for pre-order

Parameters:

  • shipment_id (String)
  • need_by_date (#iso8601)

Returns:

  • (Peddler::XMLParser)

See Also:



118
119
120
121
122
123
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 118

def confirm_preorder(shipment_id, need_by_date)
  operation('ConfirmPreorder')
    .add('ShipmentId' => shipment_id, 'NeedByDate' => need_by_date)

  run
end

#confirm_transport_request(shipment_id) ⇒ Peddler::XMLParser

Confirms that you accept the Amazon-partnered shipping estimate and you request that the Amazon-partnered carrier ship your inbound shipment

Parameters:

  • shipment_id (String)

Returns:

  • (Peddler::XMLParser)

See Also:



215
216
217
218
219
220
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 215

def confirm_transport_request(shipment_id)
  operation('ConfirmTransportRequest')
    .add('ShipmentId' => shipment_id)

  run
end

#create_inbound_shipment(shipment_id, inbound_shipment_header, inbound_shipment_items) ⇒ Peddler::XMLParser

Creates an inbound shipment

Parameters:

  • shipment_id (String)
  • inbound_shipment_header (Struct, Hash)
  • :inbound_shipment_items (Array<Struct, Hash>)

Returns:

  • (Peddler::XMLParser)

See Also:



75
76
77
78
79
80
81
82
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 75

def create_inbound_shipment(shipment_id, inbound_shipment_header,
                            inbound_shipment_items)
  build_inbound_shipment_operation('CreateInboundShipment', shipment_id,
                                   inbound_shipment_header,
                                   inbound_shipment_items)

  run
end

#create_inbound_shipment_plan(ship_from_address, inbound_shipment_plan_request_items, opts = {}) ⇒ Peddler::XMLParser

Returns the information required to create an inbound shipment

Parameters:

  • ship_from_address (Struct, Hash)
  • inbound_shipment_plan_request_items (Array<Struct, Hash>)
  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :ship_to_country_code (String)
  • :ship_to_country_subdivision_code (String)
  • :label_prep_preference (String)

Returns:

  • (Peddler::XMLParser)

See Also:



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 54

def create_inbound_shipment_plan(ship_from_address,
                                 inbound_shipment_plan_request_items,
                                 opts = {})
  operation('CreateInboundShipmentPlan')
    .add(opts)
    .add('ShipFromAddress' => ship_from_address,
         'InboundShipmentPlanRequestItems' =>
           inbound_shipment_plan_request_items)
    .structure!('InboundShipmentPlanRequestItems', 'member')
    .structure!('PrepDetailsList', 'member')

  run
end

#estimate_transport_request(shipment_id) ⇒ Peddler::XMLParser

Requests an estimate of the shipping cost for an inbound shipment

Parameters:

  • shipment_id (String)

Returns:

  • (Peddler::XMLParser)

See Also:



190
191
192
193
194
195
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 190

def estimate_transport_request(shipment_id)
  operation('EstimateTransportRequest')
    .add('ShipmentId' => shipment_id)

  run
end

#get_bill_of_lading(shipment_id) ⇒ Peddler::XMLParser

Returns PDF document data for printing a bill of lading for an inbound shipment

Parameters:

  • shipment_id (String)

Returns:

  • (Peddler::XMLParser)

See Also:



291
292
293
294
295
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 291

def get_bill_of_lading(shipment_id)
  operation('GetBillOfLading')
    .add('ShipmentId' => shipment_id)
  run
end

#get_inbound_guidance_for_asin(marketplace_id, *asin_list) ⇒ Peddler::XMLParser

Returns inbound guidance for a list of items by ASIN

Parameters:

  • marketplace_id (String)
  • asin_list (Array<String>)

Returns:

  • (Peddler::XMLParser)

See Also:



36
37
38
39
40
41
42
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 36

def get_inbound_guidance_for_asin(marketplace_id, *asin_list)
  operation('GetInboundGuidanceForASIN')
    .add('MarketplaceId' => marketplace_id, 'ASINList' => asin_list)
    .structure!('ASINList', 'Id')

  run
end

#get_inbound_guidance_for_sku(marketplace_id, *seller_sku_list) ⇒ Peddler::XMLParser

Returns inbound guidance for a list of items by Seller SKU

Parameters:

  • marketplace_id (String)
  • seller_sku_list (Array<String>)

Returns:

  • (Peddler::XMLParser)

See Also:



21
22
23
24
25
26
27
28
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 21

def get_inbound_guidance_for_sku(marketplace_id, *seller_sku_list)
  operation('GetInboundGuidanceForSKU')
    .add('MarketplaceId' => marketplace_id,
         'SellerSKUList' => seller_sku_list)
    .structure!('SellerSKUList', 'Id')

  run
end

#get_package_labels(shipment_id, page_type, opts = {}) ⇒ Peddler::XMLParser

Returns PDF document data for printing package labels for an inbound shipment

Parameters:

  • shipment_id (String)
  • page_type (String)
  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :number_of_packages (Integer)

Returns:

  • (Peddler::XMLParser)

See Also:



244
245
246
247
248
249
250
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 244

def get_package_labels(shipment_id, page_type, opts = {})
  operation('GetPackageLabels')
    .add(opts)
    .add('ShipmentId' => shipment_id, 'PageType' => page_type)

  run
end

#get_pallet_labels(shipment_id, page_type, number_of_pallets) ⇒ Peddler::XMLParser

Returns pallet labels

Parameters:

  • shipment_id (String)
  • page_type (String)
  • number_of_pallets (Integer)

Returns:

  • (Peddler::XMLParser)

See Also:



277
278
279
280
281
282
283
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 277

def get_pallet_labels(shipment_id, page_type, number_of_pallets)
  operation('GetPalletLabels')
    .add('ShipmentId' => shipment_id, 'PageType' => page_type,
         'NumberOfPallets' => number_of_pallets)

  run
end

#get_preorder_info(shipment_id) ⇒ Peddler::XMLParser

Returns pre-order information, including dates

Parameters:

  • shipment_id (String)

Returns:

  • (Peddler::XMLParser)

See Also:



105
106
107
108
109
110
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 105

def get_preorder_info(shipment_id)
  operation('GetPreorderInfo')
    .add('ShipmentId' => shipment_id)

  run
end

#get_prep_instructions_for_asin(ship_to_country_code, *asin_list) ⇒ Peddler::XMLParser

Returns item preparation instructions to help with item sourcing decisions

Parameters:

  • ship_to_country_code (String)
  • asin_list (Array<String>)

Returns:

  • (Peddler::XMLParser)

See Also:



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 148

def get_prep_instructions_for_asin(ship_to_country_code, *asin_list)
  operation('GetPrepInstructionsForASIN')
    .add('ASINList' => asin_list,
         'ShipToCountryCode' => ship_to_country_code)
    .structure!('ASINList', 'Id')

  run
# Work around a bug upstream
#
# @see https://github.com/hakanensari/peddler/issues/122
rescue Peddler::Errors::Error => e
  raise unless e.message.include?("Value null at 'asinList'")

  get_prep_instructions_for_asin_with_bad_params(ship_to_country_code,
                                                 *asin_list)
end

#get_prep_instructions_for_sku(ship_to_country_code, *seller_sku_list) ⇒ Peddler::XMLParser

Returns labeling requirements and item preparation instructions to help you prepare items for an inbound shipment

Parameters:

  • ship_to_country_code (String)
  • seller_sku_list (Array<String>)

Returns:

  • (Peddler::XMLParser)

See Also:



132
133
134
135
136
137
138
139
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 132

def get_prep_instructions_for_sku(ship_to_country_code, *seller_sku_list)
  operation('GetPrepInstructionsForSKU')
    .add('SellerSKUList' => seller_sku_list,
         'ShipToCountryCode' => ship_to_country_code)
    .structure!('SellerSKUList', 'Id')

  run
end

#get_service_statusPeddler::XMLParser

Gets the operational status of the API



359
360
361
362
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 359

def get_service_status
  operation('GetServiceStatus')
  run
end

#get_transport_content(shipment_id) ⇒ Peddler::XMLParser

Returns current transportation information about an inbound shipment

Parameters:

  • shipment_id (String)

Returns:

  • (Peddler::XMLParser)

See Also:



202
203
204
205
206
207
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 202

def get_transport_content(shipment_id)
  operation('GetTransportContent')
    .add('ShipmentId' => shipment_id)

  run
end

#get_unique_package_labels(shipment_id, page_type, package_labels_to_print) ⇒ Peddler::XMLParser

Returns unique package labels for faster and more accurate shipment processing at the Amazon fulfillment centre

Parameters:

  • shipment_id (String)
  • page_type (String)
  • package_labels_to_print (Array<String>)

Returns:

  • (Peddler::XMLParser)

See Also:



260
261
262
263
264
265
266
267
268
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 260

def get_unique_package_labels(shipment_id, page_type,
                              package_labels_to_print)
  operation('GetUniquePackageLabels')
    .add('ShipmentId' => shipment_id, 'PageType' => page_type,
         'PackageLabelsToPrint' => package_labels_to_print)
    .structure!('PackageLabelsToPrint', 'member')

  run
end

#list_inbound_shipment_items(opts = {}) ⇒ Peddler::XMLParser

Returns a list of items in a specified inbound shipment, or a list of items that were updated within a specified time frame

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :shipment_id (String)
  • :last_updated_after (String, #iso8601)
  • :last_updated_before (String, #iso8601)

Returns:

  • (Peddler::XMLParser)

See Also:



336
337
338
339
340
341
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 336

def list_inbound_shipment_items(opts = {})
  operation('ListInboundShipmentItems')
    .add(opts)

  run
end

#list_inbound_shipment_items_by_next_token(next_token) ⇒ Peddler::XMLParser

Returns the next page of inbound shipment items

Parameters:

  • next_token (String)

Returns:

  • (Peddler::XMLParser)

See Also:



348
349
350
351
352
353
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 348

def list_inbound_shipment_items_by_next_token(next_token)
  operation('ListInboundShipmentItemsByNextToken')
    .add('NextToken' => next_token)

  run
end

#list_inbound_shipments(opts = {}) ⇒ Peddler::XMLParser

Returns a list of inbound shipments based on criteria that you specify

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :shipment_status_list (Array<String>)
  • :shipment_id_list (Array<String>)
  • :last_updated_after (String, #iso8601)
  • :last_updated_before (String, #iso8601)

Returns:

  • (Peddler::XMLParser)

See Also:



306
307
308
309
310
311
312
313
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 306

def list_inbound_shipments(opts = {})
  operation('ListInboundShipments')
    .add(opts)
    .structure!('ShipmentStatusList', 'member')
    .structure!('ShipmentIdList', 'member')

  run
end

#list_inbound_shipments_by_next_token(next_token) ⇒ Peddler::XMLParser

Returns the next page of inbound shipments

Parameters:

  • next_token (String)

Returns:

  • (Peddler::XMLParser)

See Also:



320
321
322
323
324
325
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 320

def list_inbound_shipments_by_next_token(next_token)
  operation('ListInboundShipmentsByNextToken')
    .add('NextToken' => next_token)

  run
end

#put_transport_content(shipment_id, is_partnered, shipment_type, transport_details) ⇒ Peddler::XMLParser

Sends transportation information to Amazon about an inbound shipment

Parameters:

  • shipment_id (String)
  • is_partnered (Boolean)
  • shipment_type (String)
  • transport_details (Struct, Hash)

Returns:

  • (Peddler::XMLParser)

See Also:



173
174
175
176
177
178
179
180
181
182
183
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 173

def put_transport_content(shipment_id, is_partnered, shipment_type,
                          transport_details)
  operation('PutTransportContent')
    .add('ShipmentId' => shipment_id, 'IsPartnered' => is_partnered,
         'ShipmentType' => shipment_type,
         'TransportDetails' => transport_details)
    .structure!('PackageList', 'member')
    .structure!('PalletList', 'member')

  run
end

#update_inbound_shipment(shipment_id, inbound_shipment_header, inbound_shipment_items) ⇒ Peddler::XMLParser

Updates an existing inbound shipment

Parameters:

  • shipment_id (String)
  • inbound_shipment_header (Struct, Hash)
  • :inbound_shipment_items (Array<Struct, Hash>)

Returns:

  • (Peddler::XMLParser)

See Also:



91
92
93
94
95
96
97
98
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 91

def update_inbound_shipment(shipment_id, inbound_shipment_header,
                            inbound_shipment_items)
  build_inbound_shipment_operation('UpdateInboundShipment', shipment_id,
                                   inbound_shipment_header,
                                   inbound_shipment_items)

  run
end

#void_transport_request(shipment_id) ⇒ Peddler::XMLParser

Voids a previously-confirmed request to ship your inbound shipment using an Amazon-partnered carrier

Parameters:

  • shipment_id (String)

Returns:

  • (Peddler::XMLParser)

See Also:



228
229
230
231
232
233
# File 'lib/mws/fulfillment_inbound_shipment/client.rb', line 228

def void_transport_request(shipment_id)
  operation('VoidTransportRequest')
    .add('ShipmentId' => shipment_id)

  run
end