peddler 2.4.5 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +402 -140
  3. data/lib/peddler/api/amazon_warehousing_and_distribution_2024_05_09.rb +92 -0
  4. data/lib/peddler/api/aplus_content_2020_11_01.rb +246 -0
  5. data/lib/peddler/api/application_integrations_2024_04_01.rb +56 -0
  6. data/lib/peddler/api/application_management_2023_11_30.rb +35 -0
  7. data/lib/peddler/api/catalog_items_2020_12_01.rb +81 -0
  8. data/lib/peddler/api/catalog_items_2022_04_01.rb +93 -0
  9. data/lib/peddler/api/catalog_items_v0.rb +103 -0
  10. data/lib/peddler/api/data_kiosk_2023_11_15.rb +108 -0
  11. data/lib/peddler/api/easy_ship_2022_03_23.rb +127 -0
  12. data/lib/peddler/api/fba_inbound_eligibility_v1.rb +44 -0
  13. data/lib/peddler/api/fba_inventory_v1.rb +122 -0
  14. data/lib/peddler/api/feeds_2021_06_30.rb +122 -0
  15. data/lib/peddler/api/finances_2024_06_19.rb +50 -0
  16. data/lib/peddler/api/finances_v0.rb +148 -0
  17. data/lib/peddler/api/fulfillment_inbound_2024_03_20.rb +759 -0
  18. data/lib/peddler/api/fulfillment_inbound_v0.rb +352 -0
  19. data/lib/peddler/api/fulfillment_outbound_2020_07_01.rb +259 -0
  20. data/lib/peddler/api/invoices_2024_06_19.rb +180 -0
  21. data/lib/peddler/api/listings_items_2020_09_01.rb +95 -0
  22. data/lib/peddler/api/listings_items_2021_08_01.rb +170 -0
  23. data/lib/peddler/api/listings_restrictions_2021_08_01.rb +47 -0
  24. data/lib/peddler/api/merchant_fulfillment_v0.rb +80 -0
  25. data/lib/peddler/api/messaging_v1.rb +273 -0
  26. data/lib/peddler/api/notifications_v1.rb +145 -0
  27. data/lib/peddler/api/orders_v0.rb +279 -0
  28. data/lib/peddler/api/product_fees_v0.rb +77 -0
  29. data/lib/peddler/api/product_pricing_2022_05_01.rb +54 -0
  30. data/lib/peddler/api/product_pricing_v0.rb +162 -0
  31. data/lib/peddler/api/product_type_definitions_2020_09_01.rb +86 -0
  32. data/lib/peddler/api/replenishment_2022_11_07.rb +57 -0
  33. data/lib/peddler/api/reports_2021_06_30.rb +163 -0
  34. data/lib/peddler/api/sales_v1.rb +77 -0
  35. data/lib/peddler/api/sellers_v1.rb +45 -0
  36. data/lib/peddler/api/services_v1.rb +348 -0
  37. data/lib/peddler/api/shipment_invoicing_v0.rb +59 -0
  38. data/lib/peddler/api/shipping_v1.rb +132 -0
  39. data/lib/peddler/api/shipping_v2.rb +319 -0
  40. data/lib/peddler/api/solicitations_v1.rb +63 -0
  41. data/lib/peddler/api/supply_sources_2020_07_01.rb +100 -0
  42. data/lib/peddler/api/tokens_2021_03_01.rb +38 -0
  43. data/lib/peddler/api/uploads_2020_11_01.rb +50 -0
  44. data/lib/peddler/api/vendor_direct_fulfillment_inventory_v1.rb +32 -0
  45. data/lib/peddler/api/vendor_direct_fulfillment_orders_2021_12_28.rb +84 -0
  46. data/lib/peddler/api/vendor_direct_fulfillment_orders_v1.rb +84 -0
  47. data/lib/peddler/api/vendor_direct_fulfillment_payments_v1.rb +31 -0
  48. data/lib/peddler/api/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +45 -0
  49. data/lib/peddler/api/vendor_direct_fulfillment_shipping_2021_12_28.rb +203 -0
  50. data/lib/peddler/api/vendor_direct_fulfillment_shipping_v1.rb +189 -0
  51. data/lib/peddler/api/vendor_direct_fulfillment_transactions_2021_12_28.rb +32 -0
  52. data/lib/peddler/api/vendor_direct_fulfillment_transactions_v1.rb +32 -0
  53. data/lib/peddler/api/vendor_invoices_v1.rb +30 -0
  54. data/lib/peddler/api/vendor_orders_v1.rb +159 -0
  55. data/lib/peddler/api/vendor_shipments_v1.rb +132 -0
  56. data/lib/peddler/api/vendor_transaction_status_v1.rb +33 -0
  57. data/lib/peddler/api.rb +138 -0
  58. data/lib/peddler/endpoint.rb +51 -0
  59. data/lib/peddler/error.rb +31 -0
  60. data/lib/peddler/marketplace.rb +38 -68
  61. data/lib/peddler/token.rb +70 -0
  62. data/lib/peddler/version.rb +1 -1
  63. data/lib/peddler.rb +56 -1
  64. metadata +74 -80
  65. data/lib/mws/easy_ship/client.rb +0 -93
  66. data/lib/mws/easy_ship.rb +0 -3
  67. data/lib/mws/feeds/client.rb +0 -122
  68. data/lib/mws/feeds.rb +0 -3
  69. data/lib/mws/finances/client.rb +0 -82
  70. data/lib/mws/finances.rb +0 -3
  71. data/lib/mws/fulfillment_inbound_shipment/client.rb +0 -388
  72. data/lib/mws/fulfillment_inbound_shipment.rb +0 -3
  73. data/lib/mws/fulfillment_inventory/client.rb +0 -57
  74. data/lib/mws/fulfillment_inventory.rb +0 -3
  75. data/lib/mws/fulfillment_outbound_shipment/client.rb +0 -211
  76. data/lib/mws/fulfillment_outbound_shipment.rb +0 -3
  77. data/lib/mws/merchant_fulfillment/client.rb +0 -87
  78. data/lib/mws/merchant_fulfillment.rb +0 -3
  79. data/lib/mws/off_amazon_payments.rb +0 -3
  80. data/lib/mws/orders/client.rb +0 -120
  81. data/lib/mws/orders.rb +0 -3
  82. data/lib/mws/products/client.rb +0 -268
  83. data/lib/mws/products.rb +0 -3
  84. data/lib/mws/recommendations/client.rb +0 -72
  85. data/lib/mws/recommendations.rb +0 -3
  86. data/lib/mws/reports/client.rb +0 -236
  87. data/lib/mws/reports.rb +0 -3
  88. data/lib/mws/sellers/client.rb +0 -44
  89. data/lib/mws/sellers.rb +0 -3
  90. data/lib/mws/shipment_invoicing/client.rb +0 -74
  91. data/lib/mws/shipment_invoicing.rb +0 -3
  92. data/lib/mws/subscriptions/client.rb +0 -179
  93. data/lib/mws/subscriptions.rb +0 -3
  94. data/lib/mws.rb +0 -29
  95. data/lib/peddler/client.rb +0 -159
  96. data/lib/peddler/errors/builder.rb +0 -64
  97. data/lib/peddler/errors/class_generator.rb +0 -40
  98. data/lib/peddler/errors/error.rb +0 -45
  99. data/lib/peddler/errors/parser.rb +0 -28
  100. data/lib/peddler/flat_file_parser.rb +0 -56
  101. data/lib/peddler/headers.rb +0 -102
  102. data/lib/peddler/operation.rb +0 -78
  103. data/lib/peddler/parser.rb +0 -33
  104. data/lib/peddler/structured_list.rb +0 -23
  105. data/lib/peddler/vcr_matcher.rb +0 -97
  106. data/lib/peddler/xml_parser.rb +0 -38
  107. data/lib/peddler/xml_response_parser.rb +0 -25
