peddler 5.0.0 → 5.1.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 +6 -6
- data/lib/peddler/acronyms.rb +1 -0
- data/lib/peddler/api.rb +35 -62
- data/lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rb +11 -11
- data/lib/peddler/apis/aplus_content_2020_11_01.rb +10 -10
- data/lib/peddler/apis/application_integrations_2024_04_01.rb +3 -3
- data/lib/peddler/apis/application_management_2023_11_30.rb +1 -1
- data/lib/peddler/apis/catalog_items_2020_12_01.rb +2 -2
- data/lib/peddler/apis/catalog_items_2022_04_01.rb +2 -2
- data/lib/peddler/apis/catalog_items_v0.rb +1 -1
- data/lib/peddler/apis/data_kiosk_2023_11_15.rb +5 -5
- data/lib/peddler/apis/delivery_by_amazon_2022_07_01/error.rb +23 -0
- data/lib/peddler/apis/delivery_by_amazon_2022_07_01/error_list.rb +18 -0
- data/lib/peddler/apis/delivery_by_amazon_2022_07_01/get_invoice_status_response.rb +26 -0
- data/lib/peddler/apis/delivery_by_amazon_2022_07_01/submit_invoice_request.rb +31 -0
- data/lib/peddler/apis/delivery_by_amazon_2022_07_01/submit_invoice_response.rb +17 -0
- data/lib/peddler/apis/delivery_by_amazon_2022_07_01.rb +59 -0
- data/lib/peddler/apis/easy_ship_2022_03_23.rb +5 -5
- data/lib/peddler/apis/external_fulfillment_shipments_2024_09_11/shipment.rb +3 -0
- data/lib/peddler/apis/fba_inbound_eligibility_v1.rb +1 -1
- data/lib/peddler/apis/fba_inventory_v1.rb +1 -1
- data/lib/peddler/apis/feeds_2021_06_30.rb +6 -6
- data/lib/peddler/apis/finances_2024_06_19/amazon_pay_context.rb +2 -2
- data/lib/peddler/apis/finances_2024_06_19/breakdown.rb +3 -4
- data/lib/peddler/apis/finances_2024_06_19/context.rb +11 -11
- data/lib/peddler/apis/finances_2024_06_19/contexts.rb +1 -1
- data/lib/peddler/apis/finances_2024_06_19/deferred_context.rb +1 -1
- data/lib/peddler/apis/finances_2024_06_19/error.rb +1 -1
- data/lib/peddler/apis/finances_2024_06_19/error_list.rb +1 -1
- data/lib/peddler/apis/finances_2024_06_19/item.rb +3 -3
- data/lib/peddler/apis/finances_2024_06_19/item_related_identifier.rb +1 -1
- data/lib/peddler/apis/finances_2024_06_19/item_related_identifiers.rb +1 -1
- data/lib/peddler/apis/finances_2024_06_19/items.rb +1 -1
- data/lib/peddler/apis/finances_2024_06_19/marketplace_details.rb +2 -3
- data/lib/peddler/apis/finances_2024_06_19/payments_context.rb +5 -5
- data/lib/peddler/apis/finances_2024_06_19/product_context.rb +4 -4
- data/lib/peddler/apis/finances_2024_06_19/related_identifier.rb +2 -2
- data/lib/peddler/apis/finances_2024_06_19/selling_partner_metadata.rb +3 -3
- data/lib/peddler/apis/finances_2024_06_19/time_range_context.rb +3 -3
- data/lib/peddler/apis/finances_2024_06_19/transaction.rb +8 -10
- data/lib/peddler/apis/finances_2024_06_19/transactions.rb +1 -1
- data/lib/peddler/apis/finances_2024_06_19/transactions_payload.rb +4 -2
- data/lib/peddler/apis/finances_2024_06_19.rb +24 -13
- data/lib/peddler/apis/finances_v0/adhoc_disbursement_event.rb +1 -3
- data/lib/peddler/apis/finances_v0/adjustment_event.rb +11 -18
- data/lib/peddler/apis/finances_v0/adjustment_item.rb +3 -3
- data/lib/peddler/apis/finances_v0/affordability_expense_event.rb +6 -7
- data/lib/peddler/apis/finances_v0/capacity_reservation_billing_event.rb +1 -1
- data/lib/peddler/apis/finances_v0/charge_component.rb +37 -35
- data/lib/peddler/apis/finances_v0/charge_refund_event.rb +2 -6
- data/lib/peddler/apis/finances_v0/coupon_payment_event.rb +1 -1
- data/lib/peddler/apis/finances_v0/debt_recovery_event.rb +1 -5
- data/lib/peddler/apis/finances_v0/debt_recovery_item.rb +4 -4
- data/lib/peddler/apis/finances_v0/direct_payment.rb +7 -7
- data/lib/peddler/apis/finances_v0/ebt_refund_reimbursement_only_event.rb +23 -0
- data/lib/peddler/apis/finances_v0/ebt_refund_reimbursement_only_event_list.rb +18 -0
- data/lib/peddler/apis/finances_v0/failed_adhoc_disbursement_event.rb +3 -9
- data/lib/peddler/apis/finances_v0/failed_adhoc_disbursement_event_list.rb +1 -1
- data/lib/peddler/apis/finances_v0/fba_liquidation_event.rb +1 -1
- data/lib/peddler/apis/finances_v0/financial_event_group.rb +5 -7
- data/lib/peddler/apis/finances_v0/financial_events.rb +4 -1
- data/lib/peddler/apis/finances_v0/list_financial_event_groups_payload.rb +1 -1
- data/lib/peddler/apis/finances_v0/list_financial_event_groups_response.rb +3 -3
- data/lib/peddler/apis/finances_v0/list_financial_events_payload.rb +1 -1
- data/lib/peddler/apis/finances_v0/list_financial_events_response.rb +3 -3
- data/lib/peddler/apis/finances_v0/loan_servicing_event.rb +3 -3
- data/lib/peddler/apis/finances_v0/network_commingling_transaction_event.rb +3 -3
- data/lib/peddler/apis/finances_v0/pay_with_amazon_event.rb +5 -5
- data/lib/peddler/apis/finances_v0/product_ads_payment_event.rb +4 -4
- data/lib/peddler/apis/finances_v0/removal_shipment_adjustment_event.rb +2 -2
- data/lib/peddler/apis/finances_v0/removal_shipment_adjustment_event_list.rb +1 -1
- data/lib/peddler/apis/finances_v0/removal_shipment_event.rb +2 -2
- data/lib/peddler/apis/finances_v0/removal_shipment_item.rb +5 -6
- data/lib/peddler/apis/finances_v0/removal_shipment_item_adjustment.rb +8 -9
- data/lib/peddler/apis/finances_v0/removal_shipment_item_list.rb +1 -1
- data/lib/peddler/apis/finances_v0/rental_transaction_event.rb +17 -16
- data/lib/peddler/apis/finances_v0/retrocharge_event.rb +2 -2
- data/lib/peddler/apis/finances_v0/retrocharge_event_list.rb +1 -1
- data/lib/peddler/apis/finances_v0/safet_reimbursement_event_list.rb +1 -1
- data/lib/peddler/apis/finances_v0/safet_reimbursement_item_list.rb +1 -1
- data/lib/peddler/apis/finances_v0/seller_deal_payment_event.rb +2 -2
- data/lib/peddler/apis/finances_v0/seller_review_enrollment_payment_event.rb +1 -1
- data/lib/peddler/apis/finances_v0/solution_provider_credit_event.rb +1 -1
- data/lib/peddler/apis/finances_v0/solution_provider_credit_event_list.rb +1 -1
- data/lib/peddler/apis/finances_v0/tax_withheld_component.rb +2 -3
- data/lib/peddler/apis/finances_v0/tax_withholding_event.rb +1 -1
- data/lib/peddler/apis/finances_v0/tax_withholding_event_list.rb +1 -1
- data/lib/peddler/apis/finances_v0/tax_withholding_period.rb +1 -1
- data/lib/peddler/apis/finances_v0/value_added_service_charge_event.rb +1 -3
- data/lib/peddler/apis/finances_v0.rb +60 -47
- data/lib/peddler/apis/fulfillment_inbound_2024_03_20/delivery_window_option.rb +2 -1
- data/lib/peddler/apis/fulfillment_inbound_2024_03_20/selected_delivery_window.rb +2 -1
- data/lib/peddler/apis/fulfillment_inbound_2024_03_20.rb +90 -142
- data/lib/peddler/apis/fulfillment_inbound_v0.rb +6 -6
- data/lib/peddler/apis/fulfillment_outbound_2020_07_01.rb +14 -17
- data/lib/peddler/apis/invoices_2024_06_19.rb +7 -7
- data/lib/peddler/apis/listings_items_2020_09_01.rb +3 -3
- data/lib/peddler/apis/listings_items_2021_08_01.rb +5 -5
- data/lib/peddler/apis/listings_restrictions_2021_08_01.rb +1 -1
- data/lib/peddler/apis/merchant_fulfillment_v0.rb +5 -5
- data/lib/peddler/apis/messaging_v1.rb +11 -11
- data/lib/peddler/apis/notifications_v1.rb +8 -8
- data/lib/peddler/apis/orders_v0/buyer_info.rb +0 -3
- data/lib/peddler/apis/orders_v0/order_buyer_info.rb +0 -3
- data/lib/peddler/apis/orders_v0.rb +12 -15
- data/lib/peddler/apis/product_fees_v0.rb +3 -3
- data/lib/peddler/apis/product_pricing_2022_05_01.rb +2 -2
- data/lib/peddler/apis/product_pricing_v0.rb +6 -6
- data/lib/peddler/apis/product_type_definitions_2020_09_01.rb +2 -2
- data/lib/peddler/apis/replenishment_2022_11_07/get_selling_partner_metrics_response_metric.rb +66 -22
- data/lib/peddler/apis/replenishment_2022_11_07/list_offer_metrics_response_offer.rb +13 -13
- data/lib/peddler/apis/replenishment_2022_11_07.rb +3 -3
- data/lib/peddler/apis/reports_2021_06_30.rb +9 -9
- data/lib/peddler/apis/sales_v1.rb +1 -1
- data/lib/peddler/apis/seller_wallet_2024_03_01/bank_account.rb +23 -18
- data/lib/peddler/apis/seller_wallet_2024_03_01/payee_contact_information.rb +54 -0
- data/lib/peddler/apis/seller_wallet_2024_03_01/transaction.rb +7 -3
- data/lib/peddler/apis/seller_wallet_2024_03_01/transaction_initiation_request.rb +3 -3
- data/lib/peddler/apis/seller_wallet_2024_03_01.rb +7 -2
- data/lib/peddler/apis/sellers_v1.rb +2 -2
- data/lib/peddler/apis/services_v1.rb +17 -17
- data/lib/peddler/apis/shipment_invoicing_v0.rb +3 -3
- data/lib/peddler/apis/shipping_v1.rb +9 -9
- data/lib/peddler/apis/shipping_v2.rb +19 -19
- data/lib/peddler/apis/solicitations_v1.rb +2 -2
- data/lib/peddler/apis/tokens_2021_03_01.rb +1 -1
- data/lib/peddler/apis/transfers_2024_06_01.rb +2 -2
- data/lib/peddler/apis/uploads_2020_11_01.rb +1 -1
- data/lib/peddler/apis/vendor_direct_fulfillment_inventory_v1.rb +1 -1
- data/lib/peddler/apis/vendor_direct_fulfillment_orders_2021_12_28.rb +3 -3
- data/lib/peddler/apis/vendor_direct_fulfillment_orders_v1.rb +3 -3
- data/lib/peddler/apis/vendor_direct_fulfillment_payments_v1.rb +1 -1
- data/lib/peddler/apis/vendor_direct_fulfillment_shipping_2021_12_28.rb +11 -11
- data/lib/peddler/apis/vendor_direct_fulfillment_shipping_v1.rb +9 -9
- data/lib/peddler/apis/vendor_direct_fulfillment_transactions_2021_12_28.rb +1 -1
- data/lib/peddler/apis/vendor_direct_fulfillment_transactions_v1.rb +1 -1
- data/lib/peddler/apis/vendor_invoices_v1.rb +1 -1
- data/lib/peddler/apis/vendor_orders_v1.rb +4 -4
- data/lib/peddler/apis/vendor_shipments_v1/package_item_details.rb +16 -0
- data/lib/peddler/apis/vendor_shipments_v1/regulation_references.rb +32 -0
- data/lib/peddler/apis/vendor_shipments_v1.rb +5 -5
- data/lib/peddler/apis/vendor_transaction_status_v1.rb +1 -1
- data/lib/peddler/data_kiosk/economics20240315/analytics_economics20240315.rb +5 -0
- data/lib/peddler/data_kiosk/economics20240315.json +340 -7
- data/lib/peddler/data_kiosk/vendor_analytics20240930/traffic.rb +5 -0
- data/lib/peddler/data_kiosk/vendor_analytics20240930.json +12 -0
- data/lib/peddler/response.rb +1 -1
- data/lib/peddler/version.rb +1 -1
- data/lib/peddler.rb +2 -0
- data/sig/peddler/api.rbs +13 -23
- data/sig/peddler/apis/delivery_by_amazon_2022_07_01.rbs +85 -0
- data/sig/peddler/apis/external_fulfillment_shipments_2024_09_11.rbs +8 -7
- data/sig/peddler/apis/finances_2024_06_19.rbs +1 -1
- data/sig/peddler/apis/finances_v0.rbs +30 -7
- data/sig/peddler/apis/fulfillment_inbound_2024_03_20.rbs +45 -45
- data/sig/peddler/apis/fulfillment_outbound_2020_07_01.rbs +1 -1
- data/sig/peddler/apis/orders_v0.rbs +15 -17
- data/sig/peddler/apis/replenishment_2022_11_07.rbs +18 -7
- data/sig/peddler/apis/seller_wallet_2024_03_01.rbs +49 -42
- data/sig/peddler/apis/vendor_shipments_v1.rbs +30 -41
- data/sig/peddler/data_kiosk/economics20240315.rbs +8 -7
- data/sig/peddler/data_kiosk/vendor_analytics20240930.rbs +8 -7
- data/sig/peddler.rbs +4 -0
- metadata +13 -5
- data/lib/peddler/apis/seller_wallet_2024_03_01/account_holder_address.rb +0 -36
- data/lib/peddler/apis/vendor_shipments_v1/packed_quantity.rb +0 -25
- data/lib/peddler/apis/vendor_shipments_v1/purchase_order_item_details.rb +0 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3f362f15da3720ad6fc66a8e7a5911ada910cdc6d5e62f519f05eec36b5af402
|
|
4
|
+
data.tar.gz: 1dfb82c0e522b4b8a41ea7f5157ebcf61122b268fb82782dc6a7e732f5167859
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a3978110f4fdd529c4d4573b4d98b96c70a754b4d572574f2d7edc7d9ecf3f2a937d3aceb4cfd3644bf335019aa7eb627a626a4f1e3957615b276e763edb9d0f
|
|
7
|
+
data.tar.gz: 5fb1efa5eb91109a4cbab3140b23d8aace6598143d9cc1437cb8151f232e9168c76c0b0d2d8d59b9b84240dd28363fe1f191d886e8bf49a3386d495f1216b8f6
|
data/README.md
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
[][build]
|
|
4
4
|
|
|
5
|
-
> AI Agents: See [llms.txt](llms.txt)
|
|
6
|
-
|
|
7
5
|
Peddler is a Ruby interface to the [Amazon Selling Partner API (SP-API)][api-docs]. The SP-API enables Amazon sellers and vendors to programmatically access their data on orders, shipments, payments, and more.
|
|
8
6
|
|
|
9
7
|
Peddler is automatically generated from the latest Open API models provided by Amazon.
|
|
@@ -11,7 +9,7 @@ Peddler is automatically generated from the latest Open API models provided by A
|
|
|
11
9
|
To begin using the Amazon SP-API, you must [register as a developer][register-as-developer] and [register your application][register-application]. Once registered, [obtain your Login with Amazon (LWA) credentials][view-credentials] to access your own or other selling partners' data.
|
|
12
10
|
|
|
13
11
|
- [API docs][api-docs]
|
|
14
|
-
- [
|
|
12
|
+
- [OpenAPI models][openapi-models]
|
|
15
13
|
- [API samples][api-samples]
|
|
16
14
|
|
|
17
15
|
<img src="https://github.com/hakanensari/peddler/blob/main/images/peddler.jpg?raw=true" alt="Peddler" style="max-width: 830px" />
|
|
@@ -98,7 +96,7 @@ api.get_orders("...": "...")
|
|
|
98
96
|
|
|
99
97
|
### Typed Responses
|
|
100
98
|
|
|
101
|
-
Peddler provides typed response parsing using the [Structure gem](https://github.com/hakanensari/structure), offering runtime type checking and better IDE support. Types are based on Ruby's [Data class](https://docs.ruby-lang.org/en/
|
|
99
|
+
Peddler provides typed response parsing using the [Structure gem](https://github.com/hakanensari/structure), offering runtime type checking and better IDE support. Types are based on Ruby's [Data class](https://docs.ruby-lang.org/en/4.0/Data.html) and are lazy-loaded.
|
|
102
100
|
|
|
103
101
|
```ruby
|
|
104
102
|
api = Peddler.orders.new(aws_region, access_token)
|
|
@@ -288,7 +286,7 @@ Detailed workflows are available in test files with VCR cassettes:
|
|
|
288
286
|
|
|
289
287
|
For complete method signatures, see [sig/peddler/apis/](sig/peddler/apis/)
|
|
290
288
|
|
|
291
|
-
For a complete list of available APIs and their detailed documentation, refer to the [API models repository][
|
|
289
|
+
For a complete list of available APIs and their detailed documentation, refer to the [API models repository][openapi-models].
|
|
292
290
|
|
|
293
291
|
## Development
|
|
294
292
|
|
|
@@ -310,11 +308,13 @@ bundle exec rake generate
|
|
|
310
308
|
bundle exec steep check --severity-level=hint
|
|
311
309
|
```
|
|
312
310
|
|
|
311
|
+
> AI Agents: See [llms.txt](llms.txt)
|
|
312
|
+
|
|
313
313
|
[build]: https://github.com/lineofflight/peddler/actions
|
|
314
314
|
[api-docs]: https://developer.amazonservices.com/sp-api-docs/overview
|
|
315
315
|
[register-as-developer]: https://developer-docs.amazon.com/sp-api/docs/registering-as-a-developer
|
|
316
316
|
[register-application]: https://developer-docs.amazon.com/sp-api/docs/registering-your-application
|
|
317
|
-
[
|
|
317
|
+
[openapi-models]: https://github.com/amzn/selling-partner-api-models
|
|
318
318
|
[api-samples]: https://github.com/amzn/selling-partner-api-samples
|
|
319
319
|
[view-credentials]: https://developer-docs.amazon.com/sp-api/docs/viewing-your-application-information-and-credentials
|
|
320
320
|
[authorization]: https://developer-docs.amazon.com/sp-api/docs/authorizing-selling-partner-api-applications
|
data/lib/peddler/acronyms.rb
CHANGED
data/lib/peddler/api.rb
CHANGED
|
@@ -23,10 +23,12 @@ module Peddler
|
|
|
23
23
|
# @param [String] aws_region The AWS region to use for the endpoint
|
|
24
24
|
# @param [String] access_token The access token for authentication
|
|
25
25
|
# @param [Integer] retries The number of retries if throttled (default: 0)
|
|
26
|
-
|
|
26
|
+
# @param [HTTP::Client] http HTTP client
|
|
27
|
+
def initialize(aws_region, access_token, retries: 0, http: HTTP)
|
|
27
28
|
@endpoint = Endpoint.find(aws_region)
|
|
28
29
|
@access_token = access_token
|
|
29
30
|
@retries = retries
|
|
31
|
+
@http = http
|
|
30
32
|
@sandbox = false
|
|
31
33
|
end
|
|
32
34
|
|
|
@@ -52,77 +54,50 @@ module Peddler
|
|
|
52
54
|
# @see https://developer-docs.amazon.com/sp-api/docs/include-a-user-agent-header-in-all-requests
|
|
53
55
|
# @see https://developer-docs.amazon.com/amazon-shipping/docs/connecting-to-the-selling-partner-api#step-3-add-headers-to-the-uri
|
|
54
56
|
# @return [HTTP::Client]
|
|
55
|
-
def http
|
|
56
|
-
@http
|
|
57
|
+
def http(rate_limit: nil)
|
|
58
|
+
client = @http.headers(
|
|
57
59
|
"Host" => endpoint_uri.host,
|
|
58
60
|
"User-Agent" => user_agent,
|
|
59
61
|
"X-Amz-Access-Token" => access_token,
|
|
62
|
+
"X-Amz-Date" => timestamp,
|
|
60
63
|
)
|
|
64
|
+
|
|
65
|
+
return client if retries.zero? || rate_limit.nil?
|
|
66
|
+
|
|
67
|
+
delay = sandbox? ? 0.2 : 1.0 / rate_limit
|
|
68
|
+
client.retriable(delay:, tries: retries + 1, retry_statuses: [429]) # steep:ignore NoMethod
|
|
61
69
|
end
|
|
62
70
|
|
|
63
|
-
|
|
64
|
-
#
|
|
65
|
-
# @param [Float] requests_per_second
|
|
66
|
-
# @return [self]
|
|
67
|
-
def meter(requests_per_second)
|
|
68
|
-
return self if retries.zero?
|
|
69
|
-
return self if requests_per_second.nil?
|
|
71
|
+
private
|
|
70
72
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
def get(path, rate_limit: nil, parser: nil, **options)
|
|
74
|
+
request(:get, path, rate_limit:, parser:, **options)
|
|
75
|
+
end
|
|
73
76
|
|
|
74
|
-
|
|
77
|
+
def post(path, rate_limit: nil, parser: nil, **options)
|
|
78
|
+
request(:post, path, rate_limit:, parser:, **options)
|
|
75
79
|
end
|
|
76
80
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
#
|
|
80
|
-
# @param features
|
|
81
|
-
# @return [self]
|
|
82
|
-
#
|
|
83
|
-
# @!method via(*proxy)
|
|
84
|
-
# Make a request through an HTTP proxy
|
|
85
|
-
#
|
|
86
|
-
# @param [Array] proxy
|
|
87
|
-
# @raise [HTTP::Request::Error] if HTTP proxy is invalid
|
|
88
|
-
# @return [self]
|
|
89
|
-
#
|
|
90
|
-
# @!method retriable(**options)
|
|
91
|
-
# Retries requests if they fail due to socket or `5xx` errors
|
|
92
|
-
#
|
|
93
|
-
# @param (see Performer#initialize)
|
|
94
|
-
# @return [self]
|
|
95
|
-
[:via, :use, :retriable].each do |method|
|
|
96
|
-
define_method(method) do |*args, **kwargs, &block|
|
|
97
|
-
# @type self: API
|
|
98
|
-
# @type var kwargs: Hash[Symbol, untyped]
|
|
99
|
-
@http = http.send(method, *args, **kwargs, &block)
|
|
100
|
-
self
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
[:get, :post, :put, :delete, :patch].each do |method|
|
|
105
|
-
define_method(method) do |path, parser: nil, **options|
|
|
106
|
-
# @type self: API
|
|
107
|
-
# @type var parser: untyped
|
|
108
|
-
# @type var options: Hash[Symbol, untyped]
|
|
109
|
-
if options[:body] && !options[:body].is_a?(String)
|
|
110
|
-
options[:json] = options.delete(:body)
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
uri = endpoint_uri.tap do |uri|
|
|
114
|
-
uri.path = path
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
http_response = http
|
|
118
|
-
.headers("X-Amz-Date" => timestamp)
|
|
119
|
-
.send(method, uri, **options)
|
|
120
|
-
|
|
121
|
-
Response.wrap(http_response, parser:)
|
|
122
|
-
end
|
|
81
|
+
def put(path, rate_limit: nil, parser: nil, **options)
|
|
82
|
+
request(:put, path, rate_limit:, parser:, **options)
|
|
123
83
|
end
|
|
124
84
|
|
|
125
|
-
|
|
85
|
+
def delete(path, rate_limit: nil, parser: nil, **options)
|
|
86
|
+
request(:delete, path, rate_limit:, parser:, **options)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def patch(path, rate_limit: nil, parser: nil, **options)
|
|
90
|
+
request(:patch, path, rate_limit:, parser:, **options)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def request(method, path, rate_limit: nil, parser: nil, **options)
|
|
94
|
+
options[:json] = options.delete(:body) if options[:body] && !options[:body].is_a?(String)
|
|
95
|
+
|
|
96
|
+
uri = endpoint_uri.tap { |u| u.path = path }
|
|
97
|
+
http_response = http(rate_limit:).send(method, uri, **options)
|
|
98
|
+
|
|
99
|
+
Response.wrap(http_response, parser:)
|
|
100
|
+
end
|
|
126
101
|
|
|
127
102
|
def cannot_sandbox!
|
|
128
103
|
raise CannotSandbox, "cannot run in a sandbox" if sandbox?
|
|
@@ -140,12 +115,10 @@ module Peddler
|
|
|
140
115
|
Time.now.utc.strftime("%Y%m%dT%H%M%SZ")
|
|
141
116
|
end
|
|
142
117
|
|
|
143
|
-
# Encodes URL path components
|
|
144
118
|
def percent_encode(component)
|
|
145
119
|
URI.encode_uri_component(component)
|
|
146
120
|
end
|
|
147
121
|
|
|
148
|
-
# Converts an array to a comma-separated string, or returns the value as-is if not an array
|
|
149
122
|
def stringify_array(val)
|
|
150
123
|
val.is_a?(Array) ? val.join(",") : val
|
|
151
124
|
end
|
|
@@ -21,7 +21,7 @@ module Peddler
|
|
|
21
21
|
def create_inbound(body, rate_limit: 1.0)
|
|
22
22
|
path = "/awd/2024-05-09/inboundOrders"
|
|
23
23
|
parser = -> { InboundOrderReference }
|
|
24
|
-
|
|
24
|
+
post(path, body:, rate_limit:, parser:)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
# Retrieves an AWD inbound order.
|
|
@@ -33,7 +33,7 @@ module Peddler
|
|
|
33
33
|
def get_inbound(order_id, rate_limit: 2.0)
|
|
34
34
|
path = "/awd/2024-05-09/inboundOrders/#{percent_encode(order_id)}"
|
|
35
35
|
parser = -> { InboundOrder }
|
|
36
|
-
|
|
36
|
+
get(path, rate_limit:, parser:)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
# Updates an AWD inbound order that is in `DRAFT` status and not yet confirmed. Use this operation to update the
|
|
@@ -46,7 +46,7 @@ module Peddler
|
|
|
46
46
|
# @return [Peddler::Response] The API response
|
|
47
47
|
def update_inbound(order_id, body, rate_limit: 1.0)
|
|
48
48
|
path = "/awd/2024-05-09/inboundOrders/#{percent_encode(order_id)}"
|
|
49
|
-
|
|
49
|
+
put(path, body:, rate_limit:)
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
# Cancels an AWD Inbound order and its associated shipment.
|
|
@@ -57,7 +57,7 @@ module Peddler
|
|
|
57
57
|
# @return [Peddler::Response] The API response
|
|
58
58
|
def cancel_inbound(order_id, rate_limit: 1.0)
|
|
59
59
|
path = "/awd/2024-05-09/inboundOrders/#{percent_encode(order_id)}/cancellation"
|
|
60
|
-
|
|
60
|
+
post(path, rate_limit:)
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
# Confirms an AWD inbound order in `DRAFT` status.
|
|
@@ -68,7 +68,7 @@ module Peddler
|
|
|
68
68
|
# @return [Peddler::Response] The API response
|
|
69
69
|
def confirm_inbound(order_id, rate_limit: 1.0)
|
|
70
70
|
path = "/awd/2024-05-09/inboundOrders/#{percent_encode(order_id)}/confirmation"
|
|
71
|
-
|
|
71
|
+
post(path, rate_limit:)
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
# Retrieves an AWD inbound shipment.
|
|
@@ -85,7 +85,7 @@ module Peddler
|
|
|
85
85
|
"skuQuantities" => sku_quantities,
|
|
86
86
|
}.compact
|
|
87
87
|
parser = -> { InboundShipment }
|
|
88
|
-
|
|
88
|
+
get(path, params:, rate_limit:, parser:)
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
# Retrieves the box labels for a shipment ID that you specify. This is an asynchronous operation. If the label
|
|
@@ -105,7 +105,7 @@ module Peddler
|
|
|
105
105
|
"formatType" => format_type,
|
|
106
106
|
}.compact
|
|
107
107
|
parser = -> { ShipmentLabels }
|
|
108
|
-
|
|
108
|
+
get(path, params:, rate_limit:, parser:)
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
# Updates transport details for an AWD shipment.
|
|
@@ -117,7 +117,7 @@ module Peddler
|
|
|
117
117
|
# @return [Peddler::Response] The API response
|
|
118
118
|
def update_inbound_shipment_transport_details(shipment_id, body, rate_limit: 1.0)
|
|
119
119
|
path = "/awd/2024-05-09/inboundShipments/#{percent_encode(shipment_id)}/transport"
|
|
120
|
-
|
|
120
|
+
put(path, body:, rate_limit:)
|
|
121
121
|
end
|
|
122
122
|
|
|
123
123
|
# Determines if the packages you specify are eligible for an AWD inbound order and contains error details for
|
|
@@ -130,7 +130,7 @@ module Peddler
|
|
|
130
130
|
def check_inbound_eligibility(body, rate_limit: 1.0)
|
|
131
131
|
path = "/awd/2024-05-09/inboundEligibility"
|
|
132
132
|
parser = -> { InboundEligibility }
|
|
133
|
-
|
|
133
|
+
post(path, body:, rate_limit:, parser:)
|
|
134
134
|
end
|
|
135
135
|
|
|
136
136
|
# Retrieves a summary of all the inbound AWD shipments associated with a merchant, with the ability to apply
|
|
@@ -166,7 +166,7 @@ module Peddler
|
|
|
166
166
|
"nextToken" => next_token,
|
|
167
167
|
}.compact
|
|
168
168
|
parser = -> { ShipmentListing }
|
|
169
|
-
|
|
169
|
+
get(path, params:, rate_limit:, parser:)
|
|
170
170
|
end
|
|
171
171
|
|
|
172
172
|
# Lists AWD inventory associated with a merchant with the ability to apply optional filters.
|
|
@@ -194,7 +194,7 @@ module Peddler
|
|
|
194
194
|
"maxResults" => max_results,
|
|
195
195
|
}.compact
|
|
196
196
|
parser = -> { InventoryListing }
|
|
197
|
-
|
|
197
|
+
get(path, params:, rate_limit:, parser:)
|
|
198
198
|
end
|
|
199
199
|
end
|
|
200
200
|
end
|
|
@@ -31,7 +31,7 @@ module Peddler
|
|
|
31
31
|
"pageToken" => page_token,
|
|
32
32
|
}.compact
|
|
33
33
|
parser = -> { SearchContentDocumentsResponse }
|
|
34
|
-
|
|
34
|
+
get(path, params:, rate_limit:, parser:)
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
# Creates a new A+ Content document.
|
|
@@ -51,7 +51,7 @@ module Peddler
|
|
|
51
51
|
"marketplaceId" => marketplace_id,
|
|
52
52
|
}.compact
|
|
53
53
|
parser = -> { PostContentDocumentResponse }
|
|
54
|
-
|
|
54
|
+
post(path, body:, params:, rate_limit:, parser:)
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
# Returns an A+ Content document, if available.
|
|
@@ -74,7 +74,7 @@ module Peddler
|
|
|
74
74
|
"includedDataSet" => stringify_array(included_data_set),
|
|
75
75
|
}.compact
|
|
76
76
|
parser = -> { GetContentDocumentResponse }
|
|
77
|
-
|
|
77
|
+
get(path, params:, rate_limit:, parser:)
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
# Updates an existing A+ Content document.
|
|
@@ -98,7 +98,7 @@ module Peddler
|
|
|
98
98
|
"marketplaceId" => marketplace_id,
|
|
99
99
|
}.compact
|
|
100
100
|
parser = -> { PostContentDocumentResponse }
|
|
101
|
-
|
|
101
|
+
post(path, body:, params:, rate_limit:, parser:)
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
# Returns a list of ASINs that are related to the specified A+ Content document, if available. If you don't
|
|
@@ -129,7 +129,7 @@ module Peddler
|
|
|
129
129
|
"pageToken" => page_token,
|
|
130
130
|
}.compact
|
|
131
131
|
parser = -> { ListContentDocumentASINRelationsResponse }
|
|
132
|
-
|
|
132
|
+
get(path, params:, rate_limit:, parser:)
|
|
133
133
|
end
|
|
134
134
|
|
|
135
135
|
# Replaces all ASINs related to the specified A+ Content document, if available. This operation can add or remove
|
|
@@ -156,7 +156,7 @@ module Peddler
|
|
|
156
156
|
"marketplaceId" => marketplace_id,
|
|
157
157
|
}.compact
|
|
158
158
|
parser = -> { PostContentDocumentASINRelationsResponse }
|
|
159
|
-
|
|
159
|
+
post(path, body:, params:, rate_limit:, parser:)
|
|
160
160
|
end
|
|
161
161
|
|
|
162
162
|
# Checks if the A+ Content document is valid for use on a set of ASINs.
|
|
@@ -179,7 +179,7 @@ module Peddler
|
|
|
179
179
|
"asinSet" => stringify_array(asin_set),
|
|
180
180
|
}.compact
|
|
181
181
|
parser = -> { ValidateContentDocumentASINRelationsResponse }
|
|
182
|
-
|
|
182
|
+
post(path, body:, params:, rate_limit:, parser:)
|
|
183
183
|
end
|
|
184
184
|
|
|
185
185
|
# Searches for A+ Content publishing records, if available.
|
|
@@ -203,7 +203,7 @@ module Peddler
|
|
|
203
203
|
"pageToken" => page_token,
|
|
204
204
|
}.compact
|
|
205
205
|
parser = -> { SearchContentPublishRecordsResponse }
|
|
206
|
-
|
|
206
|
+
get(path, params:, rate_limit:, parser:)
|
|
207
207
|
end
|
|
208
208
|
|
|
209
209
|
# Submits an A+ Content document for review, approval, and publishing.
|
|
@@ -224,7 +224,7 @@ module Peddler
|
|
|
224
224
|
"marketplaceId" => marketplace_id,
|
|
225
225
|
}.compact
|
|
226
226
|
parser = -> { PostContentDocumentApprovalSubmissionResponse }
|
|
227
|
-
|
|
227
|
+
post(path, params:, rate_limit:, parser:)
|
|
228
228
|
end
|
|
229
229
|
|
|
230
230
|
# Submits a request to suspend visible A+ Content. This doesn't delete the content document or the ASIN relations.
|
|
@@ -245,7 +245,7 @@ module Peddler
|
|
|
245
245
|
"marketplaceId" => marketplace_id,
|
|
246
246
|
}.compact
|
|
247
247
|
parser = -> { PostContentDocumentSuspendSubmissionResponse }
|
|
248
|
-
|
|
248
|
+
post(path, params:, rate_limit:, parser:)
|
|
249
249
|
end
|
|
250
250
|
end
|
|
251
251
|
end
|
|
@@ -20,7 +20,7 @@ module Peddler
|
|
|
20
20
|
def create_notification(body, rate_limit: 1.0)
|
|
21
21
|
path = "/appIntegrations/2024-04-01/notifications"
|
|
22
22
|
parser = -> { CreateNotificationResponse }
|
|
23
|
-
|
|
23
|
+
post(path, body:, rate_limit:, parser:)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
# Remove your application's notifications from the Appstore notifications dashboard.
|
|
@@ -31,7 +31,7 @@ module Peddler
|
|
|
31
31
|
# @return [Peddler::Response] The API response
|
|
32
32
|
def delete_notifications(body, rate_limit: 1.0)
|
|
33
33
|
path = "/appIntegrations/2024-04-01/notifications/deletion"
|
|
34
|
-
|
|
34
|
+
post(path, body:, rate_limit:)
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
# Records the seller's response to a notification.
|
|
@@ -43,7 +43,7 @@ module Peddler
|
|
|
43
43
|
# @return [Peddler::Response] The API response
|
|
44
44
|
def record_action_feedback(notification_id, body, rate_limit: 1.0)
|
|
45
45
|
path = "/appIntegrations/2024-04-01/notifications/#{percent_encode(notification_id)}/feedback"
|
|
46
|
-
|
|
46
|
+
post(path, body:, rate_limit:)
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
end
|
|
@@ -49,7 +49,7 @@ module Peddler
|
|
|
49
49
|
"locale" => locale,
|
|
50
50
|
}.compact
|
|
51
51
|
parser = -> { ItemSearchResults }
|
|
52
|
-
|
|
52
|
+
get(path, params:, rate_limit:, parser:)
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
# Retrieves details for an item in the Amazon catalog.
|
|
@@ -72,7 +72,7 @@ module Peddler
|
|
|
72
72
|
"locale" => locale,
|
|
73
73
|
}.compact
|
|
74
74
|
parser = -> { Item }
|
|
75
|
-
|
|
75
|
+
get(path, params:, rate_limit:, parser:)
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
78
|
end
|
|
@@ -61,7 +61,7 @@ module Peddler
|
|
|
61
61
|
"keywordsLocale" => keywords_locale,
|
|
62
62
|
}.compact
|
|
63
63
|
parser = -> { ItemSearchResults }
|
|
64
|
-
|
|
64
|
+
get(path, params:, rate_limit:, parser:)
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
# Retrieves details for an item in the Amazon catalog.
|
|
@@ -84,7 +84,7 @@ module Peddler
|
|
|
84
84
|
"locale" => locale,
|
|
85
85
|
}.compact
|
|
86
86
|
parser = -> { Item }
|
|
87
|
-
|
|
87
|
+
get(path, params:, rate_limit:, parser:)
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
90
|
end
|
|
@@ -41,7 +41,7 @@ module Peddler
|
|
|
41
41
|
"paginationToken" => pagination_token,
|
|
42
42
|
}.compact
|
|
43
43
|
parser = -> { GetQueriesResponse }
|
|
44
|
-
|
|
44
|
+
get(path, params:, rate_limit:, parser:)
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
# Creates a Data Kiosk query request.
|
|
@@ -58,7 +58,7 @@ module Peddler
|
|
|
58
58
|
def create_query(body, rate_limit: 0.0167)
|
|
59
59
|
path = "/dataKiosk/2023-11-15/queries"
|
|
60
60
|
parser = -> { CreateQueryResponse }
|
|
61
|
-
|
|
61
|
+
post(path, body:, rate_limit:, parser:)
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
# Cancels the query specified by the `queryId` parameter. Only queries with a non-terminal `processingStatus`
|
|
@@ -73,7 +73,7 @@ module Peddler
|
|
|
73
73
|
# @return [Peddler::Response] The API response
|
|
74
74
|
def cancel_query(query_id, rate_limit: 0.0222)
|
|
75
75
|
path = "/dataKiosk/2023-11-15/queries/#{percent_encode(query_id)}"
|
|
76
|
-
|
|
76
|
+
delete(path, rate_limit:)
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
# Returns query details for the query specified by the `queryId` parameter. See the `createQuery` operation for
|
|
@@ -86,7 +86,7 @@ module Peddler
|
|
|
86
86
|
def get_query(query_id, rate_limit: 2.0)
|
|
87
87
|
path = "/dataKiosk/2023-11-15/queries/#{percent_encode(query_id)}"
|
|
88
88
|
parser = -> { Query }
|
|
89
|
-
|
|
89
|
+
get(path, rate_limit:, parser:)
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
# Returns the information required for retrieving a Data Kiosk document's contents. See the `createQuery`
|
|
@@ -99,7 +99,7 @@ module Peddler
|
|
|
99
99
|
def get_document(document_id, rate_limit: 0.0167)
|
|
100
100
|
path = "/dataKiosk/2023-11-15/documents/#{percent_encode(document_id)}"
|
|
101
101
|
parser = -> { GetDocumentResponse }
|
|
102
|
-
|
|
102
|
+
get(path, rate_limit:, parser:)
|
|
103
103
|
end
|
|
104
104
|
end
|
|
105
105
|
end
|
|
@@ -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 DeliveryByAmazon20220701
|
|
10
|
+
# An error response returned when the request is unsuccessful.
|
|
11
|
+
Error = Structure.new do
|
|
12
|
+
# @return [String] An error code that identifies the type of error that occurred.
|
|
13
|
+
attribute(:code, String)
|
|
14
|
+
|
|
15
|
+
# @return [String] A message that describes the error condition.
|
|
16
|
+
attribute(:message, String)
|
|
17
|
+
|
|
18
|
+
# @return [String] Additional details that can help the caller understand or fix the issue.
|
|
19
|
+
attribute?(:details, String)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is generated. Edit template if necessary.
|
|
4
|
+
|
|
5
|
+
module Peddler
|
|
6
|
+
module APIs
|
|
7
|
+
class DeliveryByAmazon20220701
|
|
8
|
+
# A list of error responses returned when a request is unsuccessful.
|
|
9
|
+
class ErrorList < Array
|
|
10
|
+
class << self
|
|
11
|
+
def parse(array)
|
|
12
|
+
new(array.map { |item| Error.parse(item) })
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
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 DeliveryByAmazon20220701
|
|
10
|
+
# The response schema for the getInvoiceStatus operation.
|
|
11
|
+
GetInvoiceStatusResponse = Structure.new do
|
|
12
|
+
# @return [String] The Amazon-defined order identifier.
|
|
13
|
+
attribute?(:amazon_order_id, String, from: "amazonOrderId")
|
|
14
|
+
|
|
15
|
+
# @return [String] The Amazon-defined shipment identifier.
|
|
16
|
+
attribute?(:amazon_shipment_id, String, from: "amazonShipmentId")
|
|
17
|
+
|
|
18
|
+
# @return [Array<Error>] A list of errors returned by this API.
|
|
19
|
+
attribute?(:errors, [Error])
|
|
20
|
+
|
|
21
|
+
# @return [String] The current processing status of a shipment invoice.
|
|
22
|
+
attribute?(:invoice_status, String, from: "invoiceStatus")
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
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 DeliveryByAmazon20220701
|
|
10
|
+
# The request schema for the `submitInvoice` operation.
|
|
11
|
+
SubmitInvoiceRequest = Structure.new do
|
|
12
|
+
# @return [String] MD5 sum for validating the invoice data. For more information about calculating this value,
|
|
13
|
+
# see [Working with Content-MD5
|
|
14
|
+
# Checksums](https://docs.developer.amazonservices.com/en_US/dev_guide/DG_MD5.html).
|
|
15
|
+
attribute(:content_md5_value, String, from: "contentMD5Value")
|
|
16
|
+
|
|
17
|
+
# @return [String] The binary object representing an invoice's content.
|
|
18
|
+
attribute(:invoice_content, String, from: "invoiceContent")
|
|
19
|
+
|
|
20
|
+
# @return [String] The type of an invoice.
|
|
21
|
+
attribute(:invoice_type, String, from: "invoiceType")
|
|
22
|
+
|
|
23
|
+
# @return [String] An Amazon marketplace identifier.
|
|
24
|
+
attribute(:marketplace_id, String, from: "marketplaceId")
|
|
25
|
+
|
|
26
|
+
# @return [String] The Amazon program that the seller is currently enrolled.
|
|
27
|
+
attribute(:program_type, String, from: "programType")
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
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 DeliveryByAmazon20220701
|
|
10
|
+
# The response schema for the submitInvoice operation.
|
|
11
|
+
SubmitInvoiceResponse = Structure.new do
|
|
12
|
+
# @return [Array<Error>] A list of errors returned by this API.
|
|
13
|
+
attribute?(:errors, [Error])
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|