peddler 3.0.0.beta1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18b989739aa0f7ab2781e4f2f921b61a6f188ffc72145eb9308e47d3f5072e96
|
4
|
+
data.tar.gz: 0ea9798e14b2e7474fef0c8b492d43e90d427fee962d4f837fc46722750733b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9acfcab4a74ef4842c1cb28e94b1a57591caba5080e07a6db34d8f20f69b0d215efdcfb98761fefeaf840cb4a0c91cc574807651c8beb309dbfc91ad66502b05
|
7
|
+
data.tar.gz: 281d96aa87b0ea0c480282049124c8ed3037e4a31ef8251b7a6cc3e8c17acbb53e8253a41f248a6e3a95eea7c6d3363d740e0d23dffe2b6e1caaf82bbbdbea09
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
**Peddler** is a Ruby interface to the [Amazon Selling Partner API (SP-API)][docs-overview]. The SP-API enables Amazon sellers and vendors to programmatically access their data on orders, shipments, payments, and more.
|
8
8
|
|
9
|
-
To begin using the Amazon SP-API, you must [register as a developer][register-as-developer] and [register your application][register-application]. Once registered, [obtain your Login with Amazon (LWA) credentials
|
9
|
+
To begin using the Amazon SP-API, you must [register as a developer][register-as-developer] and [register your application][register-application]. Once registered, [obtain your Login with Amazon (LWA) credentials][view-credentials] to access your own or other selling partners' data.
|
10
10
|
|
11
11
|

|
12
12
|
|
@@ -39,53 +39,65 @@ Require the library.
|
|
39
39
|
require "peddler"
|
40
40
|
```
|
41
41
|
|
42
|
-
###
|
42
|
+
### Authorization
|
43
43
|
|
44
|
-
A seller or vendor
|
44
|
+
A seller or vendor [provides you a refresh token][authorization] to access their data on Amazon.
|
45
45
|
|
46
46
|
```ruby
|
47
|
-
|
47
|
+
refresh_token = Peddled::Token.request(
|
48
|
+
code: "<AUTHORIZATION_CODE>"
|
49
|
+
).parse["refresh_token"]
|
50
|
+
```
|
51
|
+
|
52
|
+
You use this to generate a temporary access token to authenticate individual API requests.
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
access_token = Peddler::Token.request(
|
48
56
|
refresh_token: "<REFRESH_TOKEN>",
|
49
|
-
)
|
57
|
+
).parse["access_token"]
|
50
58
|
```
|
51
59
|
|
52
|
-
|
60
|
+
Similarly, you can request a token for grantless operations.
|
53
61
|
|
54
62
|
```ruby
|
55
|
-
access_token = Peddler::
|
63
|
+
access_token = Peddler::Token.request(
|
56
64
|
scope: "sellingpartnerapi::notifications",
|
57
|
-
)
|
65
|
+
).parse["access_token"]
|
58
66
|
```
|
59
67
|
|
60
|
-
|
61
|
-
|
62
|
-
If you haven’t set your LWA credentials as environment variables, you can pass them directly when requesting an access token:
|
68
|
+
If you haven’t set your LWA credentials as environment variables, pass them directly when requesting the token.
|
63
69
|
|
64
70
|
```ruby
|
65
|
-
access_token = Peddler::
|
71
|
+
access_token = Peddler::Token.request(
|
66
72
|
client_id: "<YOUR_CLIENT_ID>",
|
67
73
|
client_secret: "<YOUR_CLIENT_SECRET>",
|
68
74
|
refresh_token: "<REFRESH_TOKEN>",
|
69
|
-
)
|
75
|
+
).parse["access_token"]
|
70
76
|
```
|
71
77
|
|
72
|
-
|
78
|
+
Access tokens are valid for one hour. To optimize performance, cache the token and reuse across calls.
|
73
79
|
|
74
|
-
|
75
|
-
|
76
|
-
**Note:** This functionality requires version 6 of the underlying [HTTP library][httprb]. As of writing, this is not released yet. To use rate limiting, point to the main branch of their GitHub repo:
|
80
|
+
In Rails, if you're storing a refresh token in a model representing a selling partner, implement a method there to retrieve and cache access tokens:
|
77
81
|
|
78
82
|
```ruby
|
79
|
-
|
83
|
+
class Seller
|
84
|
+
"..."
|
85
|
+
|
86
|
+
def access_token
|
87
|
+
Rails.cache.fetch("#{cache_key}/access_key", expires_in: 1.hour) do
|
88
|
+
Peddler::Token.request(
|
89
|
+
refresh_token:,
|
90
|
+
).parse["access_token"]
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
80
94
|
```
|
81
95
|
|
82
|
-
|
96
|
+
### Rate limiting
|
83
97
|
|
84
|
-
|
85
|
-
@api.rate_limit(5).get_item_offers_batch(...)
|
86
|
-
```
|
98
|
+
Amazon’s Selling Partner API (SP-API) imposes [rate limits][rate-limits] on most operations. Peddler respects these limits and automatically backs off when throttled. To override the default rate limit, pass a `:rate_limit` argument when running an operation.
|
87
99
|
|
88
|
-
This
|
100
|
+
**Note:** This functionality requires version 6 of the underlying [HTTP library][httprb]. As of writing, this is not released yet. To use rate limiting, point to their main branch on GitHub.
|
89
101
|
|
90
102
|
### The APIs
|
91
103
|
|
@@ -95,11 +107,9 @@ Peddler provides a class for each API version under an eponymous namespace. Belo
|
|
95
107
|
|
96
108
|
Provides programmatic access to Amazon's catalog data, such as item titles, descriptions, and other product details.
|
97
109
|
|
98
|
-
**Example:**
|
99
|
-
|
100
110
|
```ruby
|
101
|
-
|
102
|
-
response =
|
111
|
+
api = Peddler.catalog_items_2022_04_01(aws_region, access_token)
|
112
|
+
response = api.get_catalog_item(
|
103
113
|
marketplaceIds: ["ATVPDKIKX0DER"],
|
104
114
|
asin: "B08N5WRWNW"
|
105
115
|
)
|
@@ -110,27 +120,24 @@ items = response.parse.dig("items")
|
|
110
120
|
|
111
121
|
Allows you to retrieve order information, including order details, buyer information, and order items.
|
112
122
|
|
113
|
-
**Example:**
|
114
|
-
|
115
123
|
```ruby
|
116
|
-
|
117
|
-
response =
|
124
|
+
api = Peddler.orders_v0(aws_region, access_token)
|
125
|
+
response = api.get_orders(
|
118
126
|
marketplaceIds: ["ATVPDKIKX0DER"],
|
119
127
|
createdAfter: "2023-01-01T00:00:00Z"
|
120
128
|
)
|
121
|
-
|
129
|
+
response.parse.dig("orders")
|
122
130
|
```
|
123
131
|
|
124
132
|
#### Feeds API (2021-06-30)
|
125
133
|
|
126
134
|
Enables you to upload data to Amazon for updating listings, prices, inventory, and more.
|
127
135
|
|
128
|
-
**Example:**
|
129
|
-
|
130
136
|
```ruby
|
131
|
-
|
137
|
+
api = Peddler.feeds_2021_06_30(aws_region, access_token)
|
138
|
+
|
132
139
|
# Create a feed document to get an upload URL
|
133
|
-
response =
|
140
|
+
response = api.create_feed_document(
|
134
141
|
contentType: "text/xml; charset=UTF-8"
|
135
142
|
)
|
136
143
|
feed_document_id = response.parse["feedDocumentId"]
|
@@ -138,41 +145,37 @@ upload_url = response.parse["url"]
|
|
138
145
|
|
139
146
|
# Upload the feed content to the provided URL
|
140
147
|
feed_content = File.read("inventory_update.xml")
|
141
|
-
|
148
|
+
api.upload_feed_document(upload_url, feed_content)
|
142
149
|
|
143
150
|
# Create the feed
|
144
|
-
response =
|
151
|
+
response = api.create_feed(
|
145
152
|
feedType: "POST_INVENTORY_AVAILABILITY_DATA",
|
146
153
|
marketplaceIds: ["ATVPDKIKX0DER"],
|
147
154
|
inputFeedDocumentId: feed_document_id
|
148
155
|
)
|
149
|
-
|
156
|
+
response.parse["feedId"]
|
150
157
|
```
|
151
158
|
|
152
159
|
#### Reports API (2021-06-30)
|
153
160
|
|
154
161
|
Allows you to request and download various reports, such as order and inventory reports.
|
155
162
|
|
156
|
-
**Example:**
|
157
|
-
|
158
163
|
```ruby
|
159
|
-
|
160
|
-
response =
|
164
|
+
api = Peddler.reports_2021_06_30(aws_region, access_token)
|
165
|
+
response = api.create_report(
|
161
166
|
reportType: "GET_FLAT_FILE_OPEN_LISTINGS_DATA",
|
162
167
|
marketplaceIds: ["ATVPDKIKX0DER"]
|
163
168
|
)
|
164
|
-
|
169
|
+
response.parse["reportId"]
|
165
170
|
```
|
166
171
|
|
167
172
|
#### Listings Items API (2021-08-01)
|
168
173
|
|
169
174
|
Enables you to manage your product listings on Amazon, including creating, updating, and deleting listings.
|
170
175
|
|
171
|
-
**Example:**
|
172
|
-
|
173
176
|
```ruby
|
174
|
-
|
175
|
-
response =
|
177
|
+
api = Peddler.listings_items_2021_08_01(aws_region, access_token)
|
178
|
+
response = api.put_listings_item(
|
176
179
|
"<SELLER_ID>",
|
177
180
|
"SKU123",
|
178
181
|
"ATVPDKIKX0DER",
|
@@ -187,19 +190,17 @@ response = client.put_listings_item(
|
|
187
190
|
}
|
188
191
|
}
|
189
192
|
)
|
190
|
-
|
193
|
+
response.parse
|
191
194
|
```
|
192
195
|
|
193
196
|
#### Notifications API (v1)
|
194
197
|
|
195
198
|
Allows you to subscribe to notifications for specific events like order status updates or feed processing statuses.
|
196
199
|
|
197
|
-
**Example:**
|
198
|
-
|
199
200
|
```ruby
|
200
|
-
|
201
|
+
api = Peddler.notifications_v1(aws_region, access_token)
|
201
202
|
# Create a destination
|
202
|
-
response =
|
203
|
+
response = api.create_destination(
|
203
204
|
name: "MySQSQueue",
|
204
205
|
resourceSpecification: {
|
205
206
|
sqs: {
|
@@ -210,7 +211,7 @@ response = client.create_destination(
|
|
210
211
|
destination_id = response.parse["destinationId"]
|
211
212
|
|
212
213
|
# Create a subscription
|
213
|
-
response =
|
214
|
+
response = api.create_subscription(
|
214
215
|
notificationType: "ANY_OFFER_CHANGED",
|
215
216
|
destinationId: destination_id
|
216
217
|
)
|
@@ -221,11 +222,9 @@ subscription = response.parse
|
|
221
222
|
|
222
223
|
Provides information about fees that may be charged for selling products on Amazon.
|
223
224
|
|
224
|
-
**Example:**
|
225
|
-
|
226
225
|
```ruby
|
227
|
-
|
228
|
-
response =
|
226
|
+
api = Peddler.product_fees_v0(aws_region, access_token)
|
227
|
+
response = api.get_my_fees_estimate_for_sku(
|
229
228
|
sellerId: "<YOUR_SELLER_ID>",
|
230
229
|
sku: "SKU123",
|
231
230
|
body: {
|
@@ -248,11 +247,9 @@ fees_estimate = response.parse
|
|
248
247
|
|
249
248
|
Allows you to create and manage fulfillment orders using Amazon's fulfillment network.
|
250
249
|
|
251
|
-
**Example:**
|
252
|
-
|
253
250
|
```ruby
|
254
|
-
|
255
|
-
response =
|
251
|
+
api = Peddler.fulfillment_outbound_2020_07_01(aws_region, access_token)
|
252
|
+
response = api.create_fulfillment_order(
|
256
253
|
body: {
|
257
254
|
sellerFulfillmentOrderId: "ORDER123",
|
258
255
|
displayableOrderId: "ORDER123",
|
@@ -276,18 +273,16 @@ response = client.create_fulfillment_order(
|
|
276
273
|
]
|
277
274
|
}
|
278
275
|
)
|
279
|
-
|
276
|
+
response.parse
|
280
277
|
```
|
281
278
|
|
282
279
|
#### Merchant Fulfillment API (v0)
|
283
280
|
|
284
281
|
Allows you to create shipping labels for orders using Amazon's negotiated shipping rates.
|
285
282
|
|
286
|
-
**Example:**
|
287
|
-
|
288
283
|
```ruby
|
289
|
-
|
290
|
-
response =
|
284
|
+
api = Peddler.merchant_fulfillment_v0(aws_region, access_token)
|
285
|
+
response = api.get_eligible_shipping_services(
|
291
286
|
body: {
|
292
287
|
shipmentRequestDetails: {
|
293
288
|
amazonOrderId: "ORDER123",
|
@@ -329,11 +324,9 @@ shipping_services = response.parse["shippingServiceList"]
|
|
329
324
|
|
330
325
|
Allows vendors to retrieve purchase orders and order details from Amazon.
|
331
326
|
|
332
|
-
**Example:**
|
333
|
-
|
334
327
|
```ruby
|
335
|
-
|
336
|
-
response =
|
328
|
+
api = Peddler.vendor_orders_2021_12_28(aws_region, access_token)
|
329
|
+
response = api.get_purchase_orders(
|
337
330
|
shipToPartyId: "<PARTY_ID>",
|
338
331
|
limit: 10,
|
339
332
|
createdAfter: "2023-01-01T00:00:00Z"
|
@@ -345,40 +338,36 @@ purchase_orders = response.parse["purchaseOrders"]
|
|
345
338
|
|
346
339
|
Enables vendors to manage shipping labels and shipping information for direct fulfillment orders.
|
347
340
|
|
348
|
-
**Example:**
|
349
341
|
|
350
342
|
```ruby
|
351
|
-
|
352
|
-
response =
|
343
|
+
api = Peddler.vendor_direct_fulfillment_shipping_2021_12_28(aws_region, access_token)
|
344
|
+
response = api.get_packing_slip(
|
353
345
|
purchaseOrderNumber: "PO123456789"
|
354
346
|
)
|
355
|
-
|
347
|
+
response.parse
|
356
348
|
```
|
357
349
|
|
358
350
|
#### Vendor Direct Fulfillment Orders API (2021-12-28)
|
359
351
|
|
360
352
|
Allows vendors to receive orders for direct fulfillment and provide shipment confirmations.
|
361
353
|
|
362
|
-
**Example:**
|
363
354
|
|
364
355
|
```ruby
|
365
|
-
|
366
|
-
response =
|
356
|
+
api = Peddler.vendor_direct_fulfillment_orders_2021_12_28(aws_region, access_token)
|
357
|
+
response = api.get_orders(
|
367
358
|
createdAfter: "2023-01-01T00:00:00Z",
|
368
359
|
limit: 10
|
369
360
|
)
|
370
|
-
|
361
|
+
response.parse["orders"]
|
371
362
|
```
|
372
363
|
|
373
364
|
#### Vendor Direct Fulfillment Inventory API (2021-12-28)
|
374
365
|
|
375
366
|
Enables vendors to update inventory levels for direct fulfillment items.
|
376
367
|
|
377
|
-
**Example:**
|
378
|
-
|
379
368
|
```ruby
|
380
|
-
|
381
|
-
response =
|
369
|
+
api = Peddler.vendor_direct_fulfillment_inventory_2021_12_28(aws_region, access_token)
|
370
|
+
response = api.submit_inventory_update(
|
382
371
|
body: {
|
383
372
|
inventory: [
|
384
373
|
{
|
@@ -399,18 +388,16 @@ response = client.submit_inventory_update(
|
|
399
388
|
]
|
400
389
|
}
|
401
390
|
)
|
402
|
-
|
391
|
+
response.parse
|
403
392
|
```
|
404
393
|
|
405
394
|
#### Shipping API (v2)
|
406
395
|
|
407
396
|
Provides functionalities for purchasing shipping labels and tracking shipments.
|
408
397
|
|
409
|
-
**Example:**
|
410
|
-
|
411
398
|
```ruby
|
412
|
-
|
413
|
-
response =
|
399
|
+
api = Peddler.shipping_v2(aws_region, access_token)
|
400
|
+
response = api.purchase_shipment(
|
414
401
|
body: {
|
415
402
|
clientReferenceId: "CLIENT_REF_123",
|
416
403
|
shipTo: {
|
@@ -446,18 +433,16 @@ response = client.purchase_shipment(
|
|
446
433
|
serviceType: "Standard"
|
447
434
|
}
|
448
435
|
)
|
449
|
-
|
436
|
+
response.parse
|
450
437
|
```
|
451
438
|
|
452
439
|
#### Token API (2021-03-01)
|
453
440
|
|
454
441
|
Allows you to create restricted data tokens to access personally identifiable information (PII) in specific API calls.
|
455
442
|
|
456
|
-
**Example:**
|
457
|
-
|
458
443
|
```ruby
|
459
|
-
|
460
|
-
response =
|
444
|
+
api = Peddler.tokens_2021_03_01(aws_region, access_token)
|
445
|
+
response = api.create_restricted_data_token(
|
461
446
|
body: {
|
462
447
|
restrictedResources: [
|
463
448
|
{
|
@@ -471,40 +456,43 @@ response = client.create_restricted_data_token(
|
|
471
456
|
restricted_data_token = response.parse["restrictedDataToken"]
|
472
457
|
|
473
458
|
# Use the token in subsequent API calls
|
474
|
-
|
475
|
-
response =
|
459
|
+
orders_api = Peddler.orders_2021_12_01("<AWS_REGION>", restricted_data_token)
|
460
|
+
response = orders_api.get_order(
|
476
461
|
orderId: "123-1234567-1234567"
|
477
462
|
)
|
478
|
-
|
463
|
+
response.parse
|
479
464
|
```
|
480
465
|
|
481
466
|
#### Finances API (v0)
|
482
467
|
|
483
468
|
Provides information about financial events for your seller account, such as order payments, refunds, and fees.
|
484
469
|
|
485
|
-
**Example:**
|
486
|
-
|
487
470
|
```ruby
|
488
|
-
|
489
|
-
response =
|
471
|
+
api = Peddler.finances_v0(aws_region, access_token)
|
472
|
+
response = api.list_financial_events(
|
490
473
|
postedAfter: "2023-01-01T00:00:00Z",
|
491
474
|
maxResultsPerPage: 100
|
492
475
|
)
|
493
|
-
|
476
|
+
response.parse
|
494
477
|
```
|
495
478
|
|
496
479
|
#### Sellers API (V1)
|
497
480
|
|
498
481
|
Provides information about seller's marketplaces and participation status.
|
499
482
|
|
500
|
-
**Example:**
|
501
|
-
|
502
483
|
```ruby
|
503
|
-
|
504
|
-
response =
|
505
|
-
|
484
|
+
api = Peddler.sellers_v1(aws_region, access_token)
|
485
|
+
response = api.get_marketplace_participations
|
486
|
+
response.parse
|
506
487
|
```
|
507
488
|
|
489
|
+
## TODO
|
490
|
+
|
491
|
+
- Code generate models to parse payload. Consider using `dry-struct`.
|
492
|
+
- Code generate the APIs section—descriptions and code examples—in this README here.
|
493
|
+
- Schedule code generation with GitHub Actions. Push new gem when models change.
|
494
|
+
- Review and consider applying [these patches][patches].
|
495
|
+
|
508
496
|
[build]: https://github.com/hakanensari/peddler/actions
|
509
497
|
[maintainability]: https://codeclimate.com/github/hakanensari/peddler/maintainability
|
510
498
|
[test-coverage]: https://codeclimate.com/github/hakanensari/peddler/test_coverage
|
@@ -513,4 +501,6 @@ participations = response.parse["payload"]
|
|
513
501
|
[register-application]: https://developer-docs.amazon.com/sp-api/docs/registering-your-application
|
514
502
|
[view-credentials]: https://developer-docs.amazon.com/sp-api/docs/viewing-your-application-information-and-credentials
|
515
503
|
[authorization]: https://developer-docs.amazon.com/sp-api/docs/authorizing-selling-partner-api-applications
|
504
|
+
[rate-limits]: https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits
|
516
505
|
[httprb]: https://github.com/httprb/http
|
506
|
+
[patches]: https://github.com/bizon/selling-partner-api-sdk/tree/master/codegen/patches
|
@@ -3,6 +3,12 @@
|
|
3
3
|
require "peddler/api"
|
4
4
|
|
5
5
|
module Peddler
|
6
|
+
class << self
|
7
|
+
def amazon_warehousing_and_distribution_2024_05_09(...)
|
8
|
+
API::AmazonWarehousingAndDistribution20240509.new(...)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
6
12
|
class API
|
7
13
|
# The Selling Partner API for Amazon Warehousing and Distribution
|
8
14
|
#
|
@@ -11,35 +17,39 @@ module Peddler
|
|
11
17
|
class AmazonWarehousingAndDistribution20240509 < API
|
12
18
|
# Retrieves an AWD inbound shipment.
|
13
19
|
#
|
14
|
-
# @
|
15
|
-
# @param [String]
|
20
|
+
# @note This operation can make a static sandbox call.
|
21
|
+
# @param shipment_id [String] ID for the shipment. A shipment contains the cases being inbounded.
|
22
|
+
# @param sku_quantities [String] If equal to `SHOW`, the response includes the shipment SKU quantity details.
|
16
23
|
# Defaults to `HIDE`, in which case the response does not contain SKU quantities
|
24
|
+
# @param rate_limit [Float] Requests per second
|
17
25
|
# @return [Hash] The API response
|
18
|
-
def get_inbound_shipment(shipment_id, sku_quantities: nil)
|
26
|
+
def get_inbound_shipment(shipment_id, sku_quantities: nil, rate_limit: 2.0)
|
19
27
|
path = "/awd/2024-05-09/inboundShipments/#{shipment_id}"
|
20
28
|
params = {
|
21
29
|
"skuQuantities" => sku_quantities,
|
22
30
|
}.compact
|
23
31
|
|
24
|
-
rate_limit
|
32
|
+
meter(rate_limit).get(path, params:)
|
25
33
|
end
|
26
34
|
|
27
35
|
# Retrieves a summary of all the inbound AWD shipments associated with a merchant, with the ability to apply
|
28
36
|
# optional filters.
|
29
37
|
#
|
30
|
-
# @
|
31
|
-
# @param [String]
|
38
|
+
# @note This operation can make a static sandbox call.
|
39
|
+
# @param sort_by [String] Field to sort results by. By default, the response will be sorted by UPDATED_AT.
|
40
|
+
# @param sort_order [String] Sort the response in ASCENDING or DESCENDING order. By default, the response will be
|
32
41
|
# sorted in DESCENDING order.
|
33
|
-
# @param [String]
|
34
|
-
# @param [String]
|
35
|
-
# date must be in
|
36
|
-
# @param [String]
|
37
|
-
# The date must be in
|
38
|
-
# @param [Integer]
|
39
|
-
# @param [String]
|
42
|
+
# @param shipment_status [String] Filter by inbound shipment status.
|
43
|
+
# @param updated_after [String] List the inbound shipments that were updated after a certain time (inclusive). The
|
44
|
+
# date must be in {https://developer-docs.amazon.com/sp-api/docs/iso-8601 ISO 8601} format.
|
45
|
+
# @param updated_before [String] List the inbound shipments that were updated before a certain time (inclusive).
|
46
|
+
# The date must be in {https://developer-docs.amazon.com/sp-api/docs/iso-8601 ISO 8601} format.
|
47
|
+
# @param max_results [Integer] Maximum number of results to return.
|
48
|
+
# @param next_token [String] Token to retrieve the next set of paginated results.
|
49
|
+
# @param rate_limit [Float] Requests per second
|
40
50
|
# @return [Hash] The API response
|
41
51
|
def list_inbound_shipments(sort_by: nil, sort_order: nil, shipment_status: nil, updated_after: nil,
|
42
|
-
updated_before: nil, max_results:
|
52
|
+
updated_before: nil, max_results: 25, next_token: nil, rate_limit: 1.0)
|
43
53
|
path = "/awd/2024-05-09/inboundShipments"
|
44
54
|
params = {
|
45
55
|
"sortBy" => sort_by,
|
@@ -51,19 +61,21 @@ module Peddler
|
|
51
61
|
"nextToken" => next_token,
|
52
62
|
}.compact
|
53
63
|
|
54
|
-
rate_limit
|
64
|
+
meter(rate_limit).get(path, params:)
|
55
65
|
end
|
56
66
|
|
57
67
|
# Lists AWD inventory associated with a merchant with the ability to apply optional filters.
|
58
68
|
#
|
59
|
-
# @
|
60
|
-
# @param [String]
|
61
|
-
# @param [String]
|
69
|
+
# @note This operation can make a static sandbox call.
|
70
|
+
# @param sku [String] Filter by seller or merchant SKU for the item.
|
71
|
+
# @param sort_order [String] Sort the response in `ASCENDING` or `DESCENDING` order.
|
72
|
+
# @param details [String] Set to `SHOW` to return summaries with additional inventory details. Defaults to `HIDE,`
|
62
73
|
# which returns only inventory summary totals.
|
63
|
-
# @param [String]
|
64
|
-
# @param [Integer]
|
74
|
+
# @param next_token [String] Token to retrieve the next set of paginated results.
|
75
|
+
# @param max_results [Integer] Maximum number of results to return.
|
76
|
+
# @param rate_limit [Float] Requests per second
|
65
77
|
# @return [Hash] The API response
|
66
|
-
def list_inventory(sku: nil, sort_order: nil, details: nil, next_token: nil, max_results:
|
78
|
+
def list_inventory(sku: nil, sort_order: nil, details: nil, next_token: nil, max_results: 25, rate_limit: 2.0)
|
67
79
|
path = "/awd/2024-05-09/inventory"
|
68
80
|
params = {
|
69
81
|
"sku" => sku,
|
@@ -73,7 +85,7 @@ module Peddler
|
|
73
85
|
"maxResults" => max_results,
|
74
86
|
}.compact
|
75
87
|
|
76
|
-
rate_limit
|
88
|
+
meter(rate_limit).get(path, params:)
|
77
89
|
end
|
78
90
|
end
|
79
91
|
end
|