@@ -0,0 +1,279 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def orders_v0(...)
8
+ API::OrdersV0.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Orders
14
+ #
15
+ # Use the Orders Selling Partner API to programmatically retrieve order information. With this API, you can develop
16
+ # fast, flexible, and custom applications to manage order synchronization, perform order research, and create
17
+ # demand-based decision support tools. _Note:_ For the JP, AU, and SG marketplaces, the Orders API supports orders
18
+ # from 2016 onward. For all other marketplaces, the Orders API supports orders for the last two years (orders older
19
+ # than this don't show up in the response).
20
+ class OrdersV0 < API
21
+ # Returns orders that are created or updated during the specified time period. If you want to return specific
22
+ # types of orders, you can apply filters to your request. `NextToken` doesn't affect any filters that you include
23
+ # in your request; it only impacts the pagination for the filtered orders response.
24
+ #
25
+ # @note This operation can make a static sandbox call.
26
+ # @param created_after [String] Use this date to select orders created after (or at) a specified time. Only orders
27
+ # placed after the specified time are returned. The date must be in [ISO
28
+ # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. **Note**: Either the `CreatedAfter`
29
+ # parameter or the `LastUpdatedAfter` parameter is required. Both cannot be empty. `LastUpdatedAfter` and
30
+ # `LastUpdatedBefore` cannot be set when `CreatedAfter` is set.
31
+ # @param created_before [String] Use this date to select orders created before (or at) a specified time. Only
32
+ # orders placed before the specified time are returned. The date must be in [ISO
33
+ # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. **Note**: `CreatedBefore` is optional
34
+ # when `CreatedAfter` is set. If specified, `CreatedBefore` must be equal to or after the `CreatedAfter` date
35
+ # and at least two minutes before current time.
36
+ # @param last_updated_after [String] Use this date to select orders that were last updated after (or at) a
37
+ # specified time. An update is defined as any change in order status, including the creation of a new order.
38
+ # Includes updates made by Amazon and by the seller. The date must be in [ISO
39
+ # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. **Note**: Either the `CreatedAfter`
40
+ # parameter or the `LastUpdatedAfter` parameter is required. Both cannot be empty. `CreatedAfter` or
41
+ # `CreatedBefore` cannot be set when `LastUpdatedAfter` is set.
42
+ # @param last_updated_before [String] Use this date to select orders that were last updated before (or at) a
43
+ # specified time. An update is defined as any change in order status, including the creation of a new order.
44
+ # Includes updates made by Amazon and by the seller. The date must be in [ISO
45
+ # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. **Note**: `LastUpdatedBefore` is
46
+ # optional when `LastUpdatedAfter` is set. But if specified, `LastUpdatedBefore` must be equal to or after the
47
+ # `LastUpdatedAfter` date and at least two minutes before current time.
48
+ # @param order_statuses [Array<String>] A list of `OrderStatus` values used to filter the results. **Possible
49
+ # values:** - `PendingAvailability` (This status is available for pre-orders only. The order has been placed,
50
+ # payment has not been authorized, and the release date of the item is in the future.) - `Pending` (The order
51
+ # has been placed but payment has not been authorized.) - `Unshipped` (Payment has been authorized and the order
52
+ # is ready for shipment, but no items in the order have been shipped.) - `PartiallyShipped` (One or more, but
53
+ # not all, items in the order have been shipped.) - `Shipped` (All items in the order have been shipped.) -
54
+ # `InvoiceUnconfirmed` (All items in the order have been shipped. The seller has not yet given confirmation to
55
+ # Amazon that the invoice has been shipped to the buyer.) - `Canceled` (The order has been canceled.) -
56
+ # `Unfulfillable` (The order cannot be fulfilled. This state applies only to Multi-Channel Fulfillment orders.)
57
+ # @param marketplace_ids [Array<String>] A list of `MarketplaceId` values. Used to select orders that were placed
58
+ # in the specified marketplaces. Refer to [Marketplace
59
+ # IDs](https://developer-docs.amazon.com/sp-api/docs/marketplace-ids) for a complete list of `marketplaceId`
60
+ # values.
61
+ # @param fulfillment_channels [Array<String>] A list that indicates how an order was fulfilled. Filters the
62
+ # results by fulfillment channel. **Possible values**: `AFN` (fulfilled by Amazon), `MFN` (fulfilled by seller).
63
+ # @param payment_methods [Array<String>] A list of payment method values. Use this field to select orders that
64
+ # were paid with the specified payment methods. **Possible values**: `COD` (cash on delivery), `CVS`
65
+ # (convenience store), `Other` (Any payment method other than COD or CVS).
66
+ # @param buyer_email [String] The email address of a buyer. Used to select orders that contain the specified email
67
+ # address.
68
+ # @param seller_order_id [String] An order identifier that is specified by the seller. Used to select only the
69
+ # orders that match the order identifier. If `SellerOrderId` is specified, then `FulfillmentChannels`,
70
+ # `OrderStatuses`, `PaymentMethod`, `LastUpdatedAfter`, LastUpdatedBefore, and `BuyerEmail` cannot be specified.
71
+ # @param max_results_per_page [Integer] A number that indicates the maximum number of orders that can be returned
72
+ # per page. Value must be 1 - 100. Default 100.
73
+ # @param easy_ship_shipment_statuses [Array<String>] A list of `EasyShipShipmentStatus` values. Used to select
74
+ # Easy Ship orders with statuses that match the specified values. If `EasyShipShipmentStatus` is specified, only
75
+ # Amazon Easy Ship orders are returned. **Possible values:** - `PendingSchedule` (The package is awaiting the
76
+ # schedule for pick-up.) - `PendingPickUp` (Amazon has not yet picked up the package from the seller.) -
77
+ # `PendingDropOff` (The seller will deliver the package to the carrier.) - `LabelCanceled` (The seller canceled
78
+ # the pickup.) - `PickedUp` (Amazon has picked up the package from the seller.) - `DroppedOff` (The package is
79
+ # delivered to the carrier by the seller.) - `AtOriginFC` (The packaged is at the origin fulfillment center.) -
80
+ # `AtDestinationFC` (The package is at the destination fulfillment center.) - `Delivered` (The package has been
81
+ # delivered.) - `RejectedByBuyer` (The package has been rejected by the buyer.) - `Undeliverable` (The package
82
+ # cannot be delivered.) - `ReturningToSeller` (The package was not delivered and is being returned to the
83
+ # seller.) - `ReturnedToSeller` (The package was not delivered and was returned to the seller.) - `Lost` (The
84
+ # package is lost.) - `OutForDelivery` (The package is out for delivery.) - `Damaged` (The package was damaged
85
+ # by the carrier.)
86
+ # @param electronic_invoice_statuses [Array<String>] A list of `ElectronicInvoiceStatus` values. Used to select
87
+ # orders with electronic invoice statuses that match the specified values. **Possible values:** - `NotRequired`
88
+ # (Electronic invoice submission is not required for this order.) - `NotFound` (The electronic invoice was not
89
+ # submitted for this order.) - `Processing` (The electronic invoice is being processed for this order.) -
90
+ # `Errored` (The last submitted electronic invoice was rejected for this order.) - `Accepted` (The last
91
+ # submitted electronic invoice was submitted and accepted.)
92
+ # @param next_token [String] A string token returned in the response of your previous request.
93
+ # @param amazon_order_ids [Array<String>] A list of `AmazonOrderId` values. An `AmazonOrderId` is an
94
+ # Amazon-defined order identifier, in 3-7-7 format.
95
+ # @param actual_fulfillment_supply_source_id [String] The `sourceId` of the location from where you want the order
96
+ # fulfilled.
97
+ # @param is_ispu [Boolean] When true, this order is marked to be picked up from a store rather than delivered.
98
+ # @param store_chain_store_id [String] The store chain store identifier. Linked to a specific store in a store
99
+ # chain.
100
+ # @param earliest_delivery_date_before [String] Use this date to select orders with a earliest delivery date
101
+ # before (or at) a specified time. The date must be in [ISO
102
+ # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format.
103
+ # @param earliest_delivery_date_after [String] Use this date to select orders with a earliest delivery date after
104
+ # (or at) a specified time. The date must be in [ISO
105
+ # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format.
106
+ # @param latest_delivery_date_before [String] Use this date to select orders with a latest delivery date before
107
+ # (or at) a specified time. The date must be in [ISO
108
+ # 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format.
109
+ # @param latest_delivery_date_after [String] Use this date to select orders with a latest delivery date after (or
110
+ # at) a specified time. The date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601)
111
+ # format.
112
+ # @param rate_limit [Float] Requests per second
113
+ # @return [Hash] The API response
114
+ def get_orders(marketplace_ids, created_after: nil, created_before: nil, last_updated_after: nil,
115
+ last_updated_before: nil, order_statuses: nil, fulfillment_channels: nil, payment_methods: nil,
116
+ buyer_email: nil, seller_order_id: nil, max_results_per_page: nil, easy_ship_shipment_statuses: nil,
117
+ electronic_invoice_statuses: nil, next_token: nil, amazon_order_ids: nil,
118
+ actual_fulfillment_supply_source_id: nil, is_ispu: nil, store_chain_store_id: nil,
119
+ earliest_delivery_date_before: nil, earliest_delivery_date_after: nil, latest_delivery_date_before: nil,
120
+ latest_delivery_date_after: nil, rate_limit: 0.0167)
121
+ path = "/orders/v0/orders"
122
+ params = {
123
+ "CreatedAfter" => created_after,
124
+ "CreatedBefore" => created_before,
125
+ "LastUpdatedAfter" => last_updated_after,
126
+ "LastUpdatedBefore" => last_updated_before,
127
+ "OrderStatuses" => order_statuses,
128
+ "MarketplaceIds" => marketplace_ids,
129
+ "FulfillmentChannels" => fulfillment_channels,
130
+ "PaymentMethods" => payment_methods,
131
+ "BuyerEmail" => buyer_email,
132
+ "SellerOrderId" => seller_order_id,
133
+ "MaxResultsPerPage" => max_results_per_page,
134
+ "EasyShipShipmentStatuses" => easy_ship_shipment_statuses,
135
+ "ElectronicInvoiceStatuses" => electronic_invoice_statuses,
136
+ "NextToken" => next_token,
137
+ "AmazonOrderIds" => amazon_order_ids,
138
+ "ActualFulfillmentSupplySourceId" => actual_fulfillment_supply_source_id,
139
+ "IsISPU" => is_ispu,
140
+ "StoreChainStoreId" => store_chain_store_id,
141
+ "EarliestDeliveryDateBefore" => earliest_delivery_date_before,
142
+ "EarliestDeliveryDateAfter" => earliest_delivery_date_after,
143
+ "LatestDeliveryDateBefore" => latest_delivery_date_before,
144
+ "LatestDeliveryDateAfter" => latest_delivery_date_after,
145
+ }.compact
146
+
147
+ meter(rate_limit).get(path, params:)
148
+ end
149
+
150
+ # Returns the order that you specify.
151
+ #
152
+ # @note This operation can make a static sandbox call.
153
+ # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format.
154
+ # @param rate_limit [Float] Requests per second
155
+ # @return [Hash] The API response
156
+ def get_order(order_id, rate_limit: 0.5)
157
+ path = "/orders/v0/orders/#{order_id}"
158
+
159
+ meter(rate_limit).get(path)
160
+ end
161
+
162
+ # Returns buyer information for the order that you specify.
163
+ #
164
+ # @note This operation can make a static sandbox call.
165
+ # @param order_id [String] An `orderId` is an Amazon-defined order identifier, in 3-7-7 format.
166
+ # @param rate_limit [Float] Requests per second
167
+ # @return [Hash] The API response
168
+ def get_order_buyer_info(order_id, rate_limit: 0.5)
169
+ path = "/orders/v0/orders/#{order_id}/buyerInfo"
170
+
171
+ meter(rate_limit).get(path)
172
+ end
173
+
174
+ # Returns the shipping address for the order that you specify.
175
+ #
176
+ # @note This operation can make a static sandbox call.
177
+ # @param order_id [String] An `orderId` is an Amazon-defined order identifier, in 3-7-7 format.
178
+ # @param rate_limit [Float] Requests per second
179
+ # @return [Hash] The API response
180
+ def get_order_address(order_id, rate_limit: 0.5)
181
+ path = "/orders/v0/orders/#{order_id}/address"
182
+
183
+ meter(rate_limit).get(path)
184
+ end
185
+
186
+ # Returns detailed order item information for the order that you specify. If `NextToken` is provided, it's used to
187
+ # retrieve the next page of order items. __Note__: When an order is in the Pending state (the order has been
188
+ # placed but payment has not been authorized), the getOrderItems operation does not return information about
189
+ # pricing, taxes, shipping charges, gift status or promotions for the order items in the order. After an order
190
+ # leaves the Pending state (this occurs when payment has been authorized) and enters the Unshipped, Partially
191
+ # Shipped, or Shipped state, the getOrderItems operation returns information about pricing, taxes, shipping
192
+ # charges, gift status and promotions for the order items in the order.
193
+ #
194
+ # @note This operation can make a static sandbox call.
195
+ # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format.
196
+ # @param next_token [String] A string token returned in the response of your previous request.
197
+ # @param rate_limit [Float] Requests per second
198
+ # @return [Hash] The API response
199
+ def get_order_items(order_id, next_token: nil, rate_limit: 0.5)
200
+ path = "/orders/v0/orders/#{order_id}/orderItems"
201
+ params = {
202
+ "NextToken" => next_token,
203
+ }.compact
204
+
205
+ meter(rate_limit).get(path, params:)
206
+ end
207
+
208
+ # Returns buyer information for the order items in the order that you specify.
209
+ #
210
+ # @note This operation can make a static sandbox call.
211
+ # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format.
212
+ # @param next_token [String] A string token returned in the response of your previous request.
213
+ # @param rate_limit [Float] Requests per second
214
+ # @return [Hash] The API response
215
+ def get_order_items_buyer_info(order_id, next_token: nil, rate_limit: 0.5)
216
+ path = "/orders/v0/orders/#{order_id}/orderItems/buyerInfo"
217
+ params = {
218
+ "NextToken" => next_token,
219
+ }.compact
220
+
221
+ meter(rate_limit).get(path, params:)
222
+ end
223
+
224
+ # Update the shipment status for an order that you specify.
225
+ #
226
+ # @note This operation can make a static sandbox call.
227
+ # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format.
228
+ # @param payload [Hash] The request body for the `updateShipmentStatus` operation.
229
+ # @param rate_limit [Float] Requests per second
230
+ # @return [Hash] The API response
231
+ def update_shipment_status(order_id, payload, rate_limit: 5.0)
232
+ path = "/orders/v0/orders/#{order_id}/shipment"
233
+ body = payload
234
+
235
+ meter(rate_limit).post(path, body:)
236
+ end
237
+
238
+ # Returns regulated information for the order that you specify.
239
+ #
240
+ # @note This operation can make a static sandbox call.
241
+ # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format.
242
+ # @param rate_limit [Float] Requests per second
243
+ # @return [Hash] The API response
244
+ def get_order_regulated_info(order_id, rate_limit: 0.5)
245
+ path = "/orders/v0/orders/#{order_id}/regulatedInfo"
246
+
247
+ meter(rate_limit).get(path)
248
+ end
249
+
250
+ # Updates (approves or rejects) the verification status of an order containing regulated products.
251
+ #
252
+ # @note This operation can make a static sandbox call.
253
+ # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format.
254
+ # @param payload [Hash] The request body for the `updateVerificationStatus` operation.
255
+ # @param rate_limit [Float] Requests per second
256
+ # @return [Hash] The API response
257
+ def update_verification_status(order_id, payload, rate_limit: 0.5)
258
+ path = "/orders/v0/orders/#{order_id}/regulatedInfo"
259
+ body = payload
260
+
261
+ meter(rate_limit).patch(path, body:)
262
+ end
263
+
264
+ # Updates the shipment confirmation status for a specified order.
265
+ #
266
+ # @note This operation can make a static sandbox call.
267
+ # @param order_id [String] An Amazon-defined order identifier, in 3-7-7 format.
268
+ # @param payload [Hash] Request body of `confirmShipment`.
269
+ # @param rate_limit [Float] Requests per second
270
+ # @return [Hash] The API response
271
+ def confirm_shipment(order_id, payload, rate_limit: 2.0)
272
+ path = "/orders/v0/orders/#{order_id}/shipmentConfirmation"
273
+ body = payload
274
+
275
+ meter(rate_limit).post(path, body:)
276
+ end
277
+ end
278
+ end
279
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def product_fees_v0(...)
8
+ API::ProductFeesV0.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Product Fees
14
+ #
15
+ # The Selling Partner API for Product Fees lets you programmatically retrieve estimated fees for a product. You can
16
+ # then account for those fees in your pricing.
17
+ class ProductFeesV0 < API
18
+ # Returns the estimated fees for the item indicated by the specified seller SKU in the marketplace specified in
19
+ # the request body. **Note:** The parameters associated with this operation may contain special characters that
20
+ # require URL encoding to call the API. To avoid errors with SKUs when encoding URLs, refer to [URL
21
+ # Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding). You can call `getMyFeesEstimateForSKU`
22
+ # for an item on behalf of a selling partner before the selling partner sets the item's price. The selling partner
23
+ # can then take any estimated fees into account. Each fees estimate request must include an original identifier.
24
+ # This identifier is included in the fees estimate so that you can correlate a fees estimate with the original
25
+ # request. **Note:** This identifier value is used to identify an estimate. Actual costs may vary. Search "fees"
26
+ # in [Seller Central](https://sellercentral.amazon.com/) and consult the store-specific fee schedule for the most
27
+ # up-to-date information. **Note:** When sellers use the `getMyFeesEstimateForSKU` operation with their
28
+ # `SellerSKU`, they get accurate fees based on real item measurements, but only after they've sent their items to
29
+ # Amazon.
30
+ #
31
+ # @note This operation can make a static sandbox call.
32
+ # @param body [Hash]
33
+ # @param seller_sku [String] Used to identify an item in the given marketplace. SellerSKU is qualified by the
34
+ # seller's SellerId, which is included with every operation that you submit.
35
+ # @param rate_limit [Float] Requests per second
36
+ # @return [Hash] The API response
37
+ def get_my_fees_estimate_for_sku(body, seller_sku, rate_limit: 1.0)
38
+ path = "/products/fees/v0/listings/#{seller_sku}/feesEstimate"
39
+
40
+ meter(rate_limit).post(path, body:)
41
+ end
42
+
43
+ # Returns the estimated fees for the item indicated by the specified ASIN in the marketplace specified in the
44
+ # request body. You can call `getMyFeesEstimateForASIN` for an item on behalf of a selling partner before the
45
+ # selling partner sets the item's price. The selling partner can then take estimated fees into account. Each fees
46
+ # request must include an original identifier. This identifier is included in the fees estimate so you can
47
+ # correlate a fees estimate with the original request. **Note:** This identifier value is used to identify an
48
+ # estimate. Actual costs may vary. Search "fees" in [Seller Central](https://sellercentral.amazon.com/) and
49
+ # consult the store-specific fee schedule for the most up-to-date information. **Note:** When using the
50
+ # `getMyFeesEstimateForASIN` operation with an ASIN, the fee estimates might be different. This is because these
51
+ # estimates use the item's catalog size, which might not always match the actual size of the item sent to Amazon.
52
+ #
53
+ # @note This operation can make a static sandbox call.
54
+ # @param body [Hash]
55
+ # @param asin [String] The Amazon Standard Identification Number (ASIN) of the item.
56
+ # @param rate_limit [Float] Requests per second
57
+ # @return [Hash] The API response
58
+ def get_my_fees_estimate_for_asin(body, asin, rate_limit: 1.0)
59
+ path = "/products/fees/v0/items/#{asin}/feesEstimate"
60
+
61
+ meter(rate_limit).post(path, body:)
62
+ end
63
+
64
+ # Returns the estimated fees for a list of products.
65
+ #
66
+ # @note This operation can make a static sandbox call.
67
+ # @param body [Hash]
68
+ # @param rate_limit [Float] Requests per second
69
+ # @return [Hash] The API response
70
+ def get_my_fees_estimates(body, rate_limit: 0.5)
71
+ path = "/products/fees/v0/feesEstimate"
72
+
73
+ meter(rate_limit).post(path, body:)
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def product_pricing_2022_05_01(...)
8
+ API::ProductPricing20220501.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Pricing
14
+ #
15
+ # The Selling Partner API for Pricing helps you programmatically retrieve product pricing and offer pricing
16
+ # information for Amazon Marketplace products. For more information, refer to the [Product Pricing v2022-05-01 Use
17
+ # Case Guide](https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v2022-05-01-use-case-guide).
18
+ class ProductPricing20220501 < API
19
+ # Returns the set of responses that correspond to the batched list of up to 40 requests defined in the request
20
+ # body. The response for each successful (HTTP status code 200) request in the set includes the computed listing
21
+ # price at or below which a seller can expect to become the featured offer (before applicable promotions). This is
22
+ # called the featured offer expected price (FOEP). Featured offer is not guaranteed, because competing offers may
23
+ # change, and different offers may be featured based on other factors, including fulfillment capabilities to a
24
+ # specific customer. The response to an unsuccessful request includes the available error text.
25
+ #
26
+ # @note This operation can make a static sandbox call.
27
+ # @param get_featured_offer_expected_price_batch_request_body [Hash] The batch of `getFeaturedOfferExpectedPrice`
28
+ # requests.
29
+ # @param rate_limit [Float] Requests per second
30
+ # @return [Hash] The API response
31
+ def get_featured_offer_expected_price_batch(get_featured_offer_expected_price_batch_request_body,
32
+ rate_limit: 0.033)
33
+ path = "/batches/products/pricing/2022-05-01/offer/featuredOfferExpectedPrice"
34
+ body = get_featured_offer_expected_price_batch_request_body
35
+
36
+ meter(rate_limit).post(path, body:)
37
+ end
38
+
39
+ # Returns the competitive summary response including featured buying options for the ASIN and `marketplaceId`
40
+ # combination.
41
+ #
42
+ # @note This operation can make a static sandbox call.
43
+ # @param requests [Hash] The batch of `getCompetitiveSummary` requests.
44
+ # @param rate_limit [Float] Requests per second
45
+ # @return [Hash] The API response
46
+ def get_competitive_summary(requests, rate_limit: 0.033)
47
+ path = "/batches/products/pricing/2022-05-01/items/competitiveSummary"
48
+ body = requests
49
+
50
+ meter(rate_limit).post(path, body:)
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,162 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def product_pricing_v0(...)
8
+ API::ProductPricingV0.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Pricing
14
+ #
15
+ # The Selling Partner API for Pricing helps you programmatically retrieve product pricing and offer information for
16
+ # Amazon Marketplace products.
17
+ class ProductPricingV0 < API
18
+ # Returns pricing information for a seller's offer listings based on seller SKU or ASIN. **Note:** The parameters
19
+ # associated with this operation may contain special characters that require URL encoding to call the API. To
20
+ # avoid errors with SKUs when encoding URLs, refer to [URL
21
+ # Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
22
+ #
23
+ # @note This operation can make a static sandbox call.
24
+ # @param marketplace_id [String] A marketplace identifier. Specifies the marketplace for which prices are
25
+ # returned.
26
+ # @param asins [Array<String>] A list of up to twenty Amazon Standard Identification Number (ASIN) values used to
27
+ # identify items in the given marketplace.
28
+ # @param skus [Array<String>] A list of up to twenty seller SKU values used to identify items in the given
29
+ # marketplace.
30
+ # @param item_type [String] Indicates whether ASIN values or seller SKU values are used to identify items. If you
31
+ # specify Asin, the information in the response will be dependent on the list of Asins you provide in the Asins
32
+ # parameter. If you specify Sku, the information in the response will be dependent on the list of Skus you
33
+ # provide in the Skus parameter.
34
+ # @param item_condition [String] Filters the offer listings based on item condition. Possible values: New, Used,
35
+ # Collectible, Refurbished, Club.
36
+ # @param offer_type [String] Indicates whether to request pricing information for the seller's B2C or B2B offers.
37
+ # Default is B2C.
38
+ # @param rate_limit [Float] Requests per second
39
+ # @return [Hash] The API response
40
+ def get_pricing(marketplace_id, item_type, asins: nil, skus: nil, item_condition: nil, offer_type: nil,
41
+ rate_limit: 0.5)
42
+ path = "/products/pricing/v0/price"
43
+ params = {
44
+ "MarketplaceId" => marketplace_id,
45
+ "Asins" => asins,
46
+ "Skus" => skus,
47
+ "ItemType" => item_type,
48
+ "ItemCondition" => item_condition,
49
+ "OfferType" => offer_type,
50
+ }.compact
51
+
52
+ meter(rate_limit).get(path, params:)
53
+ end
54
+
55
+ # Returns competitive pricing information for a seller's offer listings based on seller SKU or ASIN. **Note:** The
56
+ # parameters associated with this operation may contain special characters that require URL encoding to call the
57
+ # API. To avoid errors with SKUs when encoding URLs, refer to [URL
58
+ # Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
59
+ #
60
+ # @note This operation can make a static sandbox call.
61
+ # @param marketplace_id [String] A marketplace identifier. Specifies the marketplace for which prices are
62
+ # returned.
63
+ # @param asins [Array<String>] A list of up to twenty Amazon Standard Identification Number (ASIN) values used to
64
+ # identify items in the given marketplace.
65
+ # @param skus [Array<String>] A list of up to twenty seller SKU values used to identify items in the given
66
+ # marketplace.
67
+ # @param item_type [String] Indicates whether ASIN values or seller SKU values are used to identify items. If you
68
+ # specify Asin, the information in the response will be dependent on the list of Asins you provide in the Asins
69
+ # parameter. If you specify Sku, the information in the response will be dependent on the list of Skus you
70
+ # provide in the Skus parameter. Possible values: Asin, Sku.
71
+ # @param customer_type [String] Indicates whether to request pricing information from the point of view of
72
+ # Consumer or Business buyers. Default is Consumer.
73
+ # @param rate_limit [Float] Requests per second
74
+ # @return [Hash] The API response
75
+ def get_competitive_pricing(marketplace_id, item_type, asins: nil, skus: nil, customer_type: nil, rate_limit: 0.5)
76
+ path = "/products/pricing/v0/competitivePrice"
77
+ params = {
78
+ "MarketplaceId" => marketplace_id,
79
+ "Asins" => asins,
80
+ "Skus" => skus,
81
+ "ItemType" => item_type,
82
+ "CustomerType" => customer_type,
83
+ }.compact
84
+
85
+ meter(rate_limit).get(path, params:)
86
+ end
87
+
88
+ # Returns the lowest priced offers for a single SKU listing. **Note:** The parameters associated with this
89
+ # operation may contain special characters that require URL encoding to call the API. To avoid errors with SKUs
90
+ # when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
91
+ #
92
+ # @note This operation can make a static sandbox call.
93
+ # @param marketplace_id [String] A marketplace identifier. Specifies the marketplace for which prices are
94
+ # returned.
95
+ # @param item_condition [String] Filters the offer listings based on item condition. Possible values: New, Used,
96
+ # Collectible, Refurbished, Club.
97
+ # @param seller_sku [String] Identifies an item in the given marketplace. SellerSKU is qualified by the seller's
98
+ # SellerId, which is included with every operation that you submit.
99
+ # @param customer_type [String] Indicates whether to request Consumer or Business offers. Default is Consumer.
100
+ # @param rate_limit [Float] Requests per second
101
+ # @return [Hash] The API response
102
+ def get_listing_offers(marketplace_id, item_condition, seller_sku, customer_type: nil, rate_limit: 1.0)
103
+ path = "/products/pricing/v0/listings/#{seller_sku}/offers"
104
+ params = {
105
+ "MarketplaceId" => marketplace_id,
106
+ "ItemCondition" => item_condition,
107
+ "CustomerType" => customer_type,
108
+ }.compact
109
+
110
+ meter(rate_limit).get(path, params:)
111
+ end
112
+
113
+ # Returns the lowest priced offers for a single item based on ASIN.
114
+ #
115
+ # @note This operation can make a static sandbox call.
116
+ # @param marketplace_id [String] A marketplace identifier. Specifies the marketplace for which prices are
117
+ # returned.
118
+ # @param item_condition [String] Filters the offer listings to be considered based on item condition. Possible
119
+ # values: New, Used, Collectible, Refurbished, Club.
120
+ # @param asin [String] The Amazon Standard Identification Number (ASIN) of the item.
121
+ # @param customer_type [String] Indicates whether to request Consumer or Business offers. Default is Consumer.
122
+ # @param rate_limit [Float] Requests per second
123
+ # @return [Hash] The API response
124
+ def get_item_offers(marketplace_id, item_condition, asin, customer_type: nil, rate_limit: 0.5)
125
+ path = "/products/pricing/v0/items/#{asin}/offers"
126
+ params = {
127
+ "MarketplaceId" => marketplace_id,
128
+ "ItemCondition" => item_condition,
129
+ "CustomerType" => customer_type,
130
+ }.compact
131
+
132
+ meter(rate_limit).get(path, params:)
133
+ end
134
+
135
+ # Returns the lowest priced offers for a batch of items based on ASIN.
136
+ #
137
+ # @note This operation can make a static sandbox call.
138
+ # @param get_item_offers_batch_request_body [Hash]
139
+ # @param rate_limit [Float] Requests per second
140
+ # @return [Hash] The API response
141
+ def get_item_offers_batch(get_item_offers_batch_request_body, rate_limit: 0.1)
142
+ path = "/batches/products/pricing/v0/itemOffers"
143
+ body = get_item_offers_batch_request_body
144
+
145
+ meter(rate_limit).post(path, body:)
146
+ end
147
+
148
+ # Returns the lowest priced offers for a batch of listings by SKU.
149
+ #
150
+ # @note This operation can make a static sandbox call.
151
+ # @param get_listing_offers_batch_request_body [Hash]
152
+ # @param rate_limit [Float] Requests per second
153
+ # @return [Hash] The API response
154
+ def get_listing_offers_batch(get_listing_offers_batch_request_body, rate_limit: 0.5)
155
+ path = "/batches/products/pricing/v0/listingOffers"
156
+ body = get_listing_offers_batch_request_body
157
+
158
+ meter(rate_limit).post(path, body:)
159
+ end
160
+ end
161
+ end
162
+ end
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def product_type_definitions_2020_09_01(...)
8
+ API::ProductTypeDefinitions20200901.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Product Type Definitions
14
+ #
15
+ # The Selling Partner API for Product Type Definitions provides programmatic access to attribute and data
16
+ # requirements for product types in the Amazon catalog. Use this API to return the JSON Schema for a product type
17
+ # that you can then use with other Selling Partner APIs, such as the Selling Partner API for Listings Items, the
18
+ # Selling Partner API for Catalog Items, and the Selling Partner API for Feeds (for JSON-based listing feeds). For
19
+ # more information, see the {https://developer-docs.amazon.com/sp-api/docs/product-type-api-use-case-guide Product
20
+ # Type Definitions API Use Case Guide}.
21
+ class ProductTypeDefinitions20200901 < API
22
+ # Search for and return a list of Amazon product types that have definitions available.
23
+ #
24
+ # @note This operation can make a static sandbox call.
25
+ # @param keywords [Array<String>] A comma-delimited list of keywords to search product types. **Note:** Cannot be
26
+ # used with `itemName`.
27
+ # @param marketplace_ids [Array<String>] A comma-delimited list of Amazon marketplace identifiers for the request.
28
+ # @param item_name [String] The title of the ASIN to get the product type recommendation. **Note:** Cannot be used
29
+ # with `keywords`.
30
+ # @param locale [String] The locale for the display names in the response. Defaults to the primary locale of the
31
+ # marketplace.
32
+ # @param search_locale [String] The locale used for the `keywords` and `itemName` parameters. Defaults to the
33
+ # primary locale of the marketplace.
34
+ # @param rate_limit [Float] Requests per second
35
+ # @return [Hash] The API response
36
+ def search_definitions_product_types(marketplace_ids, keywords: nil, item_name: nil, locale: nil,
37
+ search_locale: nil, rate_limit: 5.0)
38
+ path = "/definitions/2020-09-01/productTypes"
39
+ params = {
40
+ "keywords" => keywords,
41
+ "marketplaceIds" => marketplace_ids,
42
+ "itemName" => item_name,
43
+ "locale" => locale,
44
+ "searchLocale" => search_locale,
45
+ }.compact
46
+
47
+ meter(rate_limit).get(path, params:)
48
+ end
49
+
50
+ # Retrieve an Amazon product type definition.
51
+ #
52
+ # @note This operation can make a static sandbox call.
53
+ # @param product_type [String] The Amazon product type name.
54
+ # @param seller_id [String] A selling partner identifier. When provided, seller-specific requirements and values
55
+ # are populated within the product type definition schema, such as brand names associated with the selling
56
+ # partner.
57
+ # @param marketplace_ids [Array<String>] A comma-delimited list of Amazon marketplace identifiers for the request.
58
+ # Note: This parameter is limited to one marketplaceId at this time.
59
+ # @param product_type_version [String] The version of the Amazon product type to retrieve. Defaults to "LATEST",.
60
+ # Prerelease versions of product type definitions may be retrieved with "RELEASE_CANDIDATE". If no prerelease
61
+ # version is currently available, the "LATEST" live version will be provided.
62
+ # @param requirements [String] The name of the requirements set to retrieve requirements for.
63
+ # @param requirements_enforced [String] Identifies if the required attributes for a requirements set are enforced
64
+ # by the product type definition schema. Non-enforced requirements enable structural validation of individual
65
+ # attributes without all the required attributes being present (such as for partial updates).
66
+ # @param locale [String] Locale for retrieving display labels and other presentation details. Defaults to the
67
+ # default language of the first marketplace in the request.
68
+ # @param rate_limit [Float] Requests per second
69
+ # @return [Hash] The API response
70
+ def get_definitions_product_type(product_type, marketplace_ids, seller_id: nil, product_type_version: "LATEST",
71
+ requirements: "LISTING", requirements_enforced: "ENFORCED", locale: "DEFAULT", rate_limit: 5.0)
72
+ path = "/definitions/2020-09-01/productTypes/#{product_type}"
73
+ params = {
74
+ "sellerId" => seller_id,
75
+ "marketplaceIds" => marketplace_ids,
76
+ "productTypeVersion" => product_type_version,
77
+ "requirements" => requirements,
78
+ "requirementsEnforced" => requirements_enforced,
79
+ "locale" => locale,
80
+ }.compact
81
+
82
+ meter(rate_limit).get(path, params:)
83
+ end
84
+ end
85
+ end
86
+ end