peddler 2.4.4 → 3.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +406 -134
  3. data/lib/peddler/access_token.rb +76 -0
  4. data/lib/peddler/api/amazon_warehousing_and_distribution_2024_05_09.rb +80 -0
  5. data/lib/peddler/api/aplus_content_2020_11_01.rb +208 -0
  6. data/lib/peddler/api/application_management_2023_11_30.rb +25 -0
  7. data/lib/peddler/api/catalog_items_2020_12_01.rb +70 -0
  8. data/lib/peddler/api/catalog_items_2022_04_01.rb +83 -0
  9. data/lib/peddler/api/catalog_items_v0.rb +90 -0
  10. data/lib/peddler/api/data_kiosk_2023_11_15.rb +92 -0
  11. data/lib/peddler/api/easy_ship_2022_03_23.rb +108 -0
  12. data/lib/peddler/api/fba_inbound_eligibility_v1.rb +36 -0
  13. data/lib/peddler/api/fba_inventory_v1.rb +106 -0
  14. data/lib/peddler/api/feeds_2021_06_30.rb +104 -0
  15. data/lib/peddler/api/finances_v0.rb +121 -0
  16. data/lib/peddler/api/fulfillment_inbound_2024_03_20.rb +660 -0
  17. data/lib/peddler/api/fulfillment_inbound_v0.rb +314 -0
  18. data/lib/peddler/api/fulfillment_outbound_2020_07_01.rb +222 -0
  19. data/lib/peddler/api/listings_items_2020_09_01.rb +84 -0
  20. data/lib/peddler/api/listings_items_2021_08_01.rb +154 -0
  21. data/lib/peddler/api/listings_restrictions_2021_08_01.rb +37 -0
  22. data/lib/peddler/api/merchant_fulfillment_v0.rb +64 -0
  23. data/lib/peddler/api/messaging_v1.rb +241 -0
  24. data/lib/peddler/api/notifications_v1.rb +114 -0
  25. data/lib/peddler/api/orders_v0.rb +264 -0
  26. data/lib/peddler/api/product_fees_v0.rb +69 -0
  27. data/lib/peddler/api/product_pricing_2022_05_01.rb +43 -0
  28. data/lib/peddler/api/product_pricing_v0.rb +144 -0
  29. data/lib/peddler/api/product_type_definitions_2020_09_01.rb +75 -0
  30. data/lib/peddler/api/replenishment_2022_11_07.rb +45 -0
  31. data/lib/peddler/api/reports_2021_06_30.rb +139 -0
  32. data/lib/peddler/api/sales_v1.rb +69 -0
  33. data/lib/peddler/api/sellers_v1.rb +33 -0
  34. data/lib/peddler/api/services_v1.rb +308 -0
  35. data/lib/peddler/api/shipment_invoicing_v0.rb +46 -0
  36. data/lib/peddler/api/shipping_v1.rb +107 -0
  37. data/lib/peddler/api/shipping_v2.rb +267 -0
  38. data/lib/peddler/api/solicitations_v1.rb +53 -0
  39. data/lib/peddler/api/supply_sources_2020_07_01.rb +82 -0
  40. data/lib/peddler/api/tokens_2021_03_01.rb +30 -0
  41. data/lib/peddler/api/uploads_2020_11_01.rb +40 -0
  42. data/lib/peddler/api/vendor_direct_fulfillment_inventory_v1.rb +24 -0
  43. data/lib/peddler/api/vendor_direct_fulfillment_orders_2021_12_28.rb +72 -0
  44. data/lib/peddler/api/vendor_direct_fulfillment_orders_v1.rb +72 -0
  45. data/lib/peddler/api/vendor_direct_fulfillment_payments_v1.rb +23 -0
  46. data/lib/peddler/api/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +35 -0
  47. data/lib/peddler/api/vendor_direct_fulfillment_shipping_2021_12_28.rb +177 -0
  48. data/lib/peddler/api/vendor_direct_fulfillment_shipping_v1.rb +165 -0
  49. data/lib/peddler/api/vendor_direct_fulfillment_transactions_2021_12_28.rb +24 -0
  50. data/lib/peddler/api/vendor_direct_fulfillment_transactions_v1.rb +24 -0
  51. data/lib/peddler/api/vendor_invoices_v1.rb +22 -0
  52. data/lib/peddler/api/vendor_orders_v1.rb +148 -0
  53. data/lib/peddler/api/vendor_shipments_v1.rb +120 -0
  54. data/lib/peddler/api/vendor_transaction_status_v1.rb +24 -0
  55. data/lib/peddler/api.rb +115 -0
  56. data/lib/peddler/error.rb +30 -0
  57. data/lib/peddler/region.rb +30 -0
  58. data/lib/peddler/version.rb +1 -1
  59. data/lib/peddler.rb +52 -1
  60. metadata +70 -80
  61. data/lib/mws/easy_ship/client.rb +0 -93
  62. data/lib/mws/easy_ship.rb +0 -3
  63. data/lib/mws/feeds/client.rb +0 -122
  64. data/lib/mws/feeds.rb +0 -3
  65. data/lib/mws/finances/client.rb +0 -82
  66. data/lib/mws/finances.rb +0 -3
  67. data/lib/mws/fulfillment_inbound_shipment/client.rb +0 -388
  68. data/lib/mws/fulfillment_inbound_shipment.rb +0 -3
  69. data/lib/mws/fulfillment_inventory/client.rb +0 -57
  70. data/lib/mws/fulfillment_inventory.rb +0 -3
  71. data/lib/mws/fulfillment_outbound_shipment/client.rb +0 -211
  72. data/lib/mws/fulfillment_outbound_shipment.rb +0 -3
  73. data/lib/mws/merchant_fulfillment/client.rb +0 -87
  74. data/lib/mws/merchant_fulfillment.rb +0 -3
  75. data/lib/mws/off_amazon_payments.rb +0 -3
  76. data/lib/mws/orders/client.rb +0 -120
  77. data/lib/mws/orders.rb +0 -3
  78. data/lib/mws/products/client.rb +0 -268
  79. data/lib/mws/products.rb +0 -3
  80. data/lib/mws/recommendations/client.rb +0 -72
  81. data/lib/mws/recommendations.rb +0 -3
  82. data/lib/mws/reports/client.rb +0 -236
  83. data/lib/mws/reports.rb +0 -3
  84. data/lib/mws/sellers/client.rb +0 -44
  85. data/lib/mws/sellers.rb +0 -3
  86. data/lib/mws/shipment_invoicing/client.rb +0 -74
  87. data/lib/mws/shipment_invoicing.rb +0 -3
  88. data/lib/mws/subscriptions/client.rb +0 -179
  89. data/lib/mws/subscriptions.rb +0 -3
  90. data/lib/mws.rb +0 -29
  91. data/lib/peddler/client.rb +0 -159
  92. data/lib/peddler/errors/builder.rb +0 -64
  93. data/lib/peddler/errors/class_generator.rb +0 -40
  94. data/lib/peddler/errors/error.rb +0 -45
  95. data/lib/peddler/errors/parser.rb +0 -28
  96. data/lib/peddler/flat_file_parser.rb +0 -56
  97. data/lib/peddler/headers.rb +0 -102
  98. data/lib/peddler/marketplace.rb +0 -78
  99. data/lib/peddler/operation.rb +0 -78
  100. data/lib/peddler/parser.rb +0 -33
  101. data/lib/peddler/structured_list.rb +0 -23
  102. data/lib/peddler/vcr_matcher.rb +0 -97
  103. data/lib/peddler/xml_parser.rb +0 -38
  104. data/lib/peddler/xml_response_parser.rb +0 -25
