peddler 4.2.0 → 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 -293
- data/lib/peddler/apis/catalog_items_v0.rb +0 -62
- data/lib/peddler/apis/seller_wallet_2024_03_01.rb +195 -0
- data/lib/peddler/parsers/openapi_parser_generator.rb +550 -0
- data/lib/peddler/parsers/smart_parser.rb +199 -0
- data/lib/peddler/version.rb +1 -1
- data/lib/peddler.rb +1 -0
- metadata +6 -3
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,8 +1,6 @@
|
|
1
1
|
# Peddler
|
2
2
|
|
3
3
|
[][build]
|
4
|
-
[][maintainability]
|
5
|
-
[][test-coverage]
|
6
4
|
|
7
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.
|
8
6
|
|
@@ -70,7 +68,7 @@ access_token = Peddler::Token.request(
|
|
70
68
|
).parse["access_token"]
|
71
69
|
```
|
72
70
|
|
73
|
-
If you haven
|
71
|
+
If you haven't set your LWA credentials as environment variables, pass them directly when requesting the token.
|
74
72
|
|
75
73
|
```ruby
|
76
74
|
access_token = Peddler::Token.request(
|
@@ -100,13 +98,11 @@ end
|
|
100
98
|
|
101
99
|
### Rate limiting
|
102
100
|
|
103
|
-
Amazon
|
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.
|
104
102
|
|
105
|
-
|
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.
|
106
104
|
|
107
|
-
**Note:** This functionality requires version 6 of the
|
108
|
-
|
109
|
-
Example usage:
|
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.
|
110
106
|
|
111
107
|
```ruby
|
112
108
|
api = Peddler.orders_v0(aws_region, access_token, retries: 3)
|
@@ -116,171 +112,144 @@ api.get_orders(
|
|
116
112
|
)
|
117
113
|
```
|
118
114
|
|
119
|
-
|
115
|
+
### Available APIs
|
116
|
+
|
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:
|
120
118
|
|
121
|
-
|
119
|
+
```ruby
|
120
|
+
api = Peddler.<api_name>_<version>(aws_region, access_token, options)
|
121
|
+
```
|
122
122
|
|
123
|
-
|
123
|
+
Below are key APIs with examples of their usage:
|
124
124
|
|
125
|
-
####
|
125
|
+
#### Orders API (v0)
|
126
126
|
|
127
|
-
|
127
|
+
Retrieve order information and manage orders.
|
128
128
|
|
129
129
|
```ruby
|
130
|
-
api = Peddler.
|
131
|
-
response = api.
|
130
|
+
api = Peddler.orders_v0(aws_region, access_token)
|
131
|
+
response = api.get_orders(
|
132
132
|
marketplaceIds: ["ATVPDKIKX0DER"],
|
133
|
-
|
133
|
+
createdAfter: "2023-01-01T00:00:00Z"
|
134
134
|
)
|
135
|
-
|
135
|
+
orders = response.parse["orders"]
|
136
136
|
```
|
137
137
|
|
138
|
-
####
|
138
|
+
#### Catalog Items API (2022-04-01, 2020-12-01, v0)
|
139
139
|
|
140
|
-
|
140
|
+
Access Amazon's catalog data including product details, offers, and competitive pricing.
|
141
141
|
|
142
142
|
```ruby
|
143
|
-
api = Peddler.
|
144
|
-
response = api.
|
143
|
+
api = Peddler.catalog_items_2022_04_01(aws_region, access_token)
|
144
|
+
response = api.get_catalog_item(
|
145
145
|
marketplaceIds: ["ATVPDKIKX0DER"],
|
146
|
-
|
146
|
+
asin: "B08N5WRWNW"
|
147
147
|
)
|
148
|
-
response.
|
148
|
+
item_details = response.parse["payload"]
|
149
149
|
```
|
150
150
|
|
151
151
|
#### Feeds API (2021-06-30)
|
152
152
|
|
153
|
-
|
153
|
+
Upload data to Amazon to update listings, prices, inventory, and more.
|
154
154
|
|
155
155
|
```ruby
|
156
156
|
api = Peddler.feeds_2021_06_30(aws_region, access_token)
|
157
157
|
|
158
|
-
# Create
|
159
|
-
|
158
|
+
# Create feed document
|
159
|
+
document_response = api.create_feed_document(
|
160
160
|
contentType: "text/xml; charset=UTF-8"
|
161
161
|
)
|
162
|
-
feed_document_id =
|
163
|
-
upload_url =
|
162
|
+
feed_document_id = document_response.parse["feedDocumentId"]
|
163
|
+
upload_url = document_response.parse["url"]
|
164
164
|
|
165
|
-
# Upload
|
165
|
+
# Upload feed content
|
166
166
|
feed_content = File.read("inventory_update.xml")
|
167
167
|
api.upload_feed_document(upload_url, feed_content, "text/xml; charset=UTF-8")
|
168
168
|
|
169
|
-
# Create
|
170
|
-
|
169
|
+
# Create feed
|
170
|
+
feed_response = api.create_feed(
|
171
171
|
feedType: "POST_INVENTORY_AVAILABILITY_DATA",
|
172
172
|
marketplaceIds: ["ATVPDKIKX0DER"],
|
173
173
|
inputFeedDocumentId: feed_document_id
|
174
174
|
)
|
175
|
-
|
175
|
+
feed_id = feed_response.parse["feedId"]
|
176
176
|
```
|
177
177
|
|
178
178
|
#### Reports API (2021-06-30)
|
179
179
|
|
180
|
-
|
180
|
+
Request and download reports about orders, inventory, fulfillment, and more.
|
181
181
|
|
182
182
|
```ruby
|
183
183
|
api = Peddler.reports_2021_06_30(aws_region, access_token)
|
184
|
-
|
184
|
+
|
185
|
+
# Request a report
|
186
|
+
create_response = api.create_report(
|
185
187
|
reportType: "GET_FLAT_FILE_OPEN_LISTINGS_DATA",
|
186
188
|
marketplaceIds: ["ATVPDKIKX0DER"]
|
187
189
|
)
|
188
|
-
|
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
|
189
202
|
```
|
190
203
|
|
191
|
-
#### Listings
|
204
|
+
#### Listings APIs
|
192
205
|
|
193
|
-
|
206
|
+
Manage product listings with multiple APIs:
|
207
|
+
|
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
|
194
211
|
|
195
212
|
```ruby
|
196
213
|
api = Peddler.listings_items_2021_08_01(aws_region, access_token)
|
197
|
-
|
198
|
-
|
214
|
+
api.put_listings_item(
|
215
|
+
seller_id,
|
199
216
|
"SKU123",
|
200
217
|
"ATVPDKIKX0DER",
|
201
218
|
body: {
|
202
|
-
productType: "
|
219
|
+
productType: "LUGGAGE",
|
203
220
|
requirements: "LISTING",
|
204
221
|
attributes: {
|
205
|
-
title: [{ value: "
|
206
|
-
|
207
|
-
bullet_point: [{ value: "Feature 1" }, { value: "Feature 2" }],
|
208
|
-
manufacturer: [{ value: "Your Brand" }]
|
222
|
+
title: [{ value: "Travel Backpack" }],
|
223
|
+
manufacturer: [{ value: "Brand Name" }]
|
209
224
|
}
|
210
225
|
}
|
211
226
|
)
|
212
|
-
response.parse
|
213
227
|
```
|
214
228
|
|
215
|
-
####
|
229
|
+
#### Fulfillment APIs
|
216
230
|
|
217
|
-
|
231
|
+
Manage inventory and fulfillment through FBA and merchant fulfillment:
|
218
232
|
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
name: "MySQSQueue",
|
224
|
-
resourceSpecification: {
|
225
|
-
sqs: {
|
226
|
-
arn: "arn:aws:sqs:us-east-1:123456789012:MyQueue"
|
227
|
-
}
|
228
|
-
}
|
229
|
-
)
|
230
|
-
destination_id = response.parse["destinationId"]
|
231
|
-
|
232
|
-
# Create a subscription
|
233
|
-
response = api.create_subscription(
|
234
|
-
notificationType: "ANY_OFFER_CHANGED",
|
235
|
-
destinationId: destination_id
|
236
|
-
)
|
237
|
-
subscription = response.parse
|
238
|
-
```
|
239
|
-
|
240
|
-
#### Product Fees API (v0)
|
241
|
-
|
242
|
-
Provides information about fees that may be charged for selling products on Amazon.
|
243
|
-
|
244
|
-
```ruby
|
245
|
-
api = Peddler.product_fees_v0(aws_region, access_token)
|
246
|
-
response = api.get_my_fees_estimate_for_sku(
|
247
|
-
sellerId: "<YOUR_SELLER_ID>",
|
248
|
-
sku: "SKU123",
|
249
|
-
body: {
|
250
|
-
FeesEstimateRequest: {
|
251
|
-
MarketplaceId: "ATVPDKIKX0DER",
|
252
|
-
IsAmazonFulfilled: true,
|
253
|
-
PriceToEstimateFees: {
|
254
|
-
ListingPrice: {
|
255
|
-
CurrencyCode: "USD",
|
256
|
-
Amount: 25.00
|
257
|
-
}
|
258
|
-
}
|
259
|
-
}
|
260
|
-
}
|
261
|
-
)
|
262
|
-
fees_estimate = response.parse
|
263
|
-
```
|
264
|
-
|
265
|
-
#### Fulfillment Outbound API (2020-07-01)
|
266
|
-
|
267
|
-
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
|
268
237
|
|
269
238
|
```ruby
|
239
|
+
# FBA outbound example
|
270
240
|
api = Peddler.fulfillment_outbound_2020_07_01(aws_region, access_token)
|
271
|
-
|
241
|
+
api.create_fulfillment_order(
|
272
242
|
body: {
|
273
243
|
sellerFulfillmentOrderId: "ORDER123",
|
274
244
|
displayableOrderId: "ORDER123",
|
275
245
|
displayableOrderDate: Time.now.iso8601,
|
276
|
-
displayableOrderComment: "Thank you for your order!",
|
277
246
|
shippingSpeedCategory: "Standard",
|
278
247
|
destinationAddress: {
|
279
|
-
name: "
|
248
|
+
name: "Customer Name",
|
280
249
|
addressLine1: "123 Main St",
|
281
|
-
city: "
|
282
|
-
stateOrRegion: "
|
283
|
-
postalCode: "
|
250
|
+
city: "Seattle",
|
251
|
+
stateOrRegion: "WA",
|
252
|
+
postalCode: "98101",
|
284
253
|
countryCode: "US"
|
285
254
|
},
|
286
255
|
items: [
|
@@ -292,227 +261,81 @@ response = api.create_fulfillment_order(
|
|
292
261
|
]
|
293
262
|
}
|
294
263
|
)
|
295
|
-
response.parse
|
296
|
-
```
|
297
|
-
|
298
|
-
#### Merchant Fulfillment API (v0)
|
299
|
-
|
300
|
-
Allows you to create shipping labels for orders using Amazon's negotiated shipping rates.
|
301
|
-
|
302
|
-
```ruby
|
303
|
-
api = Peddler.merchant_fulfillment_v0(aws_region, access_token)
|
304
|
-
response = api.get_eligible_shipping_services(
|
305
|
-
body: {
|
306
|
-
shipmentRequestDetails: {
|
307
|
-
amazonOrderId: "ORDER123",
|
308
|
-
itemList: [
|
309
|
-
{
|
310
|
-
orderItemId: "ITEM123",
|
311
|
-
quantity: 1
|
312
|
-
}
|
313
|
-
],
|
314
|
-
shipFromAddress: {
|
315
|
-
name: "Your Company",
|
316
|
-
addressLine1: "123 Warehouse Ave",
|
317
|
-
city: "Anytown",
|
318
|
-
stateOrRegion: "NY",
|
319
|
-
postalCode: "12345",
|
320
|
-
countryCode: "US"
|
321
|
-
},
|
322
|
-
packageDimensions: {
|
323
|
-
length: 10,
|
324
|
-
width: 5,
|
325
|
-
height: 8,
|
326
|
-
unit: "INCHES"
|
327
|
-
},
|
328
|
-
weight: {
|
329
|
-
value: 2,
|
330
|
-
unit: "POUNDS"
|
331
|
-
},
|
332
|
-
shippingServiceOptions: {
|
333
|
-
deliveryExperience: "DELIVERY_CONFIRMATION_WITHOUT_SIGNATURE",
|
334
|
-
carrierWillPickUp: false
|
335
|
-
}
|
336
|
-
}
|
337
|
-
}
|
338
|
-
)
|
339
|
-
shipping_services = response.parse["shippingServiceList"]
|
340
264
|
```
|
341
265
|
|
342
|
-
####
|
266
|
+
#### Financial APIs (2024-06-19, 2024-06-01, v0)
|
343
267
|
|
344
|
-
|
268
|
+
Get financial data including transaction details, payments, and refunds.
|
345
269
|
|
346
270
|
```ruby
|
347
|
-
api = Peddler.
|
348
|
-
response = api.
|
349
|
-
|
350
|
-
limit: 10,
|
351
|
-
createdAfter: "2023-01-01T00:00:00Z"
|
352
|
-
)
|
353
|
-
purchase_orders = response.parse["purchaseOrders"]
|
354
|
-
```
|
355
|
-
|
356
|
-
#### Vendor Direct Fulfillment Shipping API (2021-12-28)
|
357
|
-
|
358
|
-
Enables vendors to manage shipping labels and shipping information for direct fulfillment orders.
|
359
|
-
|
360
|
-
```ruby
|
361
|
-
api = Peddler.vendor_direct_fulfillment_shipping_2021_12_28(aws_region, access_token)
|
362
|
-
response = api.get_packing_slip(
|
363
|
-
purchaseOrderNumber: "PO123456789"
|
364
|
-
)
|
365
|
-
response.parse
|
366
|
-
```
|
367
|
-
|
368
|
-
#### Vendor Direct Fulfillment Orders API (2021-12-28)
|
369
|
-
|
370
|
-
Allows vendors to receive orders for direct fulfillment and provide shipment confirmations.
|
371
|
-
|
372
|
-
```ruby
|
373
|
-
api = Peddler.vendor_direct_fulfillment_orders_2021_12_28(aws_region, access_token)
|
374
|
-
response = api.get_orders(
|
375
|
-
createdAfter: "2023-01-01T00:00:00Z",
|
376
|
-
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"
|
377
274
|
)
|
378
|
-
response.parse["
|
275
|
+
financial_events = response.parse["FinancialEvents"]
|
379
276
|
```
|
380
277
|
|
381
|
-
####
|
278
|
+
#### Notifications API (v1)
|
382
279
|
|
383
|
-
|
280
|
+
Subscribe to notifications for various events like order updates and report processing.
|
384
281
|
|
385
282
|
```ruby
|
386
|
-
api = Peddler.
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
partyId: "<PARTY_ID>"
|
393
|
-
},
|
394
|
-
warehouseId: "<WAREHOUSE_ID>",
|
395
|
-
items: [
|
396
|
-
{
|
397
|
-
buyerProductIdentifier: "B08N5WRWNW",
|
398
|
-
availableQuantity: {
|
399
|
-
amount: 100,
|
400
|
-
unitOfMeasure: "Each"
|
401
|
-
}
|
402
|
-
}
|
403
|
-
]
|
404
|
-
}
|
405
|
-
]
|
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" }
|
406
289
|
}
|
407
290
|
)
|
408
|
-
|
409
|
-
```
|
410
|
-
|
411
|
-
#### Shipping API (v2)
|
291
|
+
destination_id = destination.parse["payload"]["destinationId"]
|
412
292
|
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
body: {
|
419
|
-
clientReferenceId: "CLIENT_REF_123",
|
420
|
-
shipTo: {
|
421
|
-
name: "John Doe",
|
422
|
-
addressLine1: "123 Main St",
|
423
|
-
city: "Anytown",
|
424
|
-
stateOrRegion: "NY",
|
425
|
-
postalCode: "12345",
|
426
|
-
countryCode: "US"
|
427
|
-
},
|
428
|
-
shipFrom: {
|
429
|
-
name: "Your Company",
|
430
|
-
addressLine1: "123 Warehouse Ave",
|
431
|
-
city: "Anytown",
|
432
|
-
stateOrRegion: "NY",
|
433
|
-
postalCode: "12345",
|
434
|
-
countryCode: "US"
|
435
|
-
},
|
436
|
-
packages: [
|
437
|
-
{
|
438
|
-
dimensions: {
|
439
|
-
length: 10,
|
440
|
-
width: 5,
|
441
|
-
height: 8,
|
442
|
-
unit: "IN"
|
443
|
-
},
|
444
|
-
weight: {
|
445
|
-
value: 2,
|
446
|
-
unit: "LB"
|
447
|
-
}
|
448
|
-
}
|
449
|
-
],
|
450
|
-
serviceType: "Standard"
|
451
|
-
}
|
293
|
+
# Create subscription
|
294
|
+
api.create_subscription(
|
295
|
+
notificationType: "ANY_OFFER_CHANGED",
|
296
|
+
destinationId: destination_id,
|
297
|
+
payloadVersion: "1"
|
452
298
|
)
|
453
|
-
response.parse
|
454
299
|
```
|
455
300
|
|
456
|
-
####
|
457
|
-
|
458
|
-
Allows you to create restricted data tokens to access personally identifiable information (PII) in specific API calls.
|
459
|
-
|
460
|
-
```ruby
|
461
|
-
api = Peddler.tokens_2021_03_01(aws_region, access_token)
|
462
|
-
response = api.create_restricted_data_token(
|
463
|
-
body: {
|
464
|
-
restrictedResources: [
|
465
|
-
{
|
466
|
-
method: "GET",
|
467
|
-
path: "/orders/v0/orders/123-1234567-1234567",
|
468
|
-
dataElements: ["buyerInfo", "shippingAddress"]
|
469
|
-
}
|
470
|
-
]
|
471
|
-
}
|
472
|
-
)
|
473
|
-
restricted_data_token = response.parse["restrictedDataToken"]
|
474
|
-
|
475
|
-
# Use the token in subsequent API calls
|
476
|
-
orders_api = Peddler.orders_2021_12_01("<AWS_REGION>", restricted_data_token)
|
477
|
-
response = orders_api.get_order(
|
478
|
-
orderId: "123-1234567-1234567"
|
479
|
-
)
|
480
|
-
response.parse
|
481
|
-
```
|
301
|
+
#### Vendor APIs
|
482
302
|
|
483
|
-
|
303
|
+
APIs for vendors selling to Amazon:
|
484
304
|
|
485
|
-
|
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
|
486
309
|
|
487
310
|
```ruby
|
488
|
-
api = Peddler.
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
)
|
493
|
-
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
|
494
316
|
```
|
495
317
|
|
496
|
-
####
|
318
|
+
#### Additional APIs
|
497
319
|
|
498
|
-
|
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
|
499
330
|
|
500
|
-
|
501
|
-
api = Peddler.sellers_v1(aws_region, access_token)
|
502
|
-
response = api.get_marketplace_participations
|
503
|
-
response.parse
|
504
|
-
```
|
331
|
+
For a complete list of available APIs, refer to the [API models repository](https://github.com/amzn/selling-partner-api-models).
|
505
332
|
|
506
333
|
## TODO
|
507
334
|
|
508
|
-
- [ ] Code generate payload parsers
|
509
|
-
- [ ]
|
510
|
-
- [ ] Schedule code generation with GitHub Actions. Push new gem when models change.
|
511
|
-
- [ ] Review and consider applying [these patches][patches].
|
335
|
+
- [ ] Code generate payload parsers
|
336
|
+
- [ ] Review and consider applying [these patches][patches]
|
512
337
|
|
513
338
|
[build]: https://github.com/hakanensari/peddler/actions
|
514
|
-
[maintainability]: https://codeclimate.com/github/hakanensari/peddler/maintainability
|
515
|
-
[test-coverage]: https://codeclimate.com/github/hakanensari/peddler/test_coverage
|
516
339
|
[docs-overview]: https://developer.amazonservices.com/sp-api-docs/overview
|
517
340
|
[register-as-developer]: https://developer-docs.amazon.com/sp-api/docs/registering-as-a-developer
|
518
341
|
[register-application]: https://developer-docs.amazon.com/sp-api/docs/registering-your-application
|
@@ -15,68 +15,6 @@ module Peddler
|
|
15
15
|
# The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the
|
16
16
|
# catalog.
|
17
17
|
class CatalogItemsV0 < API
|
18
|
-
# Effective September 30, 2022, the `listCatalogItems` operation will no longer be available in the Selling
|
19
|
-
# Partner API for Catalog Items v0. As an alternative, `searchCatalogItems` is available in the latest version of
|
20
|
-
# the {https://developer-docs.amazon.com/sp-api/docs/catalog-items-api-v2022-04-01-reference Selling Partner API
|
21
|
-
# for Catalog Items v2022-04-01}. Integrations that rely on the `listCatalogItems` operation should migrate to the
|
22
|
-
# `searchCatalogItems`operation to avoid service disruption. _Note:_ The
|
23
|
-
# [`listCatalogCategories`](#get-catalogv0categories) operation is not being deprecated and you can continue to
|
24
|
-
# make calls to it.
|
25
|
-
#
|
26
|
-
# @note This operation can make a static sandbox call.
|
27
|
-
# @param marketplace_id [String] A marketplace identifier. Specifies the marketplace for which items are returned.
|
28
|
-
# @param query [String] Keyword(s) to use to search for items in the catalog. Example: 'harry potter books'.
|
29
|
-
# @param query_context_id [String] An identifier for the context within which the given search will be performed.
|
30
|
-
# A marketplace might provide mechanisms for constraining a search to a subset of potential items. For example,
|
31
|
-
# the retail marketplace allows queries to be constrained to a specific category. The QueryContextId parameter
|
32
|
-
# specifies such a subset. If it is omitted, the search will be performed using the default context for the
|
33
|
-
# marketplace, which will typically contain the largest set of items.
|
34
|
-
# @param seller_sku [String] Used to identify an item in the given marketplace. SellerSKU is qualified by the
|
35
|
-
# seller's SellerId, which is included with every operation that you submit.
|
36
|
-
# @param upc [String] A 12-digit bar code used for retail packaging.
|
37
|
-
# @param ean [String] A European article number that uniquely identifies the catalog item, manufacturer, and its
|
38
|
-
# attributes.
|
39
|
-
# @param isbn [String] The unique commercial book identifier used to identify books internationally.
|
40
|
-
# @param jan [String] A Japanese article number that uniquely identifies the product, manufacturer, and its
|
41
|
-
# attributes.
|
42
|
-
# @return [Peddler::Response] The API response
|
43
|
-
def list_catalog_items(marketplace_id, query: nil, query_context_id: nil, seller_sku: nil, upc: nil, ean: nil,
|
44
|
-
isbn: nil, jan: nil)
|
45
|
-
path = "/catalog/v0/items"
|
46
|
-
params = {
|
47
|
-
"MarketplaceId" => marketplace_id,
|
48
|
-
"Query" => query,
|
49
|
-
"QueryContextId" => query_context_id,
|
50
|
-
"SellerSKU" => seller_sku,
|
51
|
-
"UPC" => upc,
|
52
|
-
"EAN" => ean,
|
53
|
-
"ISBN" => isbn,
|
54
|
-
"JAN" => jan,
|
55
|
-
}.compact
|
56
|
-
|
57
|
-
get(path, params:)
|
58
|
-
end
|
59
|
-
|
60
|
-
# Effective September 30, 2022, the `getCatalogItem` operation will no longer be available in the Selling Partner
|
61
|
-
# API for Catalog Items v0. This operation is available in the latest version of the
|
62
|
-
# {https://developer-docs.amazon.com/sp-api/docs/catalog-items-api-v2022-04-01-reference Selling Partner API for
|
63
|
-
# Catalog Items v2022-04-01}. Integrations that rely on this operation should migrate to the latest version to
|
64
|
-
# avoid service disruption. _Note:_ The [`listCatalogCategories`](#get-catalogv0categories) operation is not being
|
65
|
-
# deprecated and you can continue to make calls to it.
|
66
|
-
#
|
67
|
-
# @note This operation can make a static sandbox call.
|
68
|
-
# @param marketplace_id [String] A marketplace identifier. Specifies the marketplace for the item.
|
69
|
-
# @param asin [String] The Amazon Standard Identification Number (ASIN) of the item.
|
70
|
-
# @return [Peddler::Response] The API response
|
71
|
-
def get_catalog_item(marketplace_id, asin)
|
72
|
-
path = "/catalog/v0/items/#{asin}"
|
73
|
-
params = {
|
74
|
-
"MarketplaceId" => marketplace_id,
|
75
|
-
}.compact
|
76
|
-
|
77
|
-
get(path, params:)
|
78
|
-
end
|
79
|
-
|
80
18
|
# Returns the parent categories to which an item belongs, based on the specified ASIN or SellerSKU.
|
81
19
|
#
|
82
20
|
# @note This operation can make a static sandbox call.
|