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