@@ -0,0 +1,314 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class API
7
+ # Selling Partner API for Fulfillment Inbound
8
+ #
9
+ # The Selling Partner API for Fulfillment Inbound lets you create applications that create and update inbound
10
+ # shipments of inventory to Amazon's fulfillment network.
11
+ class FulfillmentInboundV0 < API
12
+ # Returns one or more inbound shipment plans, which provide the information you need to create one or more inbound
13
+ # shipments for a set of items that you specify. Multiple inbound shipment plans might be required so that items
14
+ # can be optimally placed in Amazon's fulfillment network—for example, positioning inventory closer to the
15
+ # customer. Alternatively, two inbound shipment plans might be created with the same Amazon fulfillment center
16
+ # destination if the two shipment plans require different processing—for example, items that require labels must
17
+ # be shipped separately from stickerless, commingled inventory.
18
+ #
19
+ # @param [Hash] body The request schema for the CreateInboundShipmentPlanRequest operation.
20
+ # @return [Hash] The API response
21
+ def create_inbound_shipment_plan(body)
22
+ path = "/fba/inbound/v0/plans"
23
+
24
+ rate_limit(2.0).post(path, body:)
25
+ end
26
+
27
+ # Returns a new inbound shipment based on the specified shipmentId that was returned by the
28
+ # createInboundShipmentPlan operation.
29
+ #
30
+ # @param [Hash] body The request schema for the InboundShipmentRequest operation.
31
+ # @param [String] shipment_id A shipment identifier originally returned by the createInboundShipmentPlan
32
+ # operation.
33
+ # @return [Hash] The API response
34
+ def create_inbound_shipment(body, shipment_id)
35
+ path = "/fba/inbound/v0/shipments/#{shipment_id}"
36
+
37
+ rate_limit(2.0).post(path, body:)
38
+ end
39
+
40
+ # Updates or removes items from the inbound shipment identified by the specified shipment identifier. Adding new
41
+ # items is not supported.
42
+ #
43
+ # @param [Hash] body The request schema for the InboundShipmentRequest operation.
44
+ # @param [String] shipment_id A shipment identifier originally returned by the createInboundShipmentPlan
45
+ # operation.
46
+ # @return [Hash] The API response
47
+ def update_inbound_shipment(body, shipment_id)
48
+ path = "/fba/inbound/v0/shipments/#{shipment_id}"
49
+
50
+ rate_limit(2.0).put(path, body:)
51
+ end
52
+
53
+ # Returns pre-order information, including dates, that a seller needs before confirming a shipment for pre-order.
54
+ #
55
+ # @param [String] shipment_id A shipment identifier originally returned by the createInboundShipmentPlan
56
+ # operation.
57
+ # @param [String] marketplace_id A marketplace identifier. Specifies the marketplace the shipment is tied to.
58
+ # @return [Hash] The API response
59
+ def get_preorder_info(shipment_id, marketplace_id)
60
+ path = "/fba/inbound/v0/shipments/#{shipment_id}/preorder"
61
+ params = {
62
+ "MarketplaceId" => marketplace_id,
63
+ }.compact
64
+
65
+ rate_limit(2.0).get(path, params:)
66
+ end
67
+
68
+ # Returns information needed to confirm a shipment for pre-order. Call this operation after calling the
69
+ # getPreorderInfo operation to get the NeedByDate value and other pre-order information about the shipment.
70
+ #
71
+ # @param [String] shipment_id A shipment identifier originally returned by the createInboundShipmentPlan
72
+ # operation.
73
+ # @param [String] need_by_date Date that the shipment must arrive at the Amazon fulfillment center to avoid
74
+ # delivery promise breaks for pre-ordered items. Must be in YYYY-MM-DD format. The response to the
75
+ # getPreorderInfo operation returns this value.
76
+ # @param [String] marketplace_id A marketplace identifier. Specifies the marketplace the shipment is tied to.
77
+ # @return [Hash] The API response
78
+ def confirm_preorder(shipment_id, need_by_date, marketplace_id)
79
+ path = "/fba/inbound/v0/shipments/#{shipment_id}/preorder/confirm"
80
+ params = {
81
+ "NeedByDate" => need_by_date,
82
+ "MarketplaceId" => marketplace_id,
83
+ }.compact
84
+
85
+ rate_limit(2.0).put(path, params:)
86
+ end
87
+
88
+ # Returns labeling requirements and item preparation instructions to help prepare items for shipment to Amazon's
89
+ # fulfillment network.
90
+ #
91
+ # @param [String] ship_to_country_code The country code of the country to which the items will be shipped. Note
92
+ # that labeling requirements and item preparation instructions can vary by country.
93
+ # @param [Array<String>] seller_sku_list A list of SellerSKU values. Used to identify items for which you want
94
+ # labeling requirements and item preparation instructions for shipment to Amazon's fulfillment network. The
95
+ # SellerSKU is qualified by the Seller ID, which is included with every call to the Seller Partner API. Note:
96
+ # Include seller SKUs that you have used to list items on Amazon's retail website. If you include a seller SKU
97
+ # that you have never used to list an item on Amazon's retail website, the seller SKU is returned in the
98
+ # InvalidSKUList property in the response.
99
+ # @param [Array<String>] asin_list A list of ASIN values. Used to identify items for which you want item
100
+ # preparation instructions to help with item sourcing decisions. Note: ASINs must be included in the product
101
+ # catalog for at least one of the marketplaces that the seller participates in. Any ASIN that is not included in
102
+ # the product catalog for at least one of the marketplaces that the seller participates in is returned in the
103
+ # InvalidASINList property in the response. You can find out which marketplaces a seller participates in by
104
+ # calling the getMarketplaceParticipations operation in the Selling Partner API for Sellers.
105
+ # @return [Hash] The API response
106
+ def get_prep_instructions(ship_to_country_code, seller_sku_list: nil, asin_list: nil)
107
+ path = "/fba/inbound/v0/prepInstructions"
108
+ params = {
109
+ "ShipToCountryCode" => ship_to_country_code,
110
+ "SellerSKUList" => seller_sku_list,
111
+ "ASINList" => asin_list,
112
+ }.compact
113
+
114
+ rate_limit(2.0).get(path, params:)
115
+ end
116
+
117
+ # Returns current transportation information about an inbound shipment.
118
+ #
119
+ # @param [String] shipment_id A shipment identifier originally returned by the createInboundShipmentPlan
120
+ # operation.
121
+ # @return [Hash] The API response
122
+ def get_transport_details(shipment_id)
123
+ path = "/fba/inbound/v0/shipments/#{shipment_id}/transport"
124
+
125
+ rate_limit(2.0).get(path)
126
+ end
127
+
128
+ # Sends transportation information to Amazon about an inbound shipment.
129
+ #
130
+ # @param [String] shipment_id A shipment identifier originally returned by the createInboundShipmentPlan
131
+ # operation.
132
+ # @param [Hash] body The request schema for the PutTransportDetailsRequest operation.
133
+ # @return [Hash] The API response
134
+ def put_transport_details(shipment_id, body)
135
+ path = "/fba/inbound/v0/shipments/#{shipment_id}/transport"
136
+
137
+ rate_limit(2.0).put(path, body:)
138
+ end
139
+
140
+ # Cancels a previously-confirmed request to ship an inbound shipment using an Amazon-partnered carrier. To be
141
+ # successful, you must call this operation before the VoidDeadline date that is returned by the
142
+ # getTransportDetails operation. Important: The VoidDeadline date is 24 hours after you confirm a Small Parcel
143
+ # shipment transportation request or one hour after you confirm a Less Than Truckload/Full Truckload (LTL/FTL)
144
+ # shipment transportation request. After the void deadline passes, your account will be charged for the shipping
145
+ # cost.
146
+ #
147
+ # @param [String] shipment_id A shipment identifier originally returned by the createInboundShipmentPlan
148
+ # operation.
149
+ # @return [Hash] The API response
150
+ def void_transport(shipment_id)
151
+ path = "/fba/inbound/v0/shipments/#{shipment_id}/transport/void"
152
+
153
+ rate_limit(2.0).post(path)
154
+ end
155
+
156
+ # Initiates the process of estimating the shipping cost for an inbound shipment by an Amazon-partnered carrier.
157
+ # Prior to calling the estimateTransport operation, you must call the putTransportDetails operation to provide
158
+ # Amazon with the transportation information for the inbound shipment.
159
+ #
160
+ # @param [String] shipment_id A shipment identifier originally returned by the createInboundShipmentPlan
161
+ # operation.
162
+ # @return [Hash] The API response
163
+ def estimate_transport(shipment_id)
164
+ path = "/fba/inbound/v0/shipments/#{shipment_id}/transport/estimate"
165
+
166
+ rate_limit(2.0).post(path)
167
+ end
168
+
169
+ # Confirms that the seller accepts the Amazon-partnered shipping estimate, agrees to allow Amazon to charge their
170
+ # account for the shipping cost, and requests that the Amazon-partnered carrier ship the inbound shipment. Prior
171
+ # to calling the confirmTransport operation, you should call the getTransportDetails operation to get the
172
+ # Amazon-partnered shipping estimate. Important: After confirming the transportation request, if the seller
173
+ # decides that they do not want the Amazon-partnered carrier to ship the inbound shipment, you can call the
174
+ # voidTransport operation to cancel the transportation request. Note that for a Small Parcel shipment, the seller
175
+ # has 24 hours after confirming a transportation request to void the transportation request. For a Less Than
176
+ # Truckload/Full Truckload (LTL/FTL) shipment, the seller has one hour after confirming a transportation request
177
+ # to void it. After the grace period has expired the seller's account will be charged for the shipping cost.
178
+ #
179
+ # @param [String] shipment_id A shipment identifier originally returned by the createInboundShipmentPlan
180
+ # operation.
181
+ # @return [Hash] The API response
182
+ def confirm_transport(shipment_id)
183
+ path = "/fba/inbound/v0/shipments/#{shipment_id}/transport/confirm"
184
+
185
+ rate_limit(2.0).post(path)
186
+ end
187
+
188
+ # Returns package/pallet labels for faster and more accurate shipment processing at the Amazon fulfillment center.
189
+ #
190
+ # @param [String] shipment_id A shipment identifier originally returned by the createInboundShipmentPlan
191
+ # operation.
192
+ # @param [String] page_type The page type to use to print the labels. Submitting a PageType value that is not
193
+ # supported in your marketplace returns an error.
194
+ # @param [String] label_type The type of labels requested.
195
+ # @param [Integer] number_of_packages The number of packages in the shipment.
196
+ # @param [Array<String>] package_labels_to_print A list of identifiers that specify packages for which you want
197
+ # package labels printed. Must match CartonId values previously passed using the FBA Inbound Shipment Carton
198
+ # Information Feed. If not, the operation returns the IncorrectPackageIdentifier error code.
199
+ # @param [Integer] number_of_pallets The number of pallets in the shipment. This returns four identical labels for
200
+ # each pallet.
201
+ # @param [Integer] page_size The page size for paginating through the total packages' labels. This is a required
202
+ # parameter for Non-Partnered LTL Shipments. Max value:1000.
203
+ # @param [Integer] page_start_index The page start index for paginating through the total packages' labels. This
204
+ # is a required parameter for Non-Partnered LTL Shipments.
205
+ # @return [Hash] The API response
206
+ def get_labels(shipment_id, page_type, label_type, number_of_packages: nil, package_labels_to_print: nil,
207
+ number_of_pallets: nil, page_size: nil, page_start_index: nil)
208
+ path = "/fba/inbound/v0/shipments/#{shipment_id}/labels"
209
+ params = {
210
+ "PageType" => page_type,
211
+ "LabelType" => label_type,
212
+ "NumberOfPackages" => number_of_packages,
213
+ "PackageLabelsToPrint" => package_labels_to_print,
214
+ "NumberOfPallets" => number_of_pallets,
215
+ "PageSize" => page_size,
216
+ "PageStartIndex" => page_start_index,
217
+ }.compact
218
+
219
+ rate_limit(2.0).get(path, params:)
220
+ end
221
+
222
+ # Returns a bill of lading for a Less Than Truckload/Full Truckload (LTL/FTL) shipment. The getBillOfLading
223
+ # operation returns PDF document data for printing a bill of lading for an Amazon-partnered Less Than
224
+ # Truckload/Full Truckload (LTL/FTL) inbound shipment.
225
+ #
226
+ # @param [String] shipment_id A shipment identifier originally returned by the createInboundShipmentPlan
227
+ # operation.
228
+ # @return [Hash] The API response
229
+ def get_bill_of_lading(shipment_id)
230
+ path = "/fba/inbound/v0/shipments/#{shipment_id}/billOfLading"
231
+
232
+ rate_limit(2.0).get(path)
233
+ end
234
+
235
+ # Returns a list of inbound shipments based on criteria that you specify.
236
+ #
237
+ # @param [Array<String>] shipment_status_list A list of ShipmentStatus values. Used to select shipments with a
238
+ # current status that matches the status values that you specify.
239
+ # @param [Array<String>] shipment_id_list A list of shipment IDs used to select the shipments that you want. If
240
+ # both ShipmentStatusList and ShipmentIdList are specified, only shipments that match both parameters are
241
+ # returned.
242
+ # @param [String] last_updated_after A date used for selecting inbound shipments that were last updated after (or
243
+ # at) a specified time. The selection includes updates made by Amazon and by the seller.
244
+ # @param [String] last_updated_before A date used for selecting inbound shipments that were last updated before
245
+ # (or at) a specified time. The selection includes updates made by Amazon and by the seller.
246
+ # @param [String] query_type Indicates whether shipments are returned using shipment information (by providing the
247
+ # ShipmentStatusList or ShipmentIdList parameters), using a date range (by providing the LastUpdatedAfter and
248
+ # LastUpdatedBefore parameters), or by using NextToken to continue returning items specified in a previous
249
+ # request.
250
+ # @param [String] next_token A string token returned in the response to your previous request.
251
+ # @param [String] marketplace_id A marketplace identifier. Specifies the marketplace where the product would be
252
+ # stored.
253
+ # @return [Hash] The API response
254
+ def get_shipments(query_type, marketplace_id, shipment_status_list: nil, shipment_id_list: nil,
255
+ last_updated_after: nil, last_updated_before: nil, next_token: nil)
256
+ path = "/fba/inbound/v0/shipments"
257
+ params = {
258
+ "ShipmentStatusList" => shipment_status_list,
259
+ "ShipmentIdList" => shipment_id_list,
260
+ "LastUpdatedAfter" => last_updated_after,
261
+ "LastUpdatedBefore" => last_updated_before,
262
+ "QueryType" => query_type,
263
+ "NextToken" => next_token,
264
+ "MarketplaceId" => marketplace_id,
265
+ }.compact
266
+
267
+ rate_limit(2.0).get(path, params:)
268
+ end
269
+
270
+ # Returns a list of items in a specified inbound shipment.
271
+ #
272
+ # @param [String] shipment_id A shipment identifier used for selecting items in a specific inbound shipment.
273
+ # @param [String] marketplace_id A marketplace identifier. Specifies the marketplace where the product would be
274
+ # stored.
275
+ # @return [Hash] The API response
276
+ def get_shipment_items_by_shipment_id(shipment_id, marketplace_id)
277
+ path = "/fba/inbound/v0/shipments/#{shipment_id}/items"
278
+ params = {
279
+ "MarketplaceId" => marketplace_id,
280
+ }.compact
281
+
282
+ rate_limit(2.0).get(path, params:)
283
+ end
284
+
285
+ # Returns a list of items in a specified inbound shipment, or a list of items that were updated within a specified
286
+ # time frame.
287
+ #
288
+ # @param [String] last_updated_after A date used for selecting inbound shipment items that were last updated after
289
+ # (or at) a specified time. The selection includes updates made by Amazon and by the seller.
290
+ # @param [String] last_updated_before A date used for selecting inbound shipment items that were last updated
291
+ # before (or at) a specified time. The selection includes updates made by Amazon and by the seller.
292
+ # @param [String] query_type Indicates whether items are returned using a date range (by providing the
293
+ # LastUpdatedAfter and LastUpdatedBefore parameters), or using NextToken, which continues returning items
294
+ # specified in a previous request.
295
+ # @param [String] next_token A string token returned in the response to your previous request.
296
+ # @param [String] marketplace_id A marketplace identifier. Specifies the marketplace where the product would be
297
+ # stored.
298
+ # @return [Hash] The API response
299
+ def get_shipment_items(query_type, marketplace_id, last_updated_after: nil, last_updated_before: nil,
300
+ next_token: nil)
301
+ path = "/fba/inbound/v0/shipmentItems"
302
+ params = {
303
+ "LastUpdatedAfter" => last_updated_after,
304
+ "LastUpdatedBefore" => last_updated_before,
305
+ "QueryType" => query_type,
306
+ "NextToken" => next_token,
307
+ "MarketplaceId" => marketplace_id,
308
+ }.compact
309
+
310
+ rate_limit(2.0).get(path, params:)
311
+ end
312
+ end
313
+ end
314
+ end
@@ -0,0 +1,222 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class API
7
+ # Selling Partner APIs for Fulfillment Outbound
8
+ #
9
+ # The Selling Partner API for Fulfillment Outbound lets you create applications that help a seller fulfill
10
+ # Multi-Channel Fulfillment orders using their inventory in Amazon's fulfillment network. You can get information on
11
+ # both potential and existing fulfillment orders.
12
+ class FulfillmentOutbound20200701 < API
13
+ # Returns a list of fulfillment order previews based on shipping criteria that you specify.
14
+ #
15
+ # @param [Hash] body GetFulfillmentPreviewRequest parameter
16
+ # @return [Hash] The API response
17
+ def get_fulfillment_preview(body)
18
+ path = "/fba/outbound/2020-07-01/fulfillmentOrders/preview"
19
+
20
+ rate_limit(2.0).post(path, body:)
21
+ end
22
+
23
+ # Returns delivery options that include an estimated delivery date and offer expiration, based on criteria that
24
+ # you specify.
25
+ #
26
+ # @param [Hash] body GetDeliveryOffersRequest parameter
27
+ # @return [Hash] The API response
28
+ def delivery_offers(body)
29
+ path = "/fba/outbound/2020-07-01/deliveryOffers"
30
+
31
+ rate_limit(5.0).post(path, body:)
32
+ end
33
+
34
+ # Returns a list of fulfillment orders fulfilled after (or at) a specified date-time, or indicated by the next
35
+ # token parameter.
36
+ #
37
+ # @param [String] query_start_date A date used to select fulfillment orders that were last updated after (or at) a
38
+ # specified time. An update is defined as any change in fulfillment order status, including the creation of a
39
+ # new fulfillment order.
40
+ # @param [String] next_token A string token returned in the response to your previous request.
41
+ # @return [Hash] The API response
42
+ def list_all_fulfillment_orders(query_start_date: nil, next_token: nil)
43
+ path = "/fba/outbound/2020-07-01/fulfillmentOrders"
44
+ params = {
45
+ "queryStartDate" => query_start_date,
46
+ "nextToken" => next_token,
47
+ }.compact
48
+
49
+ rate_limit(2.0).get(path, params:)
50
+ end
51
+
52
+ # Requests that Amazon ship items from the seller's inventory in Amazon's fulfillment network to a destination
53
+ # address.
54
+ #
55
+ # @param [Hash] body CreateFulfillmentOrderRequest parameter
56
+ # @return [Hash] The API response
57
+ def create_fulfillment_order(body)
58
+ path = "/fba/outbound/2020-07-01/fulfillmentOrders"
59
+
60
+ rate_limit(2.0).post(path, body:)
61
+ end
62
+
63
+ # Returns delivery tracking information for a package in an outbound shipment for a Multi-Channel Fulfillment
64
+ # order.
65
+ #
66
+ # @param [Integer] package_number The unencrypted package identifier returned by the `getFulfillmentOrder`
67
+ # operation.
68
+ # @return [Hash] The API response
69
+ def get_package_tracking_details(package_number)
70
+ path = "/fba/outbound/2020-07-01/tracking"
71
+ params = {
72
+ "packageNumber" => package_number,
73
+ }.compact
74
+
75
+ rate_limit(2.0).get(path, params:)
76
+ end
77
+
78
+ # Returns a list of return reason codes for a seller SKU in a given marketplace. The parameters for this operation
79
+ # may contain special characters that require URL encoding. To avoid errors with SKUs when encoding URLs, refer to
80
+ # [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
81
+ #
82
+ # @param [String] seller_sku The seller SKU for which return reason codes are required.
83
+ # @param [String] marketplace_id The marketplace for which the seller wants return reason codes.
84
+ # @param [String] seller_fulfillment_order_id The identifier assigned to the item by the seller when the
85
+ # fulfillment order was created. The service uses this value to determine the marketplace for which the seller
86
+ # wants return reason codes.
87
+ # @param [String] language The language that the `TranslatedDescription` property of the `ReasonCodeDetails`
88
+ # response object should be translated into.
89
+ # @return [Hash] The API response
90
+ def list_return_reason_codes(seller_sku, marketplace_id: nil, seller_fulfillment_order_id: nil, language: nil)
91
+ path = "/fba/outbound/2020-07-01/returnReasonCodes"
92
+ params = {
93
+ "sellerSku" => seller_sku,
94
+ "marketplaceId" => marketplace_id,
95
+ "sellerFulfillmentOrderId" => seller_fulfillment_order_id,
96
+ "language" => language,
97
+ }.compact
98
+
99
+ rate_limit(2.0).get(path, params:)
100
+ end
101
+
102
+ # Creates a fulfillment return.
103
+ #
104
+ # @param [Hash] body CreateFulfillmentReturnRequest parameter
105
+ # @param [String] seller_fulfillment_order_id An identifier assigned by the seller to the fulfillment order at the
106
+ # time it was created. The seller uses their own records to find the correct `SellerFulfillmentOrderId` value
107
+ # based on the buyer's request to return items.
108
+ # @return [Hash] The API response
109
+ def create_fulfillment_return(body, seller_fulfillment_order_id)
110
+ path = "/fba/outbound/2020-07-01/fulfillmentOrders/#{seller_fulfillment_order_id}/return"
111
+
112
+ rate_limit(2.0).put(path, body:)
113
+ end
114
+
115
+ # Returns the fulfillment order indicated by the specified order identifier.
116
+ #
117
+ # @param [String] seller_fulfillment_order_id The identifier assigned to the item by the seller when the
118
+ # fulfillment order was created.
119
+ # @return [Hash] The API response
120
+ def get_fulfillment_order(seller_fulfillment_order_id)
121
+ path = "/fba/outbound/2020-07-01/fulfillmentOrders/#{seller_fulfillment_order_id}"
122
+
123
+ rate_limit(2.0).get(path)
124
+ end
125
+
126
+ # Updates and/or requests shipment for a fulfillment order with an order hold on it.
127
+ #
128
+ # @param [Hash] body UpdateFulfillmentOrderRequest parameter
129
+ # @param [String] seller_fulfillment_order_id The identifier assigned to the item by the seller when the
130
+ # fulfillment order was created.
131
+ # @return [Hash] The API response
132
+ def update_fulfillment_order(body, seller_fulfillment_order_id)
133
+ path = "/fba/outbound/2020-07-01/fulfillmentOrders/#{seller_fulfillment_order_id}"
134
+
135
+ rate_limit(2.0).put(path, body:)
136
+ end
137
+
138
+ # Requests that Amazon stop attempting to fulfill the fulfillment order indicated by the specified order
139
+ # identifier.
140
+ #
141
+ # @param [String] seller_fulfillment_order_id The identifier assigned to the item by the seller when the
142
+ # fulfillment order was created.
143
+ # @return [Hash] The API response
144
+ def cancel_fulfillment_order(seller_fulfillment_order_id)
145
+ path = "/fba/outbound/2020-07-01/fulfillmentOrders/#{seller_fulfillment_order_id}/cancel"
146
+
147
+ rate_limit(2.0).put(path)
148
+ end
149
+
150
+ # Requests that Amazon update the status of an order in the sandbox testing environment. This is a sandbox-only
151
+ # operation and must be directed to a sandbox endpoint. Refer to [Fulfillment Outbound Dynamic Sandbox
152
+ # Guide](https://developer-docs.amazon.com/sp-api/docs/fulfillment-outbound-dynamic-sandbox-guide) and [Selling
153
+ # Partner API sandbox](https://developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more
154
+ # information.
155
+ #
156
+ # @param [String] seller_fulfillment_order_id The identifier assigned to the item by the seller when the
157
+ # fulfillment order was created.
158
+ # @param [Hash] body The identifier assigned to the item by the seller when the fulfillment order was created.
159
+ # @return [Hash] The API response
160
+ def submit_fulfillment_order_status_update(seller_fulfillment_order_id, body)
161
+ path = "/fba/outbound/2020-07-01/fulfillmentOrders/#{seller_fulfillment_order_id}/status"
162
+
163
+ put(path, body:)
164
+ end
165
+
166
+ # Returns a list of features available for Multi-Channel Fulfillment orders in the marketplace you specify, and
167
+ # whether the seller for which you made the call is enrolled for each feature.
168
+ #
169
+ # @param [String] marketplace_id The marketplace for which to return the list of features.
170
+ # @return [Hash] The API response
171
+ def get_features(marketplace_id)
172
+ path = "/fba/outbound/2020-07-01/features"
173
+ params = {
174
+ "marketplaceId" => marketplace_id,
175
+ }.compact
176
+
177
+ rate_limit(2.0).get(path, params:)
178
+ end
179
+
180
+ # Returns a list of inventory items that are eligible for the fulfillment feature you specify.
181
+ #
182
+ # @param [String] marketplace_id The marketplace for which to return a list of the inventory that is eligible for
183
+ # the specified feature.
184
+ # @param [String] feature_name The name of the feature for which to return a list of eligible inventory.
185
+ # @param [String] next_token A string token returned in the response to your previous request that is used to
186
+ # return the next response page. A value of null will return the first page.
187
+ # @param [String] query_start_date A date that you can use to select inventory that has been updated since a
188
+ # specified date. An update is defined as any change in feature-enabled inventory availability. The date must be
189
+ # in the format yyyy-MM-ddTHH:mm:ss.sssZ
190
+ # @return [Hash] The API response
191
+ def get_feature_inventory(marketplace_id, feature_name, next_token: nil, query_start_date: nil)
192
+ path = "/fba/outbound/2020-07-01/features/inventory/#{feature_name}"
193
+ params = {
194
+ "marketplaceId" => marketplace_id,
195
+ "nextToken" => next_token,
196
+ "queryStartDate" => query_start_date,
197
+ }.compact
198
+
199
+ rate_limit(2.0).get(path, params:)
200
+ end
201
+
202
+ # Returns the number of items with the sellerSKU you specify that can have orders fulfilled using the specified
203
+ # feature. Note that if the sellerSKU isn't eligible, the response will contain an empty skuInfo object. The
204
+ # parameters for this operation may contain special characters that require URL encoding. To avoid errors with
205
+ # SKUs when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
206
+ #
207
+ # @param [String] marketplace_id The marketplace for which to return the count.
208
+ # @param [String] feature_name The name of the feature.
209
+ # @param [String] seller_sku Used to identify an item in the given marketplace. `SellerSKU` is qualified by the
210
+ # seller's `SellerId`, which is included with every operation that you submit.
211
+ # @return [Hash] The API response
212
+ def get_feature_sku(marketplace_id, feature_name, seller_sku)
213
+ path = "/fba/outbound/2020-07-01/features/inventory/#{feature_name}/#{seller_sku}"
214
+ params = {
215
+ "marketplaceId" => marketplace_id,
216
+ }.compact
217
+
218
+ rate_limit(2.0).get(path, params:)
219
+ end
220
+ end
221
+ end
222
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class API
7
+ # Selling Partner API for Listings Items
8
+ #
9
+ # The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner
10
+ # listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which
11
+ # you use to retrieve the information about Amazon product types needed to use the Listings Items API. For more
12
+ # information, see the [Listing Items API Use Case Guide](doc:listings-items-api-v2020-09-01-use-case-guide).
13
+ class ListingsItems20200901 < API
14
+ # Delete a listings item for a selling partner.
15
+ # @note The parameters associated with this operation may contain special characters that must be encoded to
16
+ # successfully call the API. To avoid errors with SKUs when encoding URLs, refer to [URL
17
+ # Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
18
+ #
19
+ # @param [String] seller_id A selling partner identifier, such as a merchant account or vendor code.
20
+ # @param [String] sku A selling partner provided identifier for an Amazon listing.
21
+ # @param [Array<String>] marketplace_ids A comma-delimited list of Amazon marketplace identifiers for the request.
22
+ # @param [String] issue_locale A locale for localization of issues. When not provided, the default language code
23
+ # of the first marketplace is used. Examples: "en_US", "fr_CA", "fr_FR". Localized messages default to "en_US"
24
+ # when a localization is not available in the specified locale.
25
+ # @return [Hash] The API response
26
+ def delete_listings_item(seller_id, sku, marketplace_ids, issue_locale: nil)
27
+ path = "/listings/2020-09-01/items/#{seller_id}/#{sku}"
28
+ params = {
29
+ "marketplaceIds" => marketplace_ids,
30
+ "issueLocale" => issue_locale,
31
+ }.compact
32
+
33
+ rate_limit(5.0).delete(path, params:)
34
+ end
35
+
36
+ # Partially update (patch) a listings item for a selling partner. Only top-level listings item attributes can be
37
+ # patched. Patching nested attributes is not supported.
38
+ # @note The parameters associated with this operation may contain special characters that must be encoded to
39
+ # successfully call the API. To avoid errors with SKUs when encoding URLs, refer to [URL
40
+ # Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
41
+ #
42
+ # @param [String] seller_id A selling partner identifier, such as a merchant account or vendor code.
43
+ # @param [String] sku A selling partner provided identifier for an Amazon listing.
44
+ # @param [Array<String>] marketplace_ids A comma-delimited list of Amazon marketplace identifiers for the request.
45
+ # @param [String] issue_locale A locale for localization of issues. When not provided, the default language code
46
+ # of the first marketplace is used. Examples: "en_US", "fr_CA", "fr_FR". Localized messages default to "en_US"
47
+ # when a localization is not available in the specified locale.
48
+ # @param [Hash] body The request body schema for the patchListingsItem operation.
49
+ # @return [Hash] The API response
50
+ def patch_listings_item(seller_id, sku, marketplace_ids, body, issue_locale: nil)
51
+ path = "/listings/2020-09-01/items/#{seller_id}/#{sku}"
52
+ params = {
53
+ "marketplaceIds" => marketplace_ids,
54
+ "issueLocale" => issue_locale,
55
+ }.compact
56
+
57
+ rate_limit(5.0).patch(path, body:, params:)
58
+ end
59
+
60
+ # Creates a new or fully-updates an existing listings item for a selling partner.
61
+ # @note The parameters associated with this operation may contain special characters that must be encoded to
62
+ # successfully call the API. To avoid errors with SKUs when encoding URLs, refer to [URL
63
+ # Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
64
+ #
65
+ # @param [String] seller_id A selling partner identifier, such as a merchant account or vendor code.
66
+ # @param [String] sku A selling partner provided identifier for an Amazon listing.
67
+ # @param [Array<String>] marketplace_ids A comma-delimited list of Amazon marketplace identifiers for the request.
68
+ # @param [String] issue_locale A locale for localization of issues. When not provided, the default language code
69
+ # of the first marketplace is used. Examples: "en_US", "fr_CA", "fr_FR". Localized messages default to "en_US"
70
+ # when a localization is not available in the specified locale.
71
+ # @param [Hash] body The request body schema for the putListingsItem operation.
72
+ # @return [Hash] The API response
73
+ def put_listings_item(seller_id, sku, marketplace_ids, body, issue_locale: nil)
74
+ path = "/listings/2020-09-01/items/#{seller_id}/#{sku}"
75
+ params = {
76
+ "marketplaceIds" => marketplace_ids,
77
+ "issueLocale" => issue_locale,
78
+ }.compact
79
+
80
+ rate_limit(5.0).put(path, body:, params:)
81
+ end
82
+ end
83
+ end
84
+ end