peddler 5.4.0 → 5.5.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 +20 -1
- data/lib/peddler/api.rb +28 -4
- data/lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09/order_attribute.rb +20 -0
- data/lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09/outbound_execution_error.rb +24 -0
- data/lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09/outbound_listing.rb +24 -0
- data/lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09/outbound_order.rb +60 -0
- data/lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09/outbound_order_creation_data.rb +23 -0
- data/lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09/outbound_order_reference.rb +18 -0
- data/lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09/outbound_shipment.rb +43 -0
- data/lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09/shipment_label_page_types.rb +20 -0
- data/lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rb +100 -0
- data/lib/peddler/apis/listings_restrictions_2021_08_01/restriction_list.rb +1 -1
- data/lib/peddler/apis/listings_restrictions_2021_08_01.rb +4 -1
- data/lib/peddler/apis/notifications_v1/aggregation_filter.rb +2 -2
- data/lib/peddler/apis/notifications_v1/destination.rb +1 -1
- data/lib/peddler/apis/notifications_v1/event_bridge_resource.rb +2 -2
- data/lib/peddler/apis/notifications_v1/event_filter.rb +6 -6
- data/lib/peddler/apis/notifications_v1/marketplace_filter.rb +1 -1
- data/lib/peddler/apis/notifications_v1/marketplace_ids.rb +2 -2
- data/lib/peddler/apis/notifications_v1/order_change_type_filter.rb +2 -1
- data/lib/peddler/apis/notifications_v1/order_change_types.rb +2 -2
- data/lib/peddler/apis/notifications_v1/processing_directive.rb +18 -7
- data/lib/peddler/apis/notifications_v1/send_test_notification_request.rb +20 -0
- data/lib/peddler/apis/notifications_v1/send_test_notification_response.rb +20 -0
- data/lib/peddler/apis/notifications_v1/test_notification.rb +22 -0
- data/lib/peddler/apis/notifications_v1.rb +45 -17
- data/lib/peddler/apis/orders_2026_01_01/fulfillment_order.rb +19 -0
- data/lib/peddler/apis/orders_2026_01_01/item_proceeds_breakdown.rb +5 -5
- data/lib/peddler/apis/orders_2026_01_01/order.rb +5 -0
- data/lib/peddler/apis/orders_2026_01_01/order_proceeds.rb +5 -0
- data/lib/peddler/apis/orders_2026_01_01/order_proceeds_breakdown.rb +30 -0
- data/lib/peddler/apis/orders_v0/approved_alternative_details.rb +20 -0
- data/lib/peddler/apis/orders_v0/approved_attribute.rb +23 -0
- data/lib/peddler/apis/orders_v0/interim_status_detail.rb +24 -0
- data/lib/peddler/apis/orders_v0/regulated_order_verification_status.rb +5 -0
- data/lib/peddler/apis/orders_v0/valid_interim_status_code.rb +21 -0
- data/lib/peddler/apis/orders_v0/valid_verification_detail.rb +2 -1
- data/lib/peddler/apis/orders_v0/verification_details.rb +8 -0
- data/lib/peddler/apis/product_type_definitions_2020_09_01/error_list.rb +1 -1
- data/lib/peddler/apis/product_type_definitions_2020_09_01/product_type.rb +1 -1
- data/lib/peddler/apis/product_type_definitions_2020_09_01/product_type_list.rb +1 -1
- data/lib/peddler/apis/product_type_definitions_2020_09_01/schema_link.rb +2 -1
- data/lib/peddler/apis/product_type_definitions_2020_09_01.rb +12 -8
- data/lib/peddler/apis/replenishment_2022_11_07/get_selling_partner_metrics_request.rb +5 -0
- data/lib/peddler/apis/replenishment_2022_11_07/get_selling_partner_metrics_request_filters.rb +48 -0
- data/lib/peddler/apis/replenishment_2022_11_07/get_selling_partner_metrics_response_metric.rb +9 -9
- data/lib/peddler/apis/replenishment_2022_11_07/list_offer_metrics_request.rb +2 -2
- data/lib/peddler/apis/replenishment_2022_11_07/list_offer_metrics_request_filters.rb +16 -3
- data/lib/peddler/apis/replenishment_2022_11_07/list_offer_metrics_response_offer.rb +8 -1
- data/lib/peddler/apis/replenishment_2022_11_07/list_offers_request.rb +2 -2
- data/lib/peddler/apis/replenishment_2022_11_07/list_offers_request_filters.rb +2 -2
- data/lib/peddler/apis/replenishment_2022_11_07/time_interval.rb +10 -6
- data/lib/peddler/apis/services_v1/associated_item.rb +3 -0
- data/lib/peddler/apis/services_v1/linked_asset.rb +24 -0
- data/lib/peddler/apis/services_v1/service_job.rb +6 -0
- data/lib/peddler/apis/services_v1.rb +10 -4
- data/lib/peddler/apis/uploads_2020_11_01.rb +1 -1
- data/lib/peddler/notifications/order_change/notification.rb +4 -3
- data/lib/peddler/notifications/order_change/order_change_notification.rb +2 -2
- data/lib/peddler/notifications/order_change/order_change_trigger.rb +4 -4
- data/lib/peddler/notifications/order_change/order_item.rb +7 -7
- data/lib/peddler/notifications/order_change/summary.rb +17 -17
- data/lib/peddler/version.rb +1 -1
- data/sig/peddler/api.rbs +2 -0
- data/sig/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rbs +167 -0
- data/sig/peddler/apis/listings_restrictions_2021_08_01.rbs +1 -1
- data/sig/peddler/apis/notifications_v1.rbs +61 -7
- data/sig/peddler/apis/orders_2026_01_01.rbs +59 -23
- data/sig/peddler/apis/orders_v0.rbs +73 -14
- data/sig/peddler/apis/product_type_definitions_2020_09_01.rbs +1 -1
- data/sig/peddler/apis/replenishment_2022_11_07.rbs +48 -21
- data/sig/peddler/apis/services_v1.rbs +36 -15
- metadata +21 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dfaa728f0b1fe2e6c63402f3bc188b58f9b6d2d35177666a48f2dcf36420e353
|
|
4
|
+
data.tar.gz: 80d2163af9c60fdd65feaa9d4b9d24d3c5e4babc4d6386228ed03f8ac9851bcf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 73ecd6efcc89cf60e4565e5d13e39c96240a8bf1e2a08e7f88eeb1ed5f72f65ed63c18a7d2f300727c09adb430a05cea4b110b22ad0e98fd73c20cb4404d4a9e
|
|
7
|
+
data.tar.gz: d1c8d6b7d388b26110edc1326fa1907e7ad696d79d8f9a7acfea37d7df739fbc6ddd6908933496e7734dded1725553fcc417be22491ed8bace4b887463169567
|
data/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Add to your Gemfile.
|
|
|
14
14
|
|
|
15
15
|
### Agent skill
|
|
16
16
|
|
|
17
|
-
If you use
|
|
17
|
+
If you use an agent, install the SP-API skill:
|
|
18
18
|
|
|
19
19
|
```shell
|
|
20
20
|
npx skills add lineofflight/peddler
|
|
@@ -197,6 +197,21 @@ rescue Peddler::Error => e
|
|
|
197
197
|
end
|
|
198
198
|
```
|
|
199
199
|
|
|
200
|
+
#### Rescuing Specific Errors
|
|
201
|
+
|
|
202
|
+
Peddler raises specific pre-defined subclasses for common Amazon error codes (e.g., `Peddler::Errors::QuotaExceeded`, `Peddler::Errors::NotFound`, `Peddler::Errors::InvalidInput`).
|
|
203
|
+
|
|
204
|
+
If Amazon returns an undocumented or newly introduced error code, Peddler dynamically instantiates a matching subclass under the `Peddler::Errors` namespace at runtime. To rescue a new specific subclass without causing a boot-time `NameError` in your application, define the class beforehand in an initializer:
|
|
205
|
+
|
|
206
|
+
```ruby
|
|
207
|
+
# config/initializers/peddler_errors.rb
|
|
208
|
+
module Peddler
|
|
209
|
+
module Errors
|
|
210
|
+
class NewAmazonErrorCode < Error; end
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
```
|
|
214
|
+
|
|
200
215
|
### Available APIs
|
|
201
216
|
|
|
202
217
|
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:
|
|
@@ -334,6 +349,10 @@ For complete method signatures, see [sig/peddler/apis/](sig/peddler/apis/)
|
|
|
334
349
|
|
|
335
350
|
For a complete list of available APIs and their detailed documentation, refer to the [API models repository][openapi-models].
|
|
336
351
|
|
|
352
|
+
## Best practices
|
|
353
|
+
|
|
354
|
+
Writing efficient SP-API code? See the [best-practices checklist](skills/sp-api-ruby/best-practices.md) bundled with the agent skill: cutting call volume, batching, caching, API versions, reports, and per-API quirks.
|
|
355
|
+
|
|
337
356
|
## Development
|
|
338
357
|
|
|
339
358
|
```bash
|
data/lib/peddler/api.rb
CHANGED
|
@@ -9,6 +9,8 @@ module Peddler
|
|
|
9
9
|
class CannotSandbox < StandardError; end
|
|
10
10
|
class MustSandbox < StandardError; end
|
|
11
11
|
|
|
12
|
+
TRANSIENT_STATUSES = [429, 500, 502, 503, 504].freeze
|
|
13
|
+
|
|
12
14
|
# @return [Peddler::Endpoint]
|
|
13
15
|
attr_reader :endpoint
|
|
14
16
|
|
|
@@ -62,10 +64,32 @@ module Peddler
|
|
|
62
64
|
"X-Amz-Date" => timestamp,
|
|
63
65
|
)
|
|
64
66
|
|
|
65
|
-
return client if retries.zero?
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
return client if retries.zero?
|
|
68
|
+
|
|
69
|
+
on_retry = ->(_req, _err, res) {
|
|
70
|
+
Thread.current[:peddler_last_retry_status] = res&.status
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
delay = ->(iteration) {
|
|
74
|
+
last_status = Thread.current[:peddler_last_retry_status]
|
|
75
|
+
|
|
76
|
+
if last_status == 429 && rate_limit
|
|
77
|
+
# Rate-limit-aware exponential backoff with jitter if throttled
|
|
78
|
+
# @see https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
|
|
79
|
+
initial_delay = sandbox? ? 0.2 : 1.0 / rate_limit
|
|
80
|
+
(initial_delay * (2.0**(iteration - 1))) + (rand * 0.1)
|
|
81
|
+
else
|
|
82
|
+
# Standard backoff for network errors and 5xx
|
|
83
|
+
(2.0**(iteration - 1)) - 1 + rand
|
|
84
|
+
end
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
client.retriable(
|
|
88
|
+
tries: retries + 1,
|
|
89
|
+
delay: delay,
|
|
90
|
+
on_retry: on_retry,
|
|
91
|
+
retry_statuses: TRANSIENT_STATUSES,
|
|
92
|
+
)
|
|
69
93
|
end
|
|
70
94
|
|
|
71
95
|
private
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is generated. Do not edit.
|
|
4
|
+
|
|
5
|
+
require "structure"
|
|
6
|
+
|
|
7
|
+
module Peddler
|
|
8
|
+
module APIs
|
|
9
|
+
class AmazonWarehousingAndDistribution20240509
|
|
10
|
+
# Consists of the order preference and corresponding preference value.
|
|
11
|
+
OrderAttribute = Structure.new do
|
|
12
|
+
# @return [String] Preference for the distribution order.
|
|
13
|
+
attribute(:order_preference, String, null: false, from: "orderPreference")
|
|
14
|
+
|
|
15
|
+
# @return [String] Value for the order preference.
|
|
16
|
+
attribute(:order_preference_value, String, null: false, from: "orderPreferenceValue")
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
data/lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09/outbound_execution_error.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is generated. Do not edit.
|
|
4
|
+
|
|
5
|
+
require "structure"
|
|
6
|
+
|
|
7
|
+
module Peddler
|
|
8
|
+
module APIs
|
|
9
|
+
class AmazonWarehousingAndDistribution20240509
|
|
10
|
+
# Execution errors associated with the outbound order. This field will be populated if the order failed
|
|
11
|
+
# validation.
|
|
12
|
+
OutboundExecutionError = Structure.new do
|
|
13
|
+
# @return [String] Failure code details for the error.
|
|
14
|
+
attribute(:failure_code, String, null: false, from: "failureCode")
|
|
15
|
+
|
|
16
|
+
# @return [Array<String>] Failure reasons for the error.
|
|
17
|
+
attribute(:failure_reasons, [String], null: false, from: "failureReasons")
|
|
18
|
+
|
|
19
|
+
# @return [String] MSKU associated with the error.
|
|
20
|
+
attribute?(:sku, String)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is generated. Do not edit.
|
|
4
|
+
|
|
5
|
+
require "structure"
|
|
6
|
+
|
|
7
|
+
module Peddler
|
|
8
|
+
module APIs
|
|
9
|
+
class AmazonWarehousingAndDistribution20240509
|
|
10
|
+
# A list of paginated outbound orders filtered by the attributes passed in the request.
|
|
11
|
+
OutboundListing = Structure.new do
|
|
12
|
+
# @return [String] TA token that is used to retrieve the next page of results. The response includes `nextToken`
|
|
13
|
+
# when the number of results exceeds the specified `maxResults` value. To get the next page of results, call
|
|
14
|
+
# the operation with this token and include the same arguments as the call that produced the token. To get a
|
|
15
|
+
# complete list, call this operation until `nextToken` is null. Note that this operation can return empty
|
|
16
|
+
# pages.
|
|
17
|
+
attribute?(:next_token, String, from: "nextToken")
|
|
18
|
+
|
|
19
|
+
# @return [Array<OutboundOrder>] List of outbound orders.
|
|
20
|
+
attribute?(:outbound_orders, [OutboundOrder], from: "outboundOrders")
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is generated. Do not edit.
|
|
4
|
+
|
|
5
|
+
require "structure"
|
|
6
|
+
require "time"
|
|
7
|
+
|
|
8
|
+
module Peddler
|
|
9
|
+
module APIs
|
|
10
|
+
class AmazonWarehousingAndDistribution20240509
|
|
11
|
+
# Represents an AWD outbound order.
|
|
12
|
+
OutboundOrder = Structure.new do
|
|
13
|
+
# @return [String] Order ID for the outbound order.
|
|
14
|
+
attribute(:order_id, String, null: false, from: "orderId")
|
|
15
|
+
|
|
16
|
+
# @return [String] Status for the outbound order.
|
|
17
|
+
attribute(:order_status, String, null: false, from: "orderStatus")
|
|
18
|
+
|
|
19
|
+
# @return [Array<OutboundShipment>] List of outbound shipments that are part of this order.
|
|
20
|
+
attribute(:outbound_shipments, [OutboundShipment], null: false, from: "outboundShipments")
|
|
21
|
+
|
|
22
|
+
# @return [Time] Date on which this outbound order was confirmed.
|
|
23
|
+
attribute?(:confirmed_on, Time, from: "confirmedOn")
|
|
24
|
+
|
|
25
|
+
# @return [Time] Date on which this outbound order was created.
|
|
26
|
+
attribute?(:created_at, Time, from: "createdAt")
|
|
27
|
+
|
|
28
|
+
# @return [Array<DistributionPackageQuantity>] List of packages that are eligible for outbound.
|
|
29
|
+
attribute?(:eligible_packages_to_outbound, [DistributionPackageQuantity], from: "eligiblePackagesToOutbound")
|
|
30
|
+
|
|
31
|
+
# @return [Array<ProductQuantity>] List of product units that are eligible for outbound.
|
|
32
|
+
attribute?(:eligible_products_to_outbound, [ProductQuantity], from: "eligibleProductsToOutbound")
|
|
33
|
+
|
|
34
|
+
# @return [Array<OutboundExecutionError>] Execution errors associated with the outbound order. This field will
|
|
35
|
+
# be populated if the order failed validation.
|
|
36
|
+
attribute?(:execution_errors, [OutboundExecutionError], from: "executionErrors")
|
|
37
|
+
|
|
38
|
+
# @return [Array<OrderAttribute>] Order preferences for this outbound order.
|
|
39
|
+
attribute?(:order_preferences, [OrderAttribute], from: "orderPreferences")
|
|
40
|
+
|
|
41
|
+
# @return [Array<DistributionPackageQuantity>] List of packages to be outbound.
|
|
42
|
+
attribute?(:packages_to_outbound, [DistributionPackageQuantity], from: "packagesToOutbound")
|
|
43
|
+
|
|
44
|
+
# @return [Array<ProductQuantity>] List of product units to be outbound.
|
|
45
|
+
attribute?(:products_to_outbound, [ProductQuantity], from: "productsToOutbound")
|
|
46
|
+
|
|
47
|
+
# @return [Array<DistributionPackageQuantity>] Outbound packages that are shipped after the execution has
|
|
48
|
+
# completed post confirmation.
|
|
49
|
+
attribute?(:shipped_outbound_packages, [DistributionPackageQuantity], from: "shippedOutboundPackages")
|
|
50
|
+
|
|
51
|
+
# @return [Array<ProductQuantity>] Outbound product units that are shipped after the execution has completed
|
|
52
|
+
# post confirmation.
|
|
53
|
+
attribute?(:shipped_outbound_products, [ProductQuantity], from: "shippedOutboundProducts")
|
|
54
|
+
|
|
55
|
+
# @return [Time] Date on which this outbound order was last updated.
|
|
56
|
+
attribute?(:updated_at, Time, from: "updatedAt")
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
data/lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09/outbound_order_creation_data.rb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is generated. Do not edit.
|
|
4
|
+
|
|
5
|
+
require "structure"
|
|
6
|
+
|
|
7
|
+
module Peddler
|
|
8
|
+
module APIs
|
|
9
|
+
class AmazonWarehousingAndDistribution20240509
|
|
10
|
+
# Payload for creating an outbound order.
|
|
11
|
+
OutboundOrderCreationData = Structure.new do
|
|
12
|
+
# @return [Array<OrderAttribute>] Order preferences for the outbound order.
|
|
13
|
+
attribute?(:order_preferences, [OrderAttribute], from: "orderPreferences")
|
|
14
|
+
|
|
15
|
+
# @return [Array<DistributionPackageQuantity>] List of packages to be outbound.
|
|
16
|
+
attribute?(:packages_to_outbound, [DistributionPackageQuantity], from: "packagesToOutbound")
|
|
17
|
+
|
|
18
|
+
# @return [Array<ProductQuantity>] List of product units to be outbound.
|
|
19
|
+
attribute?(:products_to_outbound, [ProductQuantity], from: "productsToOutbound")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
data/lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09/outbound_order_reference.rb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is generated. Do not edit.
|
|
4
|
+
|
|
5
|
+
require "structure"
|
|
6
|
+
|
|
7
|
+
module Peddler
|
|
8
|
+
module APIs
|
|
9
|
+
class AmazonWarehousingAndDistribution20240509
|
|
10
|
+
# A response that contains the reference identifier for the newly created or updated outbound order. This includes
|
|
11
|
+
# an order ID.
|
|
12
|
+
OutboundOrderReference = Structure.new do
|
|
13
|
+
# @return [String] outbound order ID.
|
|
14
|
+
attribute(:order_id, String, null: false, from: "orderId")
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is generated. Do not edit.
|
|
4
|
+
|
|
5
|
+
require "structure"
|
|
6
|
+
require "time"
|
|
7
|
+
|
|
8
|
+
module Peddler
|
|
9
|
+
module APIs
|
|
10
|
+
class AmazonWarehousingAndDistribution20240509
|
|
11
|
+
# Represents an AWD outbound shipment.
|
|
12
|
+
OutboundShipment = Structure.new do
|
|
13
|
+
# @return [Address] Destination address for this shipment.
|
|
14
|
+
attribute(:destination_address, Address, null: false, from: "destinationAddress")
|
|
15
|
+
|
|
16
|
+
# @return [String] Outbound order ID this outbound shipment belongs to.
|
|
17
|
+
attribute(:order_id, String, null: false, from: "orderId")
|
|
18
|
+
|
|
19
|
+
# @return [Address] Origin address for this shipment.
|
|
20
|
+
attribute(:origin_address, Address, null: false, from: "originAddress")
|
|
21
|
+
|
|
22
|
+
# @return [String] Unique shipment ID.
|
|
23
|
+
attribute(:shipment_id, String, null: false, from: "shipmentId")
|
|
24
|
+
|
|
25
|
+
# @return [String] Current status of this shipment.
|
|
26
|
+
attribute(:shipment_status, String, null: false, from: "shipmentStatus")
|
|
27
|
+
|
|
28
|
+
# @return [Time] Timestamp when the shipment was created.
|
|
29
|
+
attribute?(:created_at, Time, from: "createdAt")
|
|
30
|
+
|
|
31
|
+
# @return [Array<DistributionPackageQuantity>] Specific distribution packages that are included in the context
|
|
32
|
+
# of this shipment.
|
|
33
|
+
attribute?(:shipment_package_quantities, [DistributionPackageQuantity], from: "shipmentPackageQuantities")
|
|
34
|
+
|
|
35
|
+
# @return [Array<ProductQuantity>] Specific product units that are included in the context of this shipment.
|
|
36
|
+
attribute?(:shipment_product_quantities, [ProductQuantity], from: "shipmentProductQuantities")
|
|
37
|
+
|
|
38
|
+
# @return [Time] Timestamp when the shipment was updated.
|
|
39
|
+
attribute?(:updated_at, Time, from: "updatedAt")
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
data/lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09/shipment_label_page_types.rb
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is generated. Do not edit.
|
|
4
|
+
|
|
5
|
+
require "structure"
|
|
6
|
+
|
|
7
|
+
module Peddler
|
|
8
|
+
module APIs
|
|
9
|
+
class AmazonWarehousingAndDistribution20240509
|
|
10
|
+
# Shipment label page types.
|
|
11
|
+
ShipmentLabelPageTypes = Structure.new do
|
|
12
|
+
# @return [String] Status of label page types.
|
|
13
|
+
attribute(:label_status, String, null: false, from: "labelStatus")
|
|
14
|
+
|
|
15
|
+
# @return [Array<PageType>] List of available page types.
|
|
16
|
+
attribute?(:page_types, Array, from: "pageTypes")
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -108,6 +108,19 @@ module Peddler
|
|
|
108
108
|
get(path, params:, rate_limit:, parser:)
|
|
109
109
|
end
|
|
110
110
|
|
|
111
|
+
# Retrieves the available label page types for a shipment ID that you specify. This is an asynchronous operation.
|
|
112
|
+
# If the label status is `GENERATED`, then the pageTypes are available.
|
|
113
|
+
#
|
|
114
|
+
# @note This operation can make a static sandbox call.
|
|
115
|
+
# @param shipment_id [String] ID for the shipment.
|
|
116
|
+
# @param rate_limit [Float] Requests per second
|
|
117
|
+
# @return [Peddler::Response] The API response
|
|
118
|
+
def get_label_page_types(shipment_id, rate_limit: 1.0)
|
|
119
|
+
path = "/awd/2024-05-09/inboundShipments/#{percent_encode(shipment_id)}/labelPageTypes"
|
|
120
|
+
parser = -> { ShipmentLabelPageTypes }
|
|
121
|
+
get(path, rate_limit:, parser:)
|
|
122
|
+
end
|
|
123
|
+
|
|
111
124
|
# Updates transport details for an AWD shipment.
|
|
112
125
|
#
|
|
113
126
|
# @note This operation can make a static sandbox call.
|
|
@@ -197,6 +210,93 @@ module Peddler
|
|
|
197
210
|
get(path, params:, rate_limit:, parser:)
|
|
198
211
|
end
|
|
199
212
|
|
|
213
|
+
# Retrieves all outbound AWD orders (with optional filters) that pertain to a merchant. By default, orders are
|
|
214
|
+
# sorted by the `updatedAt` attribute in descending order.
|
|
215
|
+
#
|
|
216
|
+
# @note This operation can make a static sandbox call.
|
|
217
|
+
# @param updated_after [String] Get the outbound orders updated after a certain time (inclusive). The date must be
|
|
218
|
+
# in {https://developer-docs.amazon.com/sp-api/docs/iso-8601 ISO 8601} format.
|
|
219
|
+
# @param updated_before [String] Get the outbound orders updated before a certain time (inclusive). The date must
|
|
220
|
+
# be in {https://developer-docs.amazon.com/sp-api/docs/iso-8601 ISO 8601} format.
|
|
221
|
+
# @param sort_order [String] Sort the response in `ASCENDING` or `DESCENDING` order.
|
|
222
|
+
# @param max_results [Integer] Maximum number of results to return.
|
|
223
|
+
# @param next_token [String] A token that is used to retrieve the next page of results. The response includes
|
|
224
|
+
# `nextToken` when the number of results exceeds the specified `maxResults` value. To get the next page of
|
|
225
|
+
# results, call the operation with this token and include the same arguments as the call that produced the
|
|
226
|
+
# token. To get a complete list, call this operation until `nextToken` is null. Note that this operation can
|
|
227
|
+
# return empty pages.
|
|
228
|
+
# @param rate_limit [Float] Requests per second
|
|
229
|
+
# @return [Peddler::Response] The API response
|
|
230
|
+
def list_outbounds(updated_after: nil, updated_before: nil, sort_order: nil, max_results: 25, next_token: nil,
|
|
231
|
+
rate_limit: 1.0)
|
|
232
|
+
path = "/awd/2024-05-09/outboundOrders"
|
|
233
|
+
params = {
|
|
234
|
+
"updatedAfter" => updated_after,
|
|
235
|
+
"updatedBefore" => updated_before,
|
|
236
|
+
"sortOrder" => sort_order,
|
|
237
|
+
"maxResults" => max_results,
|
|
238
|
+
"nextToken" => next_token,
|
|
239
|
+
}.compact
|
|
240
|
+
parser = -> { OutboundListing }
|
|
241
|
+
get(path, params:, rate_limit:, parser:)
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# Creates a draft AWD outbound order with the specified products. The API returns the order ID for the newly
|
|
245
|
+
# created order and starts an async validation check on the outbound products. After the validation check, the
|
|
246
|
+
# order status transitions from `VALIDATING` to `ELIGIBLE/INELIGIBLE`.
|
|
247
|
+
#
|
|
248
|
+
# @note This operation can make a static sandbox call.
|
|
249
|
+
# @param body [Hash] Payload for creating an outbound order.
|
|
250
|
+
# @param rate_limit [Float] Requests per second
|
|
251
|
+
# @return [Peddler::Response] The API response
|
|
252
|
+
def create_outbound(body, rate_limit: 1.0)
|
|
253
|
+
path = "/awd/2024-05-09/outboundOrders"
|
|
254
|
+
parser = -> { OutboundOrderReference }
|
|
255
|
+
post(path, body:, rate_limit:, parser:)
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# Retrieves an AWD outbound order with a set of shipments that contain items that are outbound into a destination
|
|
259
|
+
# channel. If the order is not eligible, the validation errors field is included in the order response. The API
|
|
260
|
+
# returns the order ID for the newly created order and starts an async validation check on the outbound products.
|
|
261
|
+
# After the validation check, the order status transitions from `VALIDATING` to `ELIGIBLE/INELIGIBLE`.
|
|
262
|
+
#
|
|
263
|
+
# @note This operation can make a static sandbox call.
|
|
264
|
+
# @param order_id [String] ID for the outbound order to be retrieved.
|
|
265
|
+
# @param rate_limit [Float] Requests per second
|
|
266
|
+
# @return [Peddler::Response] The API response
|
|
267
|
+
def get_outbound(order_id, rate_limit: 1.0)
|
|
268
|
+
path = "/awd/2024-05-09/outboundOrders/#{percent_encode(order_id)}"
|
|
269
|
+
parser = -> { OutboundOrder }
|
|
270
|
+
get(path, rate_limit:, parser:)
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
# Updates an AWD outbound order that is in `DRAFT`, `ELIGIBLE`, or `INELIGIBLE` status. This API allows updates on
|
|
274
|
+
# `productsToOutbound` and `orderPreferences` attributes only. Any updates will restart the outbound order
|
|
275
|
+
# validation.
|
|
276
|
+
#
|
|
277
|
+
# @note This operation can make a static sandbox call.
|
|
278
|
+
# @param order_id [String] ID for the outbound order to be updated.
|
|
279
|
+
# @param body [Hash] Represents an AWD outbound order.
|
|
280
|
+
# @param rate_limit [Float] Requests per second
|
|
281
|
+
# @return [Peddler::Response] The API response
|
|
282
|
+
def update_outbound(order_id, body, rate_limit: 1.0)
|
|
283
|
+
path = "/awd/2024-05-09/outboundOrders/#{percent_encode(order_id)}"
|
|
284
|
+
parser = -> { OutboundOrderReference }
|
|
285
|
+
put(path, body:, rate_limit:, parser:)
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
# Confirms an AWD outbound order for a set of shipments that contain items that must be outbound to a destination
|
|
289
|
+
# node. You can confirm the order only if it's in an`ELIGIBLE` state.
|
|
290
|
+
#
|
|
291
|
+
# @note This operation can make a static sandbox call.
|
|
292
|
+
# @param order_id [String] ID for the outbound order you want to confirm.
|
|
293
|
+
# @param rate_limit [Float] Requests per second
|
|
294
|
+
# @return [Peddler::Response] The API response
|
|
295
|
+
def confirm_outbound(order_id, rate_limit: 1.0)
|
|
296
|
+
path = "/awd/2024-05-09/outboundOrders/#{percent_encode(order_id)}/confirmation"
|
|
297
|
+
post(path, rate_limit:)
|
|
298
|
+
end
|
|
299
|
+
|
|
200
300
|
# Retrieves all the AWD replenishment orders pertaining to a merchant with optional filters.
|
|
201
301
|
# API by default will sort orders by updatedAt attribute in descending order.
|
|
202
302
|
#
|
|
@@ -9,7 +9,7 @@ module Peddler
|
|
|
9
9
|
class ListingsRestrictions20210801
|
|
10
10
|
# A list of restrictions for the specified Amazon catalog item.
|
|
11
11
|
RestrictionList = Structure.new do
|
|
12
|
-
# @return [Array<Restriction>]
|
|
12
|
+
# @return [Array<Restriction>] A list of restrictions.
|
|
13
13
|
attribute(:restrictions, [Restriction], null: false)
|
|
14
14
|
end
|
|
15
15
|
end
|
|
@@ -25,10 +25,12 @@ module Peddler
|
|
|
25
25
|
# @param reason_locale [String] A locale for reason text localization. When not provided, the default language
|
|
26
26
|
# code of the first marketplace is used. Examples: "en_US", "fr_CA", "fr_FR". Localized messages default to
|
|
27
27
|
# "en_US" when a localization is not available in the specified locale.
|
|
28
|
+
# @param product_type [String] The product type of the item. When provided with the brand name, the API evaluates
|
|
29
|
+
# GTIN exemption restrictions in addition to brand restrictions for the specified product type.
|
|
28
30
|
# @param rate_limit [Float] Requests per second
|
|
29
31
|
# @return [Peddler::Response] The API response
|
|
30
32
|
def get_listings_restrictions(asin, seller_id, marketplace_ids, condition_type: nil, reason_locale: nil,
|
|
31
|
-
rate_limit: 5.0)
|
|
33
|
+
product_type: nil, rate_limit: 5.0)
|
|
32
34
|
path = "/listings/2021-08-01/restrictions"
|
|
33
35
|
params = {
|
|
34
36
|
"asin" => asin,
|
|
@@ -36,6 +38,7 @@ module Peddler
|
|
|
36
38
|
"sellerId" => seller_id,
|
|
37
39
|
"marketplaceIds" => stringify_array(marketplace_ids),
|
|
38
40
|
"reasonLocale" => reason_locale,
|
|
41
|
+
"productType" => product_type,
|
|
39
42
|
}.compact
|
|
40
43
|
parser = -> { RestrictionList }
|
|
41
44
|
get(path, params:, rate_limit:, parser:)
|
|
@@ -7,8 +7,8 @@ require "structure"
|
|
|
7
7
|
module Peddler
|
|
8
8
|
module APIs
|
|
9
9
|
class NotificationsV1
|
|
10
|
-
# A filter
|
|
11
|
-
# notification every five minutes for high frequency notifications).
|
|
10
|
+
# A filter you can use to select the aggregation time period at which to send notifications (for example, limit to
|
|
11
|
+
# one notification every five minutes for high frequency notifications).
|
|
12
12
|
AggregationFilter = Structure.new do
|
|
13
13
|
# @return [AggregationSettings]
|
|
14
14
|
attribute?(:aggregation_settings, AggregationSettings, from: "aggregationSettings")
|
|
@@ -7,7 +7,7 @@ require "structure"
|
|
|
7
7
|
module Peddler
|
|
8
8
|
module APIs
|
|
9
9
|
class NotificationsV1
|
|
10
|
-
# Information about the destination
|
|
10
|
+
# Information about the destination you create when you call the `createDestination` operation.
|
|
11
11
|
Destination = Structure.new do
|
|
12
12
|
# @return [String] The destination identifier generated when you created the destination.
|
|
13
13
|
attribute(:destination_id, String, null: false, from: "destinationId")
|
|
@@ -16,8 +16,8 @@ module Peddler
|
|
|
16
16
|
# @return [String] The name of the partner event source associated with the destination.
|
|
17
17
|
attribute(:name, String, null: false)
|
|
18
18
|
|
|
19
|
-
# @return [String] The AWS region in which you receive the notifications. For AWS regions that
|
|
20
|
-
#
|
|
19
|
+
# @return [String] The AWS region in which you receive the notifications. For AWS regions that Amazon
|
|
20
|
+
# EventBridge supports, refer to [Amazon EventBridge endpoints and
|
|
21
21
|
# quotas](https://docs.aws.amazon.com/general/latest/gr/ev.html).
|
|
22
22
|
attribute(:region, String, null: false)
|
|
23
23
|
end
|
|
@@ -7,13 +7,13 @@ require "structure"
|
|
|
7
7
|
module Peddler
|
|
8
8
|
module APIs
|
|
9
9
|
class NotificationsV1
|
|
10
|
-
# A `notificationType`
|
|
11
|
-
#
|
|
10
|
+
# A `notificationType` filter. This object contains all of the available filters and properties that you can use
|
|
11
|
+
# to define a `notificationType` specific filter.
|
|
12
12
|
EventFilter = Structure.new do
|
|
13
|
-
# @return [String] An `eventFilterType` value that
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
13
|
+
# @return [String] An `eventFilterType` value that the `notificationType` supports. The subscription service
|
|
14
|
+
# uses the `eventFilterType` to determine the type of event filter. To determine if a specific
|
|
15
|
+
# `notificationType` supports an `eventFilterType`, refer to [Notification Type Values](
|
|
16
|
+
# https://developer-docs.amazon.com/sp-api/docs/notification-type-values).
|
|
17
17
|
attribute(:event_filter_type, String, null: false, from: "eventFilterType")
|
|
18
18
|
|
|
19
19
|
# @return [AggregationSettings]
|
|
@@ -7,7 +7,7 @@ require "structure"
|
|
|
7
7
|
module Peddler
|
|
8
8
|
module APIs
|
|
9
9
|
class NotificationsV1
|
|
10
|
-
# An event filter to customize your subscription to send notifications for
|
|
10
|
+
# An event filter you can use to customize your subscription to send notifications for specific `marketplaceId`s.
|
|
11
11
|
MarketplaceFilter = Structure.new do
|
|
12
12
|
# @return [Array<String>]
|
|
13
13
|
attribute?(:marketplace_ids, [String], from: "marketplaceIds")
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
module Peddler
|
|
6
6
|
module APIs
|
|
7
7
|
class NotificationsV1
|
|
8
|
-
# A list of marketplace identifiers
|
|
9
|
-
# every marketplace, do not provide this list.
|
|
8
|
+
# A list of marketplace identifiers you can subscribe to (for example, `ATVPDKIKX0DER`). To receive notifications
|
|
9
|
+
# in every marketplace, do not provide this list.
|
|
10
10
|
class MarketplaceIds < Array
|
|
11
11
|
class << self
|
|
12
12
|
def parse(array)
|
|
@@ -7,7 +7,8 @@ require "structure"
|
|
|
7
7
|
module Peddler
|
|
8
8
|
module APIs
|
|
9
9
|
class NotificationsV1
|
|
10
|
-
# An event filter to customize your subscription to send notifications for
|
|
10
|
+
# An event filter you can use to customize your subscription to send notifications for a specific
|
|
11
|
+
# `orderChangeType`.
|
|
11
12
|
OrderChangeTypeFilter = Structure.new do
|
|
12
13
|
# @return [Array<OrderChangeTypeEnum>]
|
|
13
14
|
attribute?(:order_change_types, Array, from: "orderChangeTypes")
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
module Peddler
|
|
6
6
|
module APIs
|
|
7
7
|
class NotificationsV1
|
|
8
|
-
# A list of order change types
|
|
9
|
-
# all change types, do not provide this list.
|
|
8
|
+
# A list of order change types you can subscribe to (for example, `BuyerRequestedChange`). To receive
|
|
9
|
+
# notifications of all change types, do not provide this list.
|
|
10
10
|
class OrderChangeTypes < Array
|
|
11
11
|
class << self
|
|
12
12
|
def parse(array)
|
|
@@ -8,15 +8,26 @@ module Peddler
|
|
|
8
8
|
module APIs
|
|
9
9
|
class NotificationsV1
|
|
10
10
|
# Additional information passed to the subscription to control the processing of notifications. For example, you
|
|
11
|
-
# can use an `eventFilter` to customize your subscription to send notifications for only the
|
|
12
|
-
#
|
|
13
|
-
# one notification every five minutes for high frequency notifications).
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
# This feature is currently only supported by the `ANY_OFFER_CHANGED` and `ORDER_CHANGE` `notificationType`s.
|
|
11
|
+
# can use an `eventFilter` to customize your subscription to send notifications for only the `marketplaceId`s that
|
|
12
|
+
# you specify, or select the aggregation time period at which to send notifications (for example, you can set a
|
|
13
|
+
# limit of one notification every five minutes for high frequency notifications). You can also use
|
|
14
|
+
# `filterExpression` to filter events based on notification payload. The specific features available can vary by
|
|
15
|
+
# the `notificationType`.
|
|
17
16
|
ProcessingDirective = Structure.new do
|
|
18
|
-
# @return [EventFilter] A `notificationType`
|
|
17
|
+
# @return [EventFilter] A `notificationType` filter. Note: eventFilter and filterExpression are mutually
|
|
18
|
+
# exclusive, meaning if eventFilter is provided, filterExpression field cannot be used.
|
|
19
19
|
attribute?(:event_filter, EventFilter, from: "eventFilter")
|
|
20
|
+
|
|
21
|
+
# @return [String] An expression for filtering events before delivery to destination based on the notification
|
|
22
|
+
# payload (example: FulfillmentOrderStatusNotification.FulfillmentOrderStatus == `SHIPPED` ). The
|
|
23
|
+
# `filterExpression` is a string that follows the CEL expression syntax (https://github.com/google/cel-spec)
|
|
24
|
+
# excluding arithmetic operators (+, -, *, /, %) and list/map indexing ([]). Refer to Notification Type Values
|
|
25
|
+
# to determine if filter Expression is supported for a Notification Type. Refer to CEL Operators
|
|
26
|
+
# (https://developer-docs.amazon.com/sp-api/docs/filter-notification-subscriptions) to see if a CEL operator
|
|
27
|
+
# is supported.
|
|
28
|
+
# Note: eventFilter and filterExpression are mutually exclusive. You can use filterExpression to replace
|
|
29
|
+
# existing eventFilter configurations.
|
|
30
|
+
attribute?(:filter_expression, String, from: "filterExpression")
|
|
20
31
|
end
|
|
21
32
|
end
|
|
22
33
|
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is generated. Do not edit.
|
|
4
|
+
|
|
5
|
+
require "structure"
|
|
6
|
+
|
|
7
|
+
module Peddler
|
|
8
|
+
module APIs
|
|
9
|
+
class NotificationsV1
|
|
10
|
+
# The request schema for the `sendTestNotification` operation.
|
|
11
|
+
SendTestNotificationRequest = Structure.new do
|
|
12
|
+
# @return [String] The identifier for the destination where notifications will be delivered.
|
|
13
|
+
attribute?(:destination_id, String, from: "destinationId")
|
|
14
|
+
|
|
15
|
+
# @return [TestNotification]
|
|
16
|
+
attribute?(:test_notification, TestNotification, from: "testNotification")
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|