peddler 4.1.1 → 4.3.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 +116 -296
- data/lib/peddler/api.rb +3 -2
- data/lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rb +119 -2
- data/lib/peddler/apis/aplus_content_2020_11_01.rb +59 -49
- data/lib/peddler/apis/catalog_items_2022_04_01.rb +34 -33
- data/lib/peddler/apis/catalog_items_v0.rb +0 -62
- data/lib/peddler/apis/easy_ship_2022_03_23.rb +19 -18
- data/lib/peddler/apis/feeds_2021_06_30.rb +1 -1
- data/lib/peddler/apis/finances_2024_06_01.rb +53 -0
- data/lib/peddler/apis/finances_2024_06_19.rb +14 -17
- data/lib/peddler/apis/fulfillment_inbound_2024_03_20.rb +10 -5
- data/lib/peddler/apis/fulfillment_inbound_v0.rb +2 -170
- data/lib/peddler/apis/listings_items_2021_08_01.rb +77 -5
- data/lib/peddler/apis/messaging_v1.rb +50 -49
- data/lib/peddler/apis/orders_v0.rb +1 -1
- data/lib/peddler/apis/product_pricing_v0.rb +3 -2
- data/lib/peddler/apis/reports_2021_06_30.rb +1 -1
- data/lib/peddler/apis/seller_wallet_2024_03_01.rb +195 -0
- data/lib/peddler/apis/sellers_v1.rb +1 -1
- data/lib/peddler/apis/shipping_v1.rb +12 -12
- data/lib/peddler/apis/shipping_v2.rb +46 -20
- data/lib/peddler/apis/uploads_2020_11_01.rb +9 -8
- data/lib/peddler/apis/vehicles_2024_11_01.rb +40 -0
- data/lib/peddler/apis/vendor_direct_fulfillment_shipping_2021_12_28.rb +40 -27
- data/lib/peddler/apis/vendor_invoices_v1.rb +1 -1
- data/lib/peddler/apis/vendor_shipments_v1.rb +40 -1
- data/lib/peddler/error.rb +11 -1
- data/lib/peddler/parsers/openapi_parser_generator.rb +550 -0
- data/lib/peddler/parsers/smart_parser.rb +199 -0
- data/lib/peddler/token.rb +12 -12
- data/lib/peddler/version.rb +1 -1
- data/lib/peddler.rb +3 -0
- metadata +8 -8
- data/lib/peddler/json_feed_document.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7620ee0df092e73b0a78eb5e3f9ddd702f8e14bc4a45e782038d85bf0491ce0b
|
4
|
+
data.tar.gz: dc2db93f53918ee36d6cc047e516b1cab57563dd29194daf0f93b3c3565fef8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 928416379dff494fd6fcd87a538a75db8e4a0c6ef3badfeeb9d37da7b4fac118b9fb287e3f30f24bfc7167af784f490ee0054f81c4f65e9a551649598e64c3f0
|
7
|
+
data.tar.gz: 8159e422fb43f6543dbb6541d26f95e51faa89e40bf831a62b872497ad57e66cbb0036c83d4a9a5b1e588d8eb44c360833fe7b3a5a5aeee1db5bad35a792608f
|
data/README.md
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
# Peddler
|
2
2
|
|
3
3
|
[][build]
|
4
|
-
[][maintainability]
|
5
|
-
[][test-coverage]
|
6
|
-
|
7
|
-
> **_NOTE:_** This README explains the main branch, which may contain unreleased code. For the README of the latest release, please refer to [this link][latest-release-readme].
|
8
4
|
|
9
5
|
**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.
|
10
6
|
|
@@ -72,7 +68,7 @@ access_token = Peddler::Token.request(
|
|
72
68
|
).parse["access_token"]
|
73
69
|
```
|
74
70
|
|
75
|
-
If you haven
|
71
|
+
If you haven't set your LWA credentials as environment variables, pass them directly when requesting the token.
|
76
72
|
|
77
73
|
```ruby
|
78
74
|
access_token = Peddler::Token.request(
|
@@ -102,13 +98,11 @@ end
|
|
102
98
|
|
103
99
|
### Rate limiting
|
104
100
|
|
105
|
-
Amazon
|
106
|
-
|
107
|
-
You can also provide an optional `:retries` argument when initializing an API to specify the number of retries if throttled. By default, this is set to 0, meaning no retries will be attempted. If set to a positive value, Peddler will retry the request that many times if throttled, backing off based on the specified rate limit.
|
101
|
+
Amazon's SP-API imposes [rate limits][rate-limits] on operations. Override the default rate limit by passing a `:rate_limit` parameter when calling an operation.
|
108
102
|
|
109
|
-
|
103
|
+
Provide an optional `:retries` argument when initializing an API to specify retry attempts if throttled. Default is 0 (no retries). If set to a positive value, Peddler will retry with exponential backoff based on the rate limit.
|
110
104
|
|
111
|
-
|
105
|
+
**Note:** This functionality requires version 6 of the [HTTP library][httprb], which is not yet released. To use rate limiting, point to their main branch on GitHub.
|
112
106
|
|
113
107
|
```ruby
|
114
108
|
api = Peddler.orders_v0(aws_region, access_token, retries: 3)
|
@@ -118,171 +112,144 @@ api.get_orders(
|
|
118
112
|
)
|
119
113
|
```
|
120
114
|
|
121
|
-
|
115
|
+
### Available APIs
|
122
116
|
|
123
|
-
|
117
|
+
Peddler provides Ruby interfaces to all Amazon SP-API endpoints. Each API is available in its respective version. Access APIs by calling methods on the Peddler module:
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
api = Peddler.<api_name>_<version>(aws_region, access_token, options)
|
121
|
+
```
|
124
122
|
|
125
|
-
|
123
|
+
Below are key APIs with examples of their usage:
|
126
124
|
|
127
|
-
####
|
125
|
+
#### Orders API (v0)
|
128
126
|
|
129
|
-
|
127
|
+
Retrieve order information and manage orders.
|
130
128
|
|
131
129
|
```ruby
|
132
|
-
api = Peddler.
|
133
|
-
response = api.
|
130
|
+
api = Peddler.orders_v0(aws_region, access_token)
|
131
|
+
response = api.get_orders(
|
134
132
|
marketplaceIds: ["ATVPDKIKX0DER"],
|
135
|
-
|
133
|
+
createdAfter: "2023-01-01T00:00:00Z"
|
136
134
|
)
|
137
|
-
|
135
|
+
orders = response.parse["orders"]
|
138
136
|
```
|
139
137
|
|
140
|
-
####
|
138
|
+
#### Catalog Items API (2022-04-01, 2020-12-01, v0)
|
141
139
|
|
142
|
-
|
140
|
+
Access Amazon's catalog data including product details, offers, and competitive pricing.
|
143
141
|
|
144
142
|
```ruby
|
145
|
-
api = Peddler.
|
146
|
-
response = api.
|
143
|
+
api = Peddler.catalog_items_2022_04_01(aws_region, access_token)
|
144
|
+
response = api.get_catalog_item(
|
147
145
|
marketplaceIds: ["ATVPDKIKX0DER"],
|
148
|
-
|
146
|
+
asin: "B08N5WRWNW"
|
149
147
|
)
|
150
|
-
response.
|
148
|
+
item_details = response.parse["payload"]
|
151
149
|
```
|
152
150
|
|
153
151
|
#### Feeds API (2021-06-30)
|
154
152
|
|
155
|
-
|
153
|
+
Upload data to Amazon to update listings, prices, inventory, and more.
|
156
154
|
|
157
155
|
```ruby
|
158
156
|
api = Peddler.feeds_2021_06_30(aws_region, access_token)
|
159
157
|
|
160
|
-
# Create
|
161
|
-
|
158
|
+
# Create feed document
|
159
|
+
document_response = api.create_feed_document(
|
162
160
|
contentType: "text/xml; charset=UTF-8"
|
163
161
|
)
|
164
|
-
feed_document_id =
|
165
|
-
upload_url =
|
162
|
+
feed_document_id = document_response.parse["feedDocumentId"]
|
163
|
+
upload_url = document_response.parse["url"]
|
166
164
|
|
167
|
-
# Upload
|
165
|
+
# Upload feed content
|
168
166
|
feed_content = File.read("inventory_update.xml")
|
169
167
|
api.upload_feed_document(upload_url, feed_content, "text/xml; charset=UTF-8")
|
170
168
|
|
171
|
-
# Create
|
172
|
-
|
169
|
+
# Create feed
|
170
|
+
feed_response = api.create_feed(
|
173
171
|
feedType: "POST_INVENTORY_AVAILABILITY_DATA",
|
174
172
|
marketplaceIds: ["ATVPDKIKX0DER"],
|
175
173
|
inputFeedDocumentId: feed_document_id
|
176
174
|
)
|
177
|
-
|
175
|
+
feed_id = feed_response.parse["feedId"]
|
178
176
|
```
|
179
177
|
|
180
178
|
#### Reports API (2021-06-30)
|
181
179
|
|
182
|
-
|
180
|
+
Request and download reports about orders, inventory, fulfillment, and more.
|
183
181
|
|
184
182
|
```ruby
|
185
183
|
api = Peddler.reports_2021_06_30(aws_region, access_token)
|
186
|
-
|
184
|
+
|
185
|
+
# Request a report
|
186
|
+
create_response = api.create_report(
|
187
187
|
reportType: "GET_FLAT_FILE_OPEN_LISTINGS_DATA",
|
188
188
|
marketplaceIds: ["ATVPDKIKX0DER"]
|
189
189
|
)
|
190
|
-
|
190
|
+
report_id = create_response.parse["reportId"]
|
191
|
+
|
192
|
+
# Check report status
|
193
|
+
report = api.get_report(report_id).parse
|
194
|
+
|
195
|
+
# Once processed, get the document
|
196
|
+
if report["processingStatus"] == "DONE"
|
197
|
+
doc_id = report["reportDocumentId"]
|
198
|
+
document = api.get_report_document(doc_id).parse
|
199
|
+
download_url = document["url"]
|
200
|
+
# Download report from URL
|
201
|
+
end
|
191
202
|
```
|
192
203
|
|
193
|
-
#### Listings
|
204
|
+
#### Listings APIs
|
205
|
+
|
206
|
+
Manage product listings with multiple APIs:
|
194
207
|
|
195
|
-
|
208
|
+
- **Listings Items API (2021-08-01, 2020-09-01)**: Create and update listings
|
209
|
+
- **Listings Restrictions API (2021-08-01)**: Check listing eligibility
|
210
|
+
- **Product Type Definitions API (2020-09-01)**: Get schema requirements for listings
|
196
211
|
|
197
212
|
```ruby
|
198
213
|
api = Peddler.listings_items_2021_08_01(aws_region, access_token)
|
199
|
-
|
200
|
-
|
214
|
+
api.put_listings_item(
|
215
|
+
seller_id,
|
201
216
|
"SKU123",
|
202
217
|
"ATVPDKIKX0DER",
|
203
218
|
body: {
|
204
|
-
productType: "
|
219
|
+
productType: "LUGGAGE",
|
205
220
|
requirements: "LISTING",
|
206
221
|
attributes: {
|
207
|
-
title: [{ value: "
|
208
|
-
|
209
|
-
bullet_point: [{ value: "Feature 1" }, { value: "Feature 2" }],
|
210
|
-
manufacturer: [{ value: "Your Brand" }]
|
222
|
+
title: [{ value: "Travel Backpack" }],
|
223
|
+
manufacturer: [{ value: "Brand Name" }]
|
211
224
|
}
|
212
225
|
}
|
213
226
|
)
|
214
|
-
response.parse
|
215
227
|
```
|
216
228
|
|
217
|
-
####
|
229
|
+
#### Fulfillment APIs
|
218
230
|
|
219
|
-
|
231
|
+
Manage inventory and fulfillment through FBA and merchant fulfillment:
|
220
232
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
name: "MySQSQueue",
|
226
|
-
resourceSpecification: {
|
227
|
-
sqs: {
|
228
|
-
arn: "arn:aws:sqs:us-east-1:123456789012:MyQueue"
|
229
|
-
}
|
230
|
-
}
|
231
|
-
)
|
232
|
-
destination_id = response.parse["destinationId"]
|
233
|
-
|
234
|
-
# Create a subscription
|
235
|
-
response = api.create_subscription(
|
236
|
-
notificationType: "ANY_OFFER_CHANGED",
|
237
|
-
destinationId: destination_id
|
238
|
-
)
|
239
|
-
subscription = response.parse
|
240
|
-
```
|
241
|
-
|
242
|
-
#### Product Fees API (v0)
|
243
|
-
|
244
|
-
Provides information about fees that may be charged for selling products on Amazon.
|
245
|
-
|
246
|
-
```ruby
|
247
|
-
api = Peddler.product_fees_v0(aws_region, access_token)
|
248
|
-
response = api.get_my_fees_estimate_for_sku(
|
249
|
-
sellerId: "<YOUR_SELLER_ID>",
|
250
|
-
sku: "SKU123",
|
251
|
-
body: {
|
252
|
-
FeesEstimateRequest: {
|
253
|
-
MarketplaceId: "ATVPDKIKX0DER",
|
254
|
-
IsAmazonFulfilled: true,
|
255
|
-
PriceToEstimateFees: {
|
256
|
-
ListingPrice: {
|
257
|
-
CurrencyCode: "USD",
|
258
|
-
Amount: 25.00
|
259
|
-
}
|
260
|
-
}
|
261
|
-
}
|
262
|
-
}
|
263
|
-
)
|
264
|
-
fees_estimate = response.parse
|
265
|
-
```
|
266
|
-
|
267
|
-
#### Fulfillment Outbound API (2020-07-01)
|
268
|
-
|
269
|
-
Allows you to create and manage fulfillment orders using Amazon's fulfillment network.
|
233
|
+
- **Fulfillment Inbound API (2024-03-20, v0)**: Send inventory to FBA
|
234
|
+
- **Fulfillment Outbound API (2020-07-01)**: Create and track FBA orders
|
235
|
+
- **FBA Inventory API (v1)**: Manage FBA inventory quantities
|
236
|
+
- **Merchant Fulfillment API (v0)**: Create shipping labels for self-fulfilled orders
|
270
237
|
|
271
238
|
```ruby
|
239
|
+
# FBA outbound example
|
272
240
|
api = Peddler.fulfillment_outbound_2020_07_01(aws_region, access_token)
|
273
|
-
|
241
|
+
api.create_fulfillment_order(
|
274
242
|
body: {
|
275
243
|
sellerFulfillmentOrderId: "ORDER123",
|
276
244
|
displayableOrderId: "ORDER123",
|
277
245
|
displayableOrderDate: Time.now.iso8601,
|
278
|
-
displayableOrderComment: "Thank you for your order!",
|
279
246
|
shippingSpeedCategory: "Standard",
|
280
247
|
destinationAddress: {
|
281
|
-
name: "
|
248
|
+
name: "Customer Name",
|
282
249
|
addressLine1: "123 Main St",
|
283
|
-
city: "
|
284
|
-
stateOrRegion: "
|
285
|
-
postalCode: "
|
250
|
+
city: "Seattle",
|
251
|
+
stateOrRegion: "WA",
|
252
|
+
postalCode: "98101",
|
286
253
|
countryCode: "US"
|
287
254
|
},
|
288
255
|
items: [
|
@@ -294,228 +261,81 @@ response = api.create_fulfillment_order(
|
|
294
261
|
]
|
295
262
|
}
|
296
263
|
)
|
297
|
-
response.parse
|
298
|
-
```
|
299
|
-
|
300
|
-
#### Merchant Fulfillment API (v0)
|
301
|
-
|
302
|
-
Allows you to create shipping labels for orders using Amazon's negotiated shipping rates.
|
303
|
-
|
304
|
-
```ruby
|
305
|
-
api = Peddler.merchant_fulfillment_v0(aws_region, access_token)
|
306
|
-
response = api.get_eligible_shipping_services(
|
307
|
-
body: {
|
308
|
-
shipmentRequestDetails: {
|
309
|
-
amazonOrderId: "ORDER123",
|
310
|
-
itemList: [
|
311
|
-
{
|
312
|
-
orderItemId: "ITEM123",
|
313
|
-
quantity: 1
|
314
|
-
}
|
315
|
-
],
|
316
|
-
shipFromAddress: {
|
317
|
-
name: "Your Company",
|
318
|
-
addressLine1: "123 Warehouse Ave",
|
319
|
-
city: "Anytown",
|
320
|
-
stateOrRegion: "NY",
|
321
|
-
postalCode: "12345",
|
322
|
-
countryCode: "US"
|
323
|
-
},
|
324
|
-
packageDimensions: {
|
325
|
-
length: 10,
|
326
|
-
width: 5,
|
327
|
-
height: 8,
|
328
|
-
unit: "INCHES"
|
329
|
-
},
|
330
|
-
weight: {
|
331
|
-
value: 2,
|
332
|
-
unit: "POUNDS"
|
333
|
-
},
|
334
|
-
shippingServiceOptions: {
|
335
|
-
deliveryExperience: "DELIVERY_CONFIRMATION_WITHOUT_SIGNATURE",
|
336
|
-
carrierWillPickUp: false
|
337
|
-
}
|
338
|
-
}
|
339
|
-
}
|
340
|
-
)
|
341
|
-
shipping_services = response.parse["shippingServiceList"]
|
342
264
|
```
|
343
265
|
|
344
|
-
####
|
266
|
+
#### Financial APIs (2024-06-19, 2024-06-01, v0)
|
345
267
|
|
346
|
-
|
268
|
+
Get financial data including transaction details, payments, and refunds.
|
347
269
|
|
348
270
|
```ruby
|
349
|
-
api = Peddler.
|
350
|
-
response = api.
|
351
|
-
|
352
|
-
limit: 10,
|
353
|
-
createdAfter: "2023-01-01T00:00:00Z"
|
354
|
-
)
|
355
|
-
purchase_orders = response.parse["purchaseOrders"]
|
356
|
-
```
|
357
|
-
|
358
|
-
#### Vendor Direct Fulfillment Shipping API (2021-12-28)
|
359
|
-
|
360
|
-
Enables vendors to manage shipping labels and shipping information for direct fulfillment orders.
|
361
|
-
|
362
|
-
```ruby
|
363
|
-
api = Peddler.vendor_direct_fulfillment_shipping_2021_12_28(aws_region, access_token)
|
364
|
-
response = api.get_packing_slip(
|
365
|
-
purchaseOrderNumber: "PO123456789"
|
366
|
-
)
|
367
|
-
response.parse
|
368
|
-
```
|
369
|
-
|
370
|
-
#### Vendor Direct Fulfillment Orders API (2021-12-28)
|
371
|
-
|
372
|
-
Allows vendors to receive orders for direct fulfillment and provide shipment confirmations.
|
373
|
-
|
374
|
-
```ruby
|
375
|
-
api = Peddler.vendor_direct_fulfillment_orders_2021_12_28(aws_region, access_token)
|
376
|
-
response = api.get_orders(
|
377
|
-
createdAfter: "2023-01-01T00:00:00Z",
|
378
|
-
limit: 10
|
271
|
+
api = Peddler.finances_v0(aws_region, access_token)
|
272
|
+
response = api.list_financial_events(
|
273
|
+
posted_after: "2023-01-01T00:00:00Z"
|
379
274
|
)
|
380
|
-
response.parse["
|
275
|
+
financial_events = response.parse["FinancialEvents"]
|
381
276
|
```
|
382
277
|
|
383
|
-
####
|
278
|
+
#### Notifications API (v1)
|
384
279
|
|
385
|
-
|
280
|
+
Subscribe to notifications for various events like order updates and report processing.
|
386
281
|
|
387
282
|
```ruby
|
388
|
-
api = Peddler.
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
partyId: "<PARTY_ID>"
|
395
|
-
},
|
396
|
-
warehouseId: "<WAREHOUSE_ID>",
|
397
|
-
items: [
|
398
|
-
{
|
399
|
-
buyerProductIdentifier: "B08N5WRWNW",
|
400
|
-
availableQuantity: {
|
401
|
-
amount: 100,
|
402
|
-
unitOfMeasure: "Each"
|
403
|
-
}
|
404
|
-
}
|
405
|
-
]
|
406
|
-
}
|
407
|
-
]
|
283
|
+
api = Peddler.notifications_v1(aws_region, access_token)
|
284
|
+
# Create destination
|
285
|
+
destination = api.create_destination(
|
286
|
+
name: "MyEventQueue",
|
287
|
+
resourceSpecification: {
|
288
|
+
sqs: { arn: "arn:aws:sqs:us-east-1:123456789012:MyQueue" }
|
408
289
|
}
|
409
290
|
)
|
410
|
-
|
411
|
-
```
|
412
|
-
|
413
|
-
#### Shipping API (v2)
|
291
|
+
destination_id = destination.parse["payload"]["destinationId"]
|
414
292
|
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
body: {
|
421
|
-
clientReferenceId: "CLIENT_REF_123",
|
422
|
-
shipTo: {
|
423
|
-
name: "John Doe",
|
424
|
-
addressLine1: "123 Main St",
|
425
|
-
city: "Anytown",
|
426
|
-
stateOrRegion: "NY",
|
427
|
-
postalCode: "12345",
|
428
|
-
countryCode: "US"
|
429
|
-
},
|
430
|
-
shipFrom: {
|
431
|
-
name: "Your Company",
|
432
|
-
addressLine1: "123 Warehouse Ave",
|
433
|
-
city: "Anytown",
|
434
|
-
stateOrRegion: "NY",
|
435
|
-
postalCode: "12345",
|
436
|
-
countryCode: "US"
|
437
|
-
},
|
438
|
-
packages: [
|
439
|
-
{
|
440
|
-
dimensions: {
|
441
|
-
length: 10,
|
442
|
-
width: 5,
|
443
|
-
height: 8,
|
444
|
-
unit: "IN"
|
445
|
-
},
|
446
|
-
weight: {
|
447
|
-
value: 2,
|
448
|
-
unit: "LB"
|
449
|
-
}
|
450
|
-
}
|
451
|
-
],
|
452
|
-
serviceType: "Standard"
|
453
|
-
}
|
293
|
+
# Create subscription
|
294
|
+
api.create_subscription(
|
295
|
+
notificationType: "ANY_OFFER_CHANGED",
|
296
|
+
destinationId: destination_id,
|
297
|
+
payloadVersion: "1"
|
454
298
|
)
|
455
|
-
response.parse
|
456
299
|
```
|
457
300
|
|
458
|
-
####
|
459
|
-
|
460
|
-
Allows you to create restricted data tokens to access personally identifiable information (PII) in specific API calls.
|
461
|
-
|
462
|
-
```ruby
|
463
|
-
api = Peddler.tokens_2021_03_01(aws_region, access_token)
|
464
|
-
response = api.create_restricted_data_token(
|
465
|
-
body: {
|
466
|
-
restrictedResources: [
|
467
|
-
{
|
468
|
-
method: "GET",
|
469
|
-
path: "/orders/v0/orders/123-1234567-1234567",
|
470
|
-
dataElements: ["buyerInfo", "shippingAddress"]
|
471
|
-
}
|
472
|
-
]
|
473
|
-
}
|
474
|
-
)
|
475
|
-
restricted_data_token = response.parse["restrictedDataToken"]
|
476
|
-
|
477
|
-
# Use the token in subsequent API calls
|
478
|
-
orders_api = Peddler.orders_2021_12_01("<AWS_REGION>", restricted_data_token)
|
479
|
-
response = orders_api.get_order(
|
480
|
-
orderId: "123-1234567-1234567"
|
481
|
-
)
|
482
|
-
response.parse
|
483
|
-
```
|
301
|
+
#### Vendor APIs
|
484
302
|
|
485
|
-
|
303
|
+
APIs for vendors selling to Amazon:
|
486
304
|
|
487
|
-
|
305
|
+
- **Vendor Orders API (v1)**: Retrieve purchase orders
|
306
|
+
- **Vendor Direct Fulfillment APIs**: Manage orders, shipping, payments, and inventory
|
307
|
+
- **Vendor Shipments API (v1)**: Track vendor shipments
|
308
|
+
- **Vendor Invoices API (v1)**: Submit and track invoices
|
488
309
|
|
489
310
|
```ruby
|
490
|
-
api = Peddler.
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
)
|
495
|
-
response.parse
|
311
|
+
api = Peddler.vendor_orders_v1(aws_region, access_token)
|
312
|
+
orders = api.get_purchase_orders(
|
313
|
+
limit: 10,
|
314
|
+
createdAfter: "2023-01-01T00:00:00Z"
|
315
|
+
).parse
|
496
316
|
```
|
497
317
|
|
498
|
-
####
|
318
|
+
#### Additional APIs
|
499
319
|
|
500
|
-
|
320
|
+
- **A+ Content API (2020-11-01)**: Create and manage enhanced marketing content
|
321
|
+
- **Authorization API (2023-11-30)**: Manage app authorization
|
322
|
+
- **Messaging API (v1)**: Send messages to customers
|
323
|
+
- **Product Fees API (v0)**: Retrieve fee estimates for products
|
324
|
+
- **Product Pricing API (2022-05-01, v0)**: Get pricing information
|
325
|
+
- **Sellers API (v1)**: Get seller account information and marketplace participation
|
326
|
+
- **Shipping APIs (v1, v2)**: Create shipments and purchase shipping labels
|
327
|
+
- **Solicitations API (v1)**: Request customer reviews
|
328
|
+
- **Tokens API (2021-03-01)**: Generate restricted data tokens for accessing PII
|
329
|
+
- **Uploads API (2020-11-01)**: Upload files for various SP-API operations
|
501
330
|
|
502
|
-
|
503
|
-
api = Peddler.sellers_v1(aws_region, access_token)
|
504
|
-
response = api.get_marketplace_participations
|
505
|
-
response.parse
|
506
|
-
```
|
331
|
+
For a complete list of available APIs, refer to the [API models repository](https://github.com/amzn/selling-partner-api-models).
|
507
332
|
|
508
333
|
## TODO
|
509
334
|
|
510
|
-
- [ ] Code generate payload parsers
|
511
|
-
- [ ]
|
512
|
-
- [ ] Schedule code generation with GitHub Actions. Push new gem when models change.
|
513
|
-
- [ ] Review and consider applying [these patches][patches].
|
335
|
+
- [ ] Code generate payload parsers
|
336
|
+
- [ ] Review and consider applying [these patches][patches]
|
514
337
|
|
515
338
|
[build]: https://github.com/hakanensari/peddler/actions
|
516
|
-
[maintainability]: https://codeclimate.com/github/hakanensari/peddler/maintainability
|
517
|
-
[test-coverage]: https://codeclimate.com/github/hakanensari/peddler/test_coverage
|
518
|
-
[latest-release-readme]: https://github.com/lineofflight/peddler/tree/v3.0.0
|
519
339
|
[docs-overview]: https://developer.amazonservices.com/sp-api-docs/overview
|
520
340
|
[register-as-developer]: https://developer-docs.amazon.com/sp-api/docs/registering-as-a-developer
|
521
341
|
[register-application]: https://developer-docs.amazon.com/sp-api/docs/registering-your-application
|
data/lib/peddler/api.rb
CHANGED
@@ -30,8 +30,9 @@ module Peddler
|
|
30
30
|
# @return [Integer]
|
31
31
|
attr_reader :retries
|
32
32
|
|
33
|
-
# @param [String] aws_region
|
34
|
-
# @param [String] access_token
|
33
|
+
# @param [String] aws_region The AWS region to use for the endpoint
|
34
|
+
# @param [String] access_token The access token for authentication
|
35
|
+
# @param [Integer] retries The number of retries if throttled (default: 0)
|
35
36
|
def initialize(aws_region, access_token, retries: 0)
|
36
37
|
@endpoint = Endpoint.find(aws_region)
|
37
38
|
@access_token = access_token
|