peddler 2.4.4 → 3.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +406 -134
- data/lib/peddler/access_token.rb +76 -0
- data/lib/peddler/api/amazon_warehousing_and_distribution_2024_05_09.rb +80 -0
- data/lib/peddler/api/aplus_content_2020_11_01.rb +208 -0
- data/lib/peddler/api/application_management_2023_11_30.rb +25 -0
- data/lib/peddler/api/catalog_items_2020_12_01.rb +70 -0
- data/lib/peddler/api/catalog_items_2022_04_01.rb +83 -0
- data/lib/peddler/api/catalog_items_v0.rb +90 -0
- data/lib/peddler/api/data_kiosk_2023_11_15.rb +92 -0
- data/lib/peddler/api/easy_ship_2022_03_23.rb +108 -0
- data/lib/peddler/api/fba_inbound_eligibility_v1.rb +36 -0
- data/lib/peddler/api/fba_inventory_v1.rb +106 -0
- data/lib/peddler/api/feeds_2021_06_30.rb +104 -0
- data/lib/peddler/api/finances_v0.rb +121 -0
- data/lib/peddler/api/fulfillment_inbound_2024_03_20.rb +660 -0
- data/lib/peddler/api/fulfillment_inbound_v0.rb +314 -0
- data/lib/peddler/api/fulfillment_outbound_2020_07_01.rb +222 -0
- data/lib/peddler/api/listings_items_2020_09_01.rb +84 -0
- data/lib/peddler/api/listings_items_2021_08_01.rb +154 -0
- data/lib/peddler/api/listings_restrictions_2021_08_01.rb +37 -0
- data/lib/peddler/api/merchant_fulfillment_v0.rb +64 -0
- data/lib/peddler/api/messaging_v1.rb +241 -0
- data/lib/peddler/api/notifications_v1.rb +114 -0
- data/lib/peddler/api/orders_v0.rb +264 -0
- data/lib/peddler/api/product_fees_v0.rb +69 -0
- data/lib/peddler/api/product_pricing_2022_05_01.rb +43 -0
- data/lib/peddler/api/product_pricing_v0.rb +144 -0
- data/lib/peddler/api/product_type_definitions_2020_09_01.rb +75 -0
- data/lib/peddler/api/replenishment_2022_11_07.rb +45 -0
- data/lib/peddler/api/reports_2021_06_30.rb +139 -0
- data/lib/peddler/api/sales_v1.rb +69 -0
- data/lib/peddler/api/sellers_v1.rb +33 -0
- data/lib/peddler/api/services_v1.rb +308 -0
- data/lib/peddler/api/shipment_invoicing_v0.rb +46 -0
- data/lib/peddler/api/shipping_v1.rb +107 -0
- data/lib/peddler/api/shipping_v2.rb +267 -0
- data/lib/peddler/api/solicitations_v1.rb +53 -0
- data/lib/peddler/api/supply_sources_2020_07_01.rb +82 -0
- data/lib/peddler/api/tokens_2021_03_01.rb +30 -0
- data/lib/peddler/api/uploads_2020_11_01.rb +40 -0
- data/lib/peddler/api/vendor_direct_fulfillment_inventory_v1.rb +24 -0
- data/lib/peddler/api/vendor_direct_fulfillment_orders_2021_12_28.rb +72 -0
- data/lib/peddler/api/vendor_direct_fulfillment_orders_v1.rb +72 -0
- data/lib/peddler/api/vendor_direct_fulfillment_payments_v1.rb +23 -0
- data/lib/peddler/api/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +35 -0
- data/lib/peddler/api/vendor_direct_fulfillment_shipping_2021_12_28.rb +177 -0
- data/lib/peddler/api/vendor_direct_fulfillment_shipping_v1.rb +165 -0
- data/lib/peddler/api/vendor_direct_fulfillment_transactions_2021_12_28.rb +24 -0
- data/lib/peddler/api/vendor_direct_fulfillment_transactions_v1.rb +24 -0
- data/lib/peddler/api/vendor_invoices_v1.rb +22 -0
- data/lib/peddler/api/vendor_orders_v1.rb +148 -0
- data/lib/peddler/api/vendor_shipments_v1.rb +120 -0
- data/lib/peddler/api/vendor_transaction_status_v1.rb +24 -0
- data/lib/peddler/api.rb +115 -0
- data/lib/peddler/error.rb +30 -0
- data/lib/peddler/region.rb +30 -0
- data/lib/peddler/version.rb +1 -1
- data/lib/peddler.rb +52 -1
- metadata +70 -80
- data/lib/mws/easy_ship/client.rb +0 -93
- data/lib/mws/easy_ship.rb +0 -3
- data/lib/mws/feeds/client.rb +0 -122
- data/lib/mws/feeds.rb +0 -3
- data/lib/mws/finances/client.rb +0 -82
- data/lib/mws/finances.rb +0 -3
- data/lib/mws/fulfillment_inbound_shipment/client.rb +0 -388
- data/lib/mws/fulfillment_inbound_shipment.rb +0 -3
- data/lib/mws/fulfillment_inventory/client.rb +0 -57
- data/lib/mws/fulfillment_inventory.rb +0 -3
- data/lib/mws/fulfillment_outbound_shipment/client.rb +0 -211
- data/lib/mws/fulfillment_outbound_shipment.rb +0 -3
- data/lib/mws/merchant_fulfillment/client.rb +0 -87
- data/lib/mws/merchant_fulfillment.rb +0 -3
- data/lib/mws/off_amazon_payments.rb +0 -3
- data/lib/mws/orders/client.rb +0 -120
- data/lib/mws/orders.rb +0 -3
- data/lib/mws/products/client.rb +0 -268
- data/lib/mws/products.rb +0 -3
- data/lib/mws/recommendations/client.rb +0 -72
- data/lib/mws/recommendations.rb +0 -3
- data/lib/mws/reports/client.rb +0 -236
- data/lib/mws/reports.rb +0 -3
- data/lib/mws/sellers/client.rb +0 -44
- data/lib/mws/sellers.rb +0 -3
- data/lib/mws/shipment_invoicing/client.rb +0 -74
- data/lib/mws/shipment_invoicing.rb +0 -3
- data/lib/mws/subscriptions/client.rb +0 -179
- data/lib/mws/subscriptions.rb +0 -3
- data/lib/mws.rb +0 -29
- data/lib/peddler/client.rb +0 -159
- data/lib/peddler/errors/builder.rb +0 -64
- data/lib/peddler/errors/class_generator.rb +0 -40
- data/lib/peddler/errors/error.rb +0 -45
- data/lib/peddler/errors/parser.rb +0 -28
- data/lib/peddler/flat_file_parser.rb +0 -56
- data/lib/peddler/headers.rb +0 -102
- data/lib/peddler/marketplace.rb +0 -78
- data/lib/peddler/operation.rb +0 -78
- data/lib/peddler/parser.rb +0 -33
- data/lib/peddler/structured_list.rb +0 -23
- data/lib/peddler/vcr_matcher.rb +0 -97
- data/lib/peddler/xml_parser.rb +0 -38
- data/lib/peddler/xml_response_parser.rb +0 -25
data/README.md
CHANGED
@@ -1,244 +1,516 @@
|
|
1
1
|
# Peddler
|
2
2
|
|
3
|
-
[![Build](https://github.com/hakanensari/peddler/workflows/build/badge.svg)]
|
4
|
-
[![Maintainability](https://api.codeclimate.com/v1/badges/281e6176048f3c0a1ed3/maintainability)]
|
5
|
-
[![Test Coverage](https://api.codeclimate.com/v1/badges/281e6176048f3c0a1ed3/test_coverage)]
|
3
|
+
[![Build](https://github.com/hakanensari/peddler/workflows/build/badge.svg)][build]
|
4
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/281e6176048f3c0a1ed3/maintainability)][maintainability]
|
5
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/281e6176048f3c0a1ed3/test_coverage)][test-coverage]
|
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
|
-
|
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 on Amazon][view-credentials]. You'll use these to access data for your own seller account or retrieve data on behalf of others.
|
10
10
|
|
11
|
-
|
11
|
+
![Peddler](https://github.com/hakanensari/peddler/blob/main/images/peddler.jpg?raw=true)
|
12
12
|
|
13
|
-
|
13
|
+
## Installation
|
14
14
|
|
15
|
-
|
15
|
+
Add this line to your Gemfile.
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem "peddler", "3.0.0.beta1"
|
19
|
+
```
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
```shell
|
24
|
+
bundle install
|
25
|
+
```
|
16
26
|
|
17
27
|
## Usage
|
18
28
|
|
29
|
+
Set your LWA credentials in your environment.
|
30
|
+
|
31
|
+
```shell
|
32
|
+
export LWA_CLIENT_ID=<YOUR_CLIENT_ID>
|
33
|
+
export LWA_CLIENT_SECRET=<YOUR_CLIENT_SECRET>
|
34
|
+
```
|
35
|
+
|
19
36
|
Require the library.
|
20
37
|
|
21
38
|
```ruby
|
22
39
|
require "peddler"
|
23
40
|
```
|
24
41
|
|
25
|
-
|
42
|
+
### Authentication
|
26
43
|
|
44
|
+
A seller or vendor will [provide a refresh token][authorization] to access their data on Amazon. You'll use this to generate temporary access tokens to authenticate individual API requests. Here’s how you can request one in Peddler.
|
27
45
|
|
28
|
-
```
|
29
|
-
|
30
|
-
|
46
|
+
```ruby
|
47
|
+
access_token = Peddler::AccessToken.request(
|
48
|
+
refresh_token: "<REFRESH_TOKEN>",
|
49
|
+
)
|
31
50
|
```
|
32
51
|
|
33
|
-
|
52
|
+
You can also request a token for grantless operations.
|
34
53
|
|
35
54
|
```ruby
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
# or a shorthand
|
40
|
-
client = MWS.orders(marketplace: "US",
|
41
|
-
merchant_id: "123")
|
55
|
+
access_token = Peddler::AccessToken.request(
|
56
|
+
scope: "sellingpartnerapi::notifications",
|
57
|
+
)
|
42
58
|
```
|
43
59
|
|
44
|
-
|
60
|
+
Access tokens are valid for one hour. To optimize performance, cache the token and reuse it across calls instead of generating a new one each time.
|
61
|
+
|
62
|
+
If you haven’t set your LWA credentials as environment variables, you can pass them directly when requesting an access token:
|
45
63
|
|
46
64
|
```ruby
|
47
|
-
|
48
|
-
|
49
|
-
|
65
|
+
access_token = Peddler::AccessToken.request(
|
66
|
+
client_id: "<YOUR_CLIENT_ID>",
|
67
|
+
client_secret: "<YOUR_CLIENT_SECRET>",
|
68
|
+
refresh_token: "<REFRESH_TOKEN>",
|
69
|
+
)
|
50
70
|
```
|
51
71
|
|
52
|
-
|
72
|
+
### Throttling
|
73
|
+
|
74
|
+
Amazon’s Selling Partner API (SP-API) imposes standard rate limits on most operations. Peddler respects these limits and automatically backs off when throttled to ensure compliance with Amazon’s policies.
|
53
75
|
|
54
|
-
|
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:
|
55
77
|
|
56
78
|
```ruby
|
57
|
-
|
58
|
-
merchant_id: "123",
|
59
|
-
aws_access_key_id: "123",
|
60
|
-
aws_secret_access_key: "123")
|
79
|
+
gem "http", github: "httprb/http"
|
61
80
|
```
|
62
81
|
|
63
|
-
|
64
|
-
|
65
|
-
For instance, using the above MWS Orders client:
|
82
|
+
If you have custom rate limits (e.g., Amazon has granted you higher quotas), you can override the standard rate limit using the rate_limit method.
|
66
83
|
|
67
84
|
```ruby
|
68
|
-
|
85
|
+
@api.rate_limit(5).get_item_offers_batch(...)
|
69
86
|
```
|
70
87
|
|
71
|
-
|
88
|
+
This sets a custom rate limit of 5 requests per second for the requested operation.
|
89
|
+
|
90
|
+
### The APIs
|
91
|
+
|
92
|
+
Peddler provides a class for each API version under an eponymous namespace. Below is a list of the more important APIs, along with brief descriptions and code examples to help you get started.
|
72
93
|
|
73
|
-
|
94
|
+
#### Catalog Items API (2022-04-01)
|
95
|
+
|
96
|
+
Provides programmatic access to Amazon's catalog data, such as item titles, descriptions, and other product details.
|
97
|
+
|
98
|
+
**Example:**
|
74
99
|
|
75
100
|
```ruby
|
76
|
-
|
77
|
-
response
|
78
|
-
|
101
|
+
client = Peddler::API::CatalogItems20220401.new("<AWS_REGION>", "<ACCESS_TOKEN>")
|
102
|
+
response = client.get_catalog_item(
|
103
|
+
marketplaceIds: ["ATVPDKIKX0DER"],
|
104
|
+
asin: "B08N5WRWNW"
|
105
|
+
)
|
106
|
+
items = response.parse.dig("items")
|
79
107
|
```
|
80
108
|
|
81
|
-
|
109
|
+
#### Orders API (v0)
|
110
|
+
|
111
|
+
Allows you to retrieve order information, including order details, buyer information, and order items.
|
112
|
+
|
113
|
+
**Example:**
|
82
114
|
|
83
115
|
```ruby
|
84
|
-
|
116
|
+
client = Peddler::API::OrdersV0.new("<AWS_REGION>", "<ACCESS_TOKEN>")
|
117
|
+
response = client.get_orders(
|
118
|
+
marketplaceIds: ["ATVPDKIKX0DER"],
|
119
|
+
createdAfter: "2023-01-01T00:00:00Z"
|
120
|
+
)
|
121
|
+
orders = response.parse.dig("orders")
|
85
122
|
```
|
86
123
|
|
87
|
-
|
88
|
-
|
89
|
-
### Throttling
|
124
|
+
#### Feeds API (2021-06-30)
|
90
125
|
|
91
|
-
|
126
|
+
Enables you to upload data to Amazon for updating listings, prices, inventory, and more.
|
92
127
|
|
93
|
-
|
128
|
+
**Example:**
|
94
129
|
|
95
130
|
```ruby
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
131
|
+
client = Peddler::API::Feeds20210630.new("<AWS_REGION>", "<ACCESS_TOKEN>")
|
132
|
+
# Create a feed document to get an upload URL
|
133
|
+
response = client.create_feed_document(
|
134
|
+
contentType: "text/xml; charset=UTF-8"
|
135
|
+
)
|
136
|
+
feed_document_id = response.parse["feedDocumentId"]
|
137
|
+
upload_url = response.parse["url"]
|
138
|
+
|
139
|
+
# Upload the feed content to the provided URL
|
140
|
+
feed_content = File.read("inventory_update.xml")
|
141
|
+
client.upload_feed_document(upload_url, feed_content)
|
142
|
+
|
143
|
+
# Create the feed
|
144
|
+
response = client.create_feed(
|
145
|
+
feedType: "POST_INVENTORY_AVAILABILITY_DATA",
|
146
|
+
marketplaceIds: ["ATVPDKIKX0DER"],
|
147
|
+
inputFeedDocumentId: feed_document_id
|
148
|
+
)
|
149
|
+
feed_id = response.parse["feedId"]
|
102
150
|
```
|
103
151
|
|
104
|
-
|
152
|
+
#### Reports API (2021-06-30)
|
105
153
|
|
106
|
-
|
154
|
+
Allows you to request and download various reports, such as order and inventory reports.
|
107
155
|
|
108
|
-
|
109
|
-
response = client.method_with_quota
|
110
|
-
puts response.mws_quota_remaining
|
111
|
-
# 150
|
156
|
+
**Example:**
|
112
157
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
158
|
+
```ruby
|
159
|
+
client = Peddler::API::Reports20210630.new("<AWS_REGION>", "<ACCESS_TOKEN>")
|
160
|
+
response = client.create_report(
|
161
|
+
reportType: "GET_FLAT_FILE_OPEN_LISTINGS_DATA",
|
162
|
+
marketplaceIds: ["ATVPDKIKX0DER"]
|
163
|
+
)
|
164
|
+
report_id = response.parse["reportId"]
|
119
165
|
```
|
120
166
|
|
121
|
-
|
167
|
+
#### Listings Items API (2021-08-01)
|
122
168
|
|
123
|
-
|
169
|
+
Enables you to manage your product listings on Amazon, including creating, updating, and deleting listings.
|
124
170
|
|
125
|
-
|
171
|
+
**Example:**
|
126
172
|
|
127
|
-
|
173
|
+
```ruby
|
174
|
+
client = Peddler::API::ListingsItems20210801.new("<AWS_REGION>", "<ACCESS_TOKEN>")
|
175
|
+
response = client.put_listings_item(
|
176
|
+
"<SELLER_ID>",
|
177
|
+
"SKU123",
|
178
|
+
"ATVPDKIKX0DER",
|
179
|
+
body: {
|
180
|
+
productType: "PRODUCT",
|
181
|
+
requirements: "LISTING",
|
182
|
+
attributes: {
|
183
|
+
title: [{ value: "New Product Title" }],
|
184
|
+
description: [{ value: "Product description goes here." }],
|
185
|
+
bullet_point: [{ value: "Feature 1" }, { value: "Feature 2" }],
|
186
|
+
manufacturer: [{ value: "Your Brand" }]
|
187
|
+
}
|
188
|
+
}
|
189
|
+
)
|
190
|
+
result = response.parse
|
191
|
+
```
|
192
|
+
|
193
|
+
#### Notifications API (v1)
|
128
194
|
|
129
|
-
|
195
|
+
Allows you to subscribe to notifications for specific events like order status updates or feed processing statuses.
|
130
196
|
|
131
|
-
|
197
|
+
**Example:**
|
132
198
|
|
133
199
|
```ruby
|
134
|
-
|
135
|
-
|
136
|
-
|
200
|
+
client = Peddler::API::NotificationsV1.new("<AWS_REGION>", "<ACCESS_TOKEN>")
|
201
|
+
# Create a destination
|
202
|
+
response = client.create_destination(
|
203
|
+
name: "MySQSQueue",
|
204
|
+
resourceSpecification: {
|
205
|
+
sqs: {
|
206
|
+
arn: "arn:aws:sqs:us-east-1:123456789012:MyQueue"
|
207
|
+
}
|
208
|
+
}
|
209
|
+
)
|
210
|
+
destination_id = response.parse["destinationId"]
|
211
|
+
|
212
|
+
# Create a subscription
|
213
|
+
response = client.create_subscription(
|
214
|
+
notificationType: "ANY_OFFER_CHANGED",
|
215
|
+
destinationId: destination_id
|
216
|
+
)
|
217
|
+
subscription = response.parse
|
137
218
|
```
|
138
219
|
|
139
|
-
|
220
|
+
#### Product Fees API (v0)
|
140
221
|
|
141
|
-
|
222
|
+
Provides information about fees that may be charged for selling products on Amazon.
|
142
223
|
|
143
|
-
|
224
|
+
**Example:**
|
144
225
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
226
|
+
```ruby
|
227
|
+
client = Peddler::API::ProductFeesV0.new("<AWS_REGION>", "<ACCESS_TOKEN>")
|
228
|
+
response = client.get_my_fees_estimate_for_sku(
|
229
|
+
sellerId: "<YOUR_SELLER_ID>",
|
230
|
+
sku: "SKU123",
|
231
|
+
body: {
|
232
|
+
FeesEstimateRequest: {
|
233
|
+
MarketplaceId: "ATVPDKIKX0DER",
|
234
|
+
IsAmazonFulfilled: true,
|
235
|
+
PriceToEstimateFees: {
|
236
|
+
ListingPrice: {
|
237
|
+
CurrencyCode: "USD",
|
238
|
+
Amount: 25.00
|
239
|
+
}
|
240
|
+
}
|
241
|
+
}
|
242
|
+
}
|
243
|
+
)
|
244
|
+
fees_estimate = response.parse
|
245
|
+
```
|
149
246
|
|
150
|
-
|
247
|
+
#### Fulfillment Outbound API (2020-07-01)
|
151
248
|
|
152
|
-
|
249
|
+
Allows you to create and manage fulfillment orders using Amazon's fulfillment network.
|
153
250
|
|
154
|
-
|
155
|
-
- [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/Feeds/Client)
|
156
|
-
- [XML schema docs](https://sellercentral.amazon.com/gp/help/help-page.html?itemID=1611)
|
251
|
+
**Example:**
|
157
252
|
|
158
|
-
|
253
|
+
```ruby
|
254
|
+
client = Peddler::API::FulfillmentOutbound20200701.new("<AWS_REGION>", "<ACCESS_TOKEN>")
|
255
|
+
response = client.create_fulfillment_order(
|
256
|
+
body: {
|
257
|
+
sellerFulfillmentOrderId: "ORDER123",
|
258
|
+
displayableOrderId: "ORDER123",
|
259
|
+
displayableOrderDate: Time.now.iso8601,
|
260
|
+
displayableOrderComment: "Thank you for your order!",
|
261
|
+
shippingSpeedCategory: "Standard",
|
262
|
+
destinationAddress: {
|
263
|
+
name: "John Doe",
|
264
|
+
addressLine1: "123 Main St",
|
265
|
+
city: "Anytown",
|
266
|
+
stateOrRegion: "NY",
|
267
|
+
postalCode: "12345",
|
268
|
+
countryCode: "US"
|
269
|
+
},
|
270
|
+
items: [
|
271
|
+
{
|
272
|
+
sellerSku: "SKU123",
|
273
|
+
sellerFulfillmentOrderItemId: "ITEM123",
|
274
|
+
quantity: 1
|
275
|
+
}
|
276
|
+
]
|
277
|
+
}
|
278
|
+
)
|
279
|
+
result = response.parse
|
280
|
+
```
|
159
281
|
|
160
|
-
|
282
|
+
#### Merchant Fulfillment API (v0)
|
161
283
|
|
162
|
-
|
163
|
-
- [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/Finances/Client)
|
284
|
+
Allows you to create shipping labels for orders using Amazon's negotiated shipping rates.
|
164
285
|
|
165
|
-
|
286
|
+
**Example:**
|
166
287
|
|
167
|
-
|
288
|
+
```ruby
|
289
|
+
client = Peddler::API::MerchantFulfillmentV0.new("<AWS_REGION>", "<ACCESS_TOKEN>")
|
290
|
+
response = client.get_eligible_shipping_services(
|
291
|
+
body: {
|
292
|
+
shipmentRequestDetails: {
|
293
|
+
amazonOrderId: "ORDER123",
|
294
|
+
itemList: [
|
295
|
+
{
|
296
|
+
orderItemId: "ITEM123",
|
297
|
+
quantity: 1
|
298
|
+
}
|
299
|
+
],
|
300
|
+
shipFromAddress: {
|
301
|
+
name: "Your Company",
|
302
|
+
addressLine1: "123 Warehouse Ave",
|
303
|
+
city: "Anytown",
|
304
|
+
stateOrRegion: "NY",
|
305
|
+
postalCode: "12345",
|
306
|
+
countryCode: "US"
|
307
|
+
},
|
308
|
+
packageDimensions: {
|
309
|
+
length: 10,
|
310
|
+
width: 5,
|
311
|
+
height: 8,
|
312
|
+
unit: "INCHES"
|
313
|
+
},
|
314
|
+
weight: {
|
315
|
+
value: 2,
|
316
|
+
unit: "POUNDS"
|
317
|
+
},
|
318
|
+
shippingServiceOptions: {
|
319
|
+
deliveryExperience: "DELIVERY_CONFIRMATION_WITHOUT_SIGNATURE",
|
320
|
+
carrierWillPickUp: false
|
321
|
+
}
|
322
|
+
}
|
323
|
+
}
|
324
|
+
)
|
325
|
+
shipping_services = response.parse["shippingServiceList"]
|
326
|
+
```
|
168
327
|
|
169
|
-
|
170
|
-
- [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/FulfillmentInboundShipment/Client)
|
328
|
+
#### Vendor Orders API (2021-12-29)
|
171
329
|
|
172
|
-
|
330
|
+
Allows vendors to retrieve purchase orders and order details from Amazon.
|
173
331
|
|
174
|
-
|
332
|
+
**Example:**
|
175
333
|
|
176
|
-
|
177
|
-
|
334
|
+
```ruby
|
335
|
+
client = Peddler::API::VendorOrders20211228.new("<AWS_REGION>", "<ACCESS_TOKEN>")
|
336
|
+
response = client.get_purchase_orders(
|
337
|
+
shipToPartyId: "<PARTY_ID>",
|
338
|
+
limit: 10,
|
339
|
+
createdAfter: "2023-01-01T00:00:00Z"
|
340
|
+
)
|
341
|
+
purchase_orders = response.parse["purchaseOrders"]
|
342
|
+
```
|
178
343
|
|
179
|
-
|
344
|
+
#### Vendor Direct Fulfillment Shipping API (2021-12-28)
|
180
345
|
|
181
|
-
|
346
|
+
Enables vendors to manage shipping labels and shipping information for direct fulfillment orders.
|
182
347
|
|
183
|
-
|
348
|
+
**Example:**
|
184
349
|
|
185
|
-
|
186
|
-
|
350
|
+
```ruby
|
351
|
+
client = Peddler::API::VendorDirectFulfillmentShipping20211228.new("<AWS_REGION>", "<ACCESS_TOKEN>")
|
352
|
+
response = client.get_packing_slip(
|
353
|
+
purchaseOrderNumber: "PO123456789"
|
354
|
+
)
|
355
|
+
packing_slip = response.parse
|
356
|
+
```
|
187
357
|
|
188
|
-
|
358
|
+
#### Vendor Direct Fulfillment Orders API (2021-12-28)
|
189
359
|
|
190
|
-
|
360
|
+
Allows vendors to receive orders for direct fulfillment and provide shipment confirmations.
|
191
361
|
|
192
|
-
|
193
|
-
- [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/MerchantFulfillment/Client)
|
362
|
+
**Example:**
|
194
363
|
|
195
|
-
|
364
|
+
```ruby
|
365
|
+
client = Peddler::API::VendorDirectFulfillmentOrders20211228.new("<AWS_REGION>", "<ACCESS_TOKEN>")
|
366
|
+
response = client.get_orders(
|
367
|
+
createdAfter: "2023-01-01T00:00:00Z",
|
368
|
+
limit: 10
|
369
|
+
)
|
370
|
+
orders = response.parse["orders"]
|
371
|
+
```
|
196
372
|
|
197
|
-
|
373
|
+
#### Vendor Direct Fulfillment Inventory API (2021-12-28)
|
198
374
|
|
199
|
-
|
200
|
-
- [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/Orders/Client)
|
375
|
+
Enables vendors to update inventory levels for direct fulfillment items.
|
201
376
|
|
202
|
-
|
377
|
+
**Example:**
|
203
378
|
|
204
|
-
|
379
|
+
```ruby
|
380
|
+
client = Peddler::API::VendorDirectFulfillmentInventory20211228.new("<AWS_REGION>", "<ACCESS_TOKEN>")
|
381
|
+
response = client.submit_inventory_update(
|
382
|
+
body: {
|
383
|
+
inventory: [
|
384
|
+
{
|
385
|
+
sellingParty: {
|
386
|
+
partyId: "<PARTY_ID>"
|
387
|
+
},
|
388
|
+
warehouseId: "<WAREHOUSE_ID>",
|
389
|
+
items: [
|
390
|
+
{
|
391
|
+
buyerProductIdentifier: "B08N5WRWNW",
|
392
|
+
availableQuantity: {
|
393
|
+
amount: 100,
|
394
|
+
unitOfMeasure: "Each"
|
395
|
+
}
|
396
|
+
}
|
397
|
+
]
|
398
|
+
}
|
399
|
+
]
|
400
|
+
}
|
401
|
+
)
|
402
|
+
result = response.parse
|
403
|
+
```
|
205
404
|
|
206
|
-
|
207
|
-
- [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/Products/Client)
|
405
|
+
#### Shipping API (v2)
|
208
406
|
|
209
|
-
|
407
|
+
Provides functionalities for purchasing shipping labels and tracking shipments.
|
210
408
|
|
211
|
-
|
409
|
+
**Example:**
|
212
410
|
|
213
|
-
|
214
|
-
|
411
|
+
```ruby
|
412
|
+
client = Peddler::API::ShippingV2.new("<AWS_REGION>", "<ACCESS_TOKEN>")
|
413
|
+
response = client.purchase_shipment(
|
414
|
+
body: {
|
415
|
+
clientReferenceId: "CLIENT_REF_123",
|
416
|
+
shipTo: {
|
417
|
+
name: "John Doe",
|
418
|
+
addressLine1: "123 Main St",
|
419
|
+
city: "Anytown",
|
420
|
+
stateOrRegion: "NY",
|
421
|
+
postalCode: "12345",
|
422
|
+
countryCode: "US"
|
423
|
+
},
|
424
|
+
shipFrom: {
|
425
|
+
name: "Your Company",
|
426
|
+
addressLine1: "123 Warehouse Ave",
|
427
|
+
city: "Anytown",
|
428
|
+
stateOrRegion: "NY",
|
429
|
+
postalCode: "12345",
|
430
|
+
countryCode: "US"
|
431
|
+
},
|
432
|
+
packages: [
|
433
|
+
{
|
434
|
+
dimensions: {
|
435
|
+
length: 10,
|
436
|
+
width: 5,
|
437
|
+
height: 8,
|
438
|
+
unit: "IN"
|
439
|
+
},
|
440
|
+
weight: {
|
441
|
+
value: 2,
|
442
|
+
unit: "LB"
|
443
|
+
}
|
444
|
+
}
|
445
|
+
],
|
446
|
+
serviceType: "Standard"
|
447
|
+
}
|
448
|
+
)
|
449
|
+
shipment = response.parse
|
450
|
+
```
|
215
451
|
|
216
|
-
|
452
|
+
#### Token API (2021-03-01)
|
217
453
|
|
218
|
-
|
454
|
+
Allows you to create restricted data tokens to access personally identifiable information (PII) in specific API calls.
|
219
455
|
|
220
|
-
|
221
|
-
- [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/Reports/Client)
|
456
|
+
**Example:**
|
222
457
|
|
223
|
-
|
458
|
+
```ruby
|
459
|
+
client = Peddler::API::Tokens20210301.new("<AWS_REGION>", "<ACCESS_TOKEN>")
|
460
|
+
response = client.create_restricted_data_token(
|
461
|
+
body: {
|
462
|
+
restrictedResources: [
|
463
|
+
{
|
464
|
+
method: "GET",
|
465
|
+
path: "/orders/v0/orders/123-1234567-1234567",
|
466
|
+
dataElements: ["buyerInfo", "shippingAddress"]
|
467
|
+
}
|
468
|
+
]
|
469
|
+
}
|
470
|
+
)
|
471
|
+
restricted_data_token = response.parse["restrictedDataToken"]
|
472
|
+
|
473
|
+
# Use the token in subsequent API calls
|
474
|
+
orders_client = Peddler::API::Orders20211201.new("<AWS_REGION>", restricted_data_token)
|
475
|
+
response = orders_client.get_order(
|
476
|
+
orderId: "123-1234567-1234567"
|
477
|
+
)
|
478
|
+
order_details = response.parse
|
479
|
+
```
|
224
480
|
|
225
|
-
|
481
|
+
#### Finances API (v0)
|
226
482
|
|
227
|
-
|
228
|
-
- [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/Sellers/Client)
|
483
|
+
Provides information about financial events for your seller account, such as order payments, refunds, and fees.
|
229
484
|
|
230
|
-
|
485
|
+
**Example:**
|
231
486
|
|
232
|
-
|
487
|
+
```ruby
|
488
|
+
client = Peddler::API::FinancesV0.new
|
489
|
+
response = client.list_financial_events(
|
490
|
+
postedAfter: "2023-01-01T00:00:00Z",
|
491
|
+
maxResultsPerPage: 100
|
492
|
+
)
|
493
|
+
financial_events = response.parse["FinancialEvents"]
|
494
|
+
```
|
233
495
|
|
234
|
-
|
496
|
+
#### Sellers API (V1)
|
235
497
|
|
236
|
-
|
237
|
-
- [Peddler API docs](https://www.rubydoc.info/gems/peddler/MWS/ShipmentInvoicing/Client)
|
498
|
+
Provides information about seller's marketplaces and participation status.
|
238
499
|
|
239
|
-
|
500
|
+
**Example:**
|
240
501
|
|
241
|
-
|
502
|
+
```ruby
|
503
|
+
client = Peddler::API::SellersV1.new
|
504
|
+
response = client.get_marketplace_participations
|
505
|
+
participations = response.parse["payload"]
|
506
|
+
```
|
242
507
|
|
243
|
-
|
244
|
-
|
508
|
+
[build]: https://github.com/hakanensari/peddler/actions
|
509
|
+
[maintainability]: https://codeclimate.com/github/hakanensari/peddler/maintainability
|
510
|
+
[test-coverage]: https://codeclimate.com/github/hakanensari/peddler/test_coverage
|
511
|
+
[docs-overview]: https://developer.amazonservices.com/sp-api-docs/overview
|
512
|
+
[register-as-developer]: https://developer-docs.amazon.com/sp-api/docs/registering-as-a-developer
|
513
|
+
[register-application]: https://developer-docs.amazon.com/sp-api/docs/registering-your-application
|
514
|
+
[view-credentials]: https://developer-docs.amazon.com/sp-api/docs/viewing-your-application-information-and-credentials
|
515
|
+
[authorization]: https://developer-docs.amazon.com/sp-api/docs/authorizing-selling-partner-api-applications
|
516
|
+
[httprb]: https://github.com/httprb/http
|