peddler 3.0.0.beta1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +96 -106
- data/lib/peddler/api/amazon_warehousing_and_distribution_2024_05_09.rb +34 -22
- data/lib/peddler/api/aplus_content_2020_11_01.rb +86 -48
- data/lib/peddler/api/application_integrations_2024_04_01.rb +56 -0
- data/lib/peddler/api/application_management_2023_11_30.rb +12 -2
- data/lib/peddler/api/catalog_items_2020_12_01.rb +31 -20
- data/lib/peddler/api/catalog_items_2022_04_01.rb +35 -25
- data/lib/peddler/api/catalog_items_v0.rb +39 -26
- data/lib/peddler/api/data_kiosk_2023_11_15.rb +41 -25
- data/lib/peddler/api/easy_ship_2022_03_23.rb +62 -43
- data/lib/peddler/api/fba_inbound_eligibility_v1.rb +13 -5
- data/lib/peddler/api/fba_inventory_v1.rb +40 -24
- data/lib/peddler/api/feeds_2021_06_30.rb +43 -25
- data/lib/peddler/api/finances_2024_06_19.rb +50 -0
- data/lib/peddler/api/finances_v0.rb +86 -59
- data/lib/peddler/api/fulfillment_inbound_2024_03_20.rb +304 -205
- data/lib/peddler/api/fulfillment_inbound_v0.rb +112 -74
- data/lib/peddler/api/fulfillment_outbound_2020_07_01.rb +90 -53
- data/lib/peddler/api/invoices_2024_06_19.rb +180 -0
- data/lib/peddler/api/listings_items_2020_09_01.rb +44 -33
- data/lib/peddler/api/listings_items_2021_08_01.rb +76 -60
- data/lib/peddler/api/listings_restrictions_2021_08_01.rb +19 -9
- data/lib/peddler/api/merchant_fulfillment_v0.rb +31 -15
- data/lib/peddler/api/messaging_v1.rb +93 -61
- data/lib/peddler/api/notifications_v1.rb +54 -23
- data/lib/peddler/api/orders_v0.rb +87 -72
- data/lib/peddler/api/product_fees_v0.rb +39 -31
- data/lib/peddler/api/product_pricing_2022_05_01.rb +17 -6
- data/lib/peddler/api/product_pricing_v0.rb +63 -45
- data/lib/peddler/api/product_type_definitions_2020_09_01.rb +29 -18
- data/lib/peddler/api/replenishment_2022_11_07.rb +21 -9
- data/lib/peddler/api/reports_2021_06_30.rb +60 -36
- data/lib/peddler/api/sales_v1.rb +20 -12
- data/lib/peddler/api/sellers_v1.rb +16 -4
- data/lib/peddler/api/services_v1.rb +138 -98
- data/lib/peddler/api/shipment_invoicing_v0.rb +25 -12
- data/lib/peddler/api/shipping_v1.rb +54 -29
- data/lib/peddler/api/shipping_v2.rb +132 -80
- data/lib/peddler/api/solicitations_v1.rb +18 -8
- data/lib/peddler/api/supply_sources_2020_07_01.rb +33 -15
- data/lib/peddler/api/tokens_2021_03_01.rb +13 -5
- data/lib/peddler/api/uploads_2020_11_01.rb +16 -6
- data/lib/peddler/api/vendor_direct_fulfillment_inventory_v1.rb +12 -4
- data/lib/peddler/api/vendor_direct_fulfillment_orders_2021_12_28.rb +29 -17
- data/lib/peddler/api/vendor_direct_fulfillment_orders_v1.rb +29 -17
- data/lib/peddler/api/vendor_direct_fulfillment_payments_v1.rb +11 -3
- data/lib/peddler/api/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +14 -4
- data/lib/peddler/api/vendor_direct_fulfillment_shipping_2021_12_28.rb +74 -48
- data/lib/peddler/api/vendor_direct_fulfillment_shipping_v1.rb +74 -50
- data/lib/peddler/api/vendor_direct_fulfillment_transactions_2021_12_28.rb +11 -3
- data/lib/peddler/api/vendor_direct_fulfillment_transactions_v1.rb +11 -3
- data/lib/peddler/api/vendor_invoices_v1.rb +11 -3
- data/lib/peddler/api/vendor_orders_v1.rb +54 -43
- data/lib/peddler/api/vendor_shipments_v1.rb +63 -51
- data/lib/peddler/api/vendor_transaction_status_v1.rb +12 -3
- data/lib/peddler/api.rb +41 -18
- data/lib/peddler/endpoint.rb +51 -0
- data/lib/peddler/error.rb +1 -0
- data/lib/peddler/marketplace.rb +49 -0
- data/lib/peddler/token.rb +70 -0
- data/lib/peddler/version.rb +1 -1
- data/lib/peddler.rb +56 -52
- metadata +10 -6
- data/lib/peddler/access_token.rb +0 -76
- data/lib/peddler/region.rb +0 -30
@@ -3,6 +3,12 @@
|
|
3
3
|
require "peddler/api"
|
4
4
|
|
5
5
|
module Peddler
|
6
|
+
class << self
|
7
|
+
def orders_v0(...)
|
8
|
+
API::OrdersV0.new(...)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
6
12
|
class API
|
7
13
|
# Selling Partner API for Orders
|
8
14
|
#
|
@@ -16,29 +22,30 @@ module Peddler
|
|
16
22
|
# types of orders, you can apply filters to your request. `NextToken` doesn't affect any filters that you include
|
17
23
|
# in your request; it only impacts the pagination for the filtered orders response.
|
18
24
|
#
|
19
|
-
# @
|
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
|
20
27
|
# placed after the specified time are returned. The date must be in [ISO
|
21
28
|
# 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. **Note**: Either the `CreatedAfter`
|
22
29
|
# parameter or the `LastUpdatedAfter` parameter is required. Both cannot be empty. `LastUpdatedAfter` and
|
23
30
|
# `LastUpdatedBefore` cannot be set when `CreatedAfter` is set.
|
24
|
-
# @param [String]
|
31
|
+
# @param created_before [String] Use this date to select orders created before (or at) a specified time. Only
|
25
32
|
# orders placed before the specified time are returned. The date must be in [ISO
|
26
33
|
# 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. **Note**: `CreatedBefore` is optional
|
27
34
|
# when `CreatedAfter` is set. If specified, `CreatedBefore` must be equal to or after the `CreatedAfter` date
|
28
35
|
# and at least two minutes before current time.
|
29
|
-
# @param [String]
|
36
|
+
# @param last_updated_after [String] Use this date to select orders that were last updated after (or at) a
|
30
37
|
# specified time. An update is defined as any change in order status, including the creation of a new order.
|
31
38
|
# Includes updates made by Amazon and by the seller. The date must be in [ISO
|
32
39
|
# 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. **Note**: Either the `CreatedAfter`
|
33
40
|
# parameter or the `LastUpdatedAfter` parameter is required. Both cannot be empty. `CreatedAfter` or
|
34
41
|
# `CreatedBefore` cannot be set when `LastUpdatedAfter` is set.
|
35
|
-
# @param [String]
|
42
|
+
# @param last_updated_before [String] Use this date to select orders that were last updated before (or at) a
|
36
43
|
# specified time. An update is defined as any change in order status, including the creation of a new order.
|
37
44
|
# Includes updates made by Amazon and by the seller. The date must be in [ISO
|
38
45
|
# 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format. **Note**: `LastUpdatedBefore` is
|
39
46
|
# optional when `LastUpdatedAfter` is set. But if specified, `LastUpdatedBefore` must be equal to or after the
|
40
47
|
# `LastUpdatedAfter` date and at least two minutes before current time.
|
41
|
-
# @param [Array<String>]
|
48
|
+
# @param order_statuses [Array<String>] A list of `OrderStatus` values used to filter the results. **Possible
|
42
49
|
# values:** - `PendingAvailability` (This status is available for pre-orders only. The order has been placed,
|
43
50
|
# payment has not been authorized, and the release date of the item is in the future.) - `Pending` (The order
|
44
51
|
# has been placed but payment has not been authorized.) - `Unshipped` (Payment has been authorized and the order
|
@@ -47,23 +54,23 @@ module Peddler
|
|
47
54
|
# `InvoiceUnconfirmed` (All items in the order have been shipped. The seller has not yet given confirmation to
|
48
55
|
# Amazon that the invoice has been shipped to the buyer.) - `Canceled` (The order has been canceled.) -
|
49
56
|
# `Unfulfillable` (The order cannot be fulfilled. This state applies only to Multi-Channel Fulfillment orders.)
|
50
|
-
# @param [Array<String>]
|
57
|
+
# @param marketplace_ids [Array<String>] A list of `MarketplaceId` values. Used to select orders that were placed
|
51
58
|
# in the specified marketplaces. Refer to [Marketplace
|
52
59
|
# IDs](https://developer-docs.amazon.com/sp-api/docs/marketplace-ids) for a complete list of `marketplaceId`
|
53
60
|
# values.
|
54
|
-
# @param [Array<String>]
|
61
|
+
# @param fulfillment_channels [Array<String>] A list that indicates how an order was fulfilled. Filters the
|
55
62
|
# results by fulfillment channel. **Possible values**: `AFN` (fulfilled by Amazon), `MFN` (fulfilled by seller).
|
56
|
-
# @param [Array<String>]
|
63
|
+
# @param payment_methods [Array<String>] A list of payment method values. Use this field to select orders that
|
57
64
|
# were paid with the specified payment methods. **Possible values**: `COD` (cash on delivery), `CVS`
|
58
65
|
# (convenience store), `Other` (Any payment method other than COD or CVS).
|
59
|
-
# @param [String]
|
66
|
+
# @param buyer_email [String] The email address of a buyer. Used to select orders that contain the specified email
|
60
67
|
# address.
|
61
|
-
# @param [String]
|
68
|
+
# @param seller_order_id [String] An order identifier that is specified by the seller. Used to select only the
|
62
69
|
# orders that match the order identifier. If `SellerOrderId` is specified, then `FulfillmentChannels`,
|
63
70
|
# `OrderStatuses`, `PaymentMethod`, `LastUpdatedAfter`, LastUpdatedBefore, and `BuyerEmail` cannot be specified.
|
64
|
-
# @param [Integer]
|
71
|
+
# @param max_results_per_page [Integer] A number that indicates the maximum number of orders that can be returned
|
65
72
|
# per page. Value must be 1 - 100. Default 100.
|
66
|
-
# @param [Array<String>]
|
73
|
+
# @param easy_ship_shipment_statuses [Array<String>] A list of `EasyShipShipmentStatus` values. Used to select
|
67
74
|
# Easy Ship orders with statuses that match the specified values. If `EasyShipShipmentStatus` is specified, only
|
68
75
|
# Amazon Easy Ship orders are returned. **Possible values:** - `PendingSchedule` (The package is awaiting the
|
69
76
|
# schedule for pick-up.) - `PendingPickUp` (Amazon has not yet picked up the package from the seller.) -
|
@@ -76,41 +83,41 @@ module Peddler
|
|
76
83
|
# seller.) - `ReturnedToSeller` (The package was not delivered and was returned to the seller.) - `Lost` (The
|
77
84
|
# package is lost.) - `OutForDelivery` (The package is out for delivery.) - `Damaged` (The package was damaged
|
78
85
|
# by the carrier.)
|
79
|
-
# @param [Array<String>]
|
86
|
+
# @param electronic_invoice_statuses [Array<String>] A list of `ElectronicInvoiceStatus` values. Used to select
|
80
87
|
# orders with electronic invoice statuses that match the specified values. **Possible values:** - `NotRequired`
|
81
88
|
# (Electronic invoice submission is not required for this order.) - `NotFound` (The electronic invoice was not
|
82
89
|
# submitted for this order.) - `Processing` (The electronic invoice is being processed for this order.) -
|
83
90
|
# `Errored` (The last submitted electronic invoice was rejected for this order.) - `Accepted` (The last
|
84
91
|
# submitted electronic invoice was submitted and accepted.)
|
85
|
-
# @param [String]
|
86
|
-
# @param [Array<String>]
|
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
|
87
94
|
# Amazon-defined order identifier, in 3-7-7 format.
|
88
|
-
# @param [String]
|
95
|
+
# @param actual_fulfillment_supply_source_id [String] The `sourceId` of the location from where you want the order
|
89
96
|
# fulfilled.
|
90
|
-
# @param [Boolean]
|
91
|
-
# @param [String]
|
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
|
92
99
|
# chain.
|
93
|
-
# @param [String]
|
100
|
+
# @param earliest_delivery_date_before [String] Use this date to select orders with a earliest delivery date
|
94
101
|
# before (or at) a specified time. The date must be in [ISO
|
95
102
|
# 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format.
|
96
|
-
# @param [String]
|
103
|
+
# @param earliest_delivery_date_after [String] Use this date to select orders with a earliest delivery date after
|
97
104
|
# (or at) a specified time. The date must be in [ISO
|
98
105
|
# 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format.
|
99
|
-
# @param [String]
|
106
|
+
# @param latest_delivery_date_before [String] Use this date to select orders with a latest delivery date before
|
100
107
|
# (or at) a specified time. The date must be in [ISO
|
101
108
|
# 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format.
|
102
|
-
# @param [String]
|
109
|
+
# @param latest_delivery_date_after [String] Use this date to select orders with a latest delivery date after (or
|
103
110
|
# at) a specified time. The date must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601)
|
104
111
|
# format.
|
112
|
+
# @param rate_limit [Float] Requests per second
|
105
113
|
# @return [Hash] The API response
|
106
|
-
def get_orders(
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
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,
|
111
119
|
earliest_delivery_date_before: nil, earliest_delivery_date_after: nil, latest_delivery_date_before: nil,
|
112
|
-
latest_delivery_date_after: nil
|
113
|
-
)
|
120
|
+
latest_delivery_date_after: nil, rate_limit: 0.0167)
|
114
121
|
path = "/orders/v0/orders"
|
115
122
|
params = {
|
116
123
|
"CreatedAfter" => created_after,
|
@@ -137,47 +144,43 @@ module Peddler
|
|
137
144
|
"LatestDeliveryDateAfter" => latest_delivery_date_after,
|
138
145
|
}.compact
|
139
146
|
|
140
|
-
rate_limit
|
147
|
+
meter(rate_limit).get(path, params:)
|
141
148
|
end
|
142
149
|
|
143
150
|
# Returns the order that you specify.
|
144
151
|
#
|
145
|
-
# @
|
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
|
146
155
|
# @return [Hash] The API response
|
147
|
-
def get_order(order_id)
|
156
|
+
def get_order(order_id, rate_limit: 0.5)
|
148
157
|
path = "/orders/v0/orders/#{order_id}"
|
149
158
|
|
150
|
-
rate_limit
|
159
|
+
meter(rate_limit).get(path)
|
151
160
|
end
|
152
161
|
|
153
162
|
# Returns buyer information for the order that you specify.
|
154
163
|
#
|
155
|
-
# @
|
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
|
156
167
|
# @return [Hash] The API response
|
157
|
-
def get_order_buyer_info(order_id)
|
168
|
+
def get_order_buyer_info(order_id, rate_limit: 0.5)
|
158
169
|
path = "/orders/v0/orders/#{order_id}/buyerInfo"
|
159
170
|
|
160
|
-
rate_limit
|
171
|
+
meter(rate_limit).get(path)
|
161
172
|
end
|
162
173
|
|
163
174
|
# Returns the shipping address for the order that you specify.
|
164
175
|
#
|
165
|
-
# @
|
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
|
166
179
|
# @return [Hash] The API response
|
167
|
-
def get_order_address(order_id)
|
180
|
+
def get_order_address(order_id, rate_limit: 0.5)
|
168
181
|
path = "/orders/v0/orders/#{order_id}/address"
|
169
182
|
|
170
|
-
rate_limit
|
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)
|
183
|
+
meter(rate_limit).get(path)
|
181
184
|
end
|
182
185
|
|
183
186
|
# Returns detailed order item information for the order that you specify. If `NextToken` is provided, it's used to
|
@@ -188,76 +191,88 @@ module Peddler
|
|
188
191
|
# Shipped, or Shipped state, the getOrderItems operation returns information about pricing, taxes, shipping
|
189
192
|
# charges, gift status and promotions for the order items in the order.
|
190
193
|
#
|
191
|
-
# @
|
192
|
-
# @param [String]
|
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
|
193
198
|
# @return [Hash] The API response
|
194
|
-
def get_order_items(order_id, next_token: nil)
|
199
|
+
def get_order_items(order_id, next_token: nil, rate_limit: 0.5)
|
195
200
|
path = "/orders/v0/orders/#{order_id}/orderItems"
|
196
201
|
params = {
|
197
202
|
"NextToken" => next_token,
|
198
203
|
}.compact
|
199
204
|
|
200
|
-
rate_limit
|
205
|
+
meter(rate_limit).get(path, params:)
|
201
206
|
end
|
202
207
|
|
203
208
|
# Returns buyer information for the order items in the order that you specify.
|
204
209
|
#
|
205
|
-
# @
|
206
|
-
# @param [String]
|
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
|
207
214
|
# @return [Hash] The API response
|
208
|
-
def get_order_items_buyer_info(order_id, next_token: nil)
|
215
|
+
def get_order_items_buyer_info(order_id, next_token: nil, rate_limit: 0.5)
|
209
216
|
path = "/orders/v0/orders/#{order_id}/orderItems/buyerInfo"
|
210
217
|
params = {
|
211
218
|
"NextToken" => next_token,
|
212
219
|
}.compact
|
213
220
|
|
214
|
-
rate_limit
|
221
|
+
meter(rate_limit).get(path, params:)
|
215
222
|
end
|
216
223
|
|
217
224
|
# Update the shipment status for an order that you specify.
|
218
225
|
#
|
219
|
-
# @
|
220
|
-
# @param [
|
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
|
221
230
|
# @return [Hash] The API response
|
222
|
-
def update_shipment_status(order_id, payload)
|
231
|
+
def update_shipment_status(order_id, payload, rate_limit: 5.0)
|
223
232
|
path = "/orders/v0/orders/#{order_id}/shipment"
|
224
233
|
body = payload
|
225
234
|
|
226
|
-
rate_limit
|
235
|
+
meter(rate_limit).post(path, body:)
|
227
236
|
end
|
228
237
|
|
229
238
|
# Returns regulated information for the order that you specify.
|
230
239
|
#
|
231
|
-
# @
|
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
|
232
243
|
# @return [Hash] The API response
|
233
|
-
def get_order_regulated_info(order_id)
|
244
|
+
def get_order_regulated_info(order_id, rate_limit: 0.5)
|
234
245
|
path = "/orders/v0/orders/#{order_id}/regulatedInfo"
|
235
246
|
|
236
|
-
rate_limit
|
247
|
+
meter(rate_limit).get(path)
|
237
248
|
end
|
238
249
|
|
239
250
|
# Updates (approves or rejects) the verification status of an order containing regulated products.
|
240
251
|
#
|
241
|
-
# @
|
242
|
-
# @param [
|
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
|
243
256
|
# @return [Hash] The API response
|
244
|
-
def update_verification_status(order_id, payload)
|
257
|
+
def update_verification_status(order_id, payload, rate_limit: 0.5)
|
245
258
|
path = "/orders/v0/orders/#{order_id}/regulatedInfo"
|
246
259
|
body = payload
|
247
260
|
|
248
|
-
rate_limit
|
261
|
+
meter(rate_limit).patch(path, body:)
|
249
262
|
end
|
250
263
|
|
251
264
|
# Updates the shipment confirmation status for a specified order.
|
252
265
|
#
|
253
|
-
# @
|
254
|
-
# @param [
|
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
|
255
270
|
# @return [Hash] The API response
|
256
|
-
def confirm_shipment(order_id, payload)
|
271
|
+
def confirm_shipment(order_id, payload, rate_limit: 2.0)
|
257
272
|
path = "/orders/v0/orders/#{order_id}/shipmentConfirmation"
|
258
273
|
body = payload
|
259
274
|
|
260
|
-
rate_limit
|
275
|
+
meter(rate_limit).post(path, body:)
|
261
276
|
end
|
262
277
|
end
|
263
278
|
end
|
@@ -3,6 +3,12 @@
|
|
3
3
|
require "peddler/api"
|
4
4
|
|
5
5
|
module Peddler
|
6
|
+
class << self
|
7
|
+
def product_fees_v0(...)
|
8
|
+
API::ProductFeesV0.new(...)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
6
12
|
class API
|
7
13
|
# Selling Partner API for Product Fees
|
8
14
|
#
|
@@ -10,59 +16,61 @@ module Peddler
|
|
10
16
|
# then account for those fees in your pricing.
|
11
17
|
class ProductFeesV0 < API
|
12
18
|
# Returns the estimated fees for the item indicated by the specified seller SKU in the marketplace specified in
|
13
|
-
# the request body.
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
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.
|
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.
|
26
30
|
#
|
27
|
-
# @
|
28
|
-
# @param [
|
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
|
29
34
|
# seller's SellerId, which is included with every operation that you submit.
|
35
|
+
# @param rate_limit [Float] Requests per second
|
30
36
|
# @return [Hash] The API response
|
31
|
-
def get_my_fees_estimate_for_sku(body, seller_sku)
|
37
|
+
def get_my_fees_estimate_for_sku(body, seller_sku, rate_limit: 1.0)
|
32
38
|
path = "/products/fees/v0/listings/#{seller_sku}/feesEstimate"
|
33
39
|
|
34
|
-
rate_limit
|
40
|
+
meter(rate_limit).post(path, body:)
|
35
41
|
end
|
36
42
|
|
37
43
|
# Returns the estimated fees for the item indicated by the specified ASIN in the marketplace specified in the
|
38
44
|
# request body. You can call `getMyFeesEstimateForASIN` for an item on behalf of a selling partner before the
|
39
45
|
# selling partner sets the item's price. The selling partner can then take estimated fees into account. Each fees
|
40
46
|
# 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
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
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.
|
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.
|
48
52
|
#
|
49
|
-
# @
|
50
|
-
# @param [
|
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
|
51
57
|
# @return [Hash] The API response
|
52
|
-
def get_my_fees_estimate_for_asin(body, asin)
|
58
|
+
def get_my_fees_estimate_for_asin(body, asin, rate_limit: 1.0)
|
53
59
|
path = "/products/fees/v0/items/#{asin}/feesEstimate"
|
54
60
|
|
55
|
-
rate_limit
|
61
|
+
meter(rate_limit).post(path, body:)
|
56
62
|
end
|
57
63
|
|
58
64
|
# Returns the estimated fees for a list of products.
|
59
65
|
#
|
60
|
-
# @
|
66
|
+
# @note This operation can make a static sandbox call.
|
67
|
+
# @param body [Hash]
|
68
|
+
# @param rate_limit [Float] Requests per second
|
61
69
|
# @return [Hash] The API response
|
62
|
-
def get_my_fees_estimates(body)
|
70
|
+
def get_my_fees_estimates(body, rate_limit: 0.5)
|
63
71
|
path = "/products/fees/v0/feesEstimate"
|
64
72
|
|
65
|
-
rate_limit
|
73
|
+
meter(rate_limit).post(path, body:)
|
66
74
|
end
|
67
75
|
end
|
68
76
|
end
|
@@ -3,6 +3,12 @@
|
|
3
3
|
require "peddler/api"
|
4
4
|
|
5
5
|
module Peddler
|
6
|
+
class << self
|
7
|
+
def product_pricing_2022_05_01(...)
|
8
|
+
API::ProductPricing20220501.new(...)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
6
12
|
class API
|
7
13
|
# Selling Partner API for Pricing
|
8
14
|
#
|
@@ -17,26 +23,31 @@ module Peddler
|
|
17
23
|
# change, and different offers may be featured based on other factors, including fulfillment capabilities to a
|
18
24
|
# specific customer. The response to an unsuccessful request includes the available error text.
|
19
25
|
#
|
20
|
-
# @
|
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`
|
21
28
|
# requests.
|
29
|
+
# @param rate_limit [Float] Requests per second
|
22
30
|
# @return [Hash] The API response
|
23
|
-
def get_featured_offer_expected_price_batch(get_featured_offer_expected_price_batch_request_body
|
31
|
+
def get_featured_offer_expected_price_batch(get_featured_offer_expected_price_batch_request_body,
|
32
|
+
rate_limit: 0.033)
|
24
33
|
path = "/batches/products/pricing/2022-05-01/offer/featuredOfferExpectedPrice"
|
25
34
|
body = get_featured_offer_expected_price_batch_request_body
|
26
35
|
|
27
|
-
rate_limit
|
36
|
+
meter(rate_limit).post(path, body:)
|
28
37
|
end
|
29
38
|
|
30
39
|
# Returns the competitive summary response including featured buying options for the ASIN and `marketplaceId`
|
31
40
|
# combination.
|
32
41
|
#
|
33
|
-
# @
|
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
|
34
45
|
# @return [Hash] The API response
|
35
|
-
def get_competitive_summary(requests)
|
46
|
+
def get_competitive_summary(requests, rate_limit: 0.033)
|
36
47
|
path = "/batches/products/pricing/2022-05-01/items/competitiveSummary"
|
37
48
|
body = requests
|
38
49
|
|
39
|
-
rate_limit
|
50
|
+
meter(rate_limit).post(path, body:)
|
40
51
|
end
|
41
52
|
end
|
42
53
|
end
|