peddler 3.0.0 → 4.0.1

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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -10
  3. data/lib/peddler/api.rb +32 -17
  4. data/lib/peddler/{api → apis}/amazon_warehousing_and_distribution_2024_05_09.rb +5 -5
  5. data/lib/peddler/{api → apis}/aplus_content_2020_11_01.rb +12 -12
  6. data/lib/peddler/{api → apis}/application_integrations_2024_04_01.rb +5 -5
  7. data/lib/peddler/{api → apis}/application_management_2023_11_30.rb +3 -3
  8. data/lib/peddler/{api → apis}/catalog_items_2020_12_01.rb +4 -4
  9. data/lib/peddler/{api → apis}/catalog_items_2022_04_01.rb +5 -5
  10. data/lib/peddler/{api → apis}/catalog_items_v0.rb +5 -5
  11. data/lib/peddler/{api → apis}/data_kiosk_2023_11_15.rb +7 -7
  12. data/lib/peddler/{api → apis}/easy_ship_2022_03_23.rb +20 -21
  13. data/lib/peddler/{api → apis}/fba_inbound_eligibility_v1.rb +3 -3
  14. data/lib/peddler/{api → apis}/fba_inventory_v1.rb +6 -6
  15. data/lib/peddler/{api → apis}/feeds_2021_06_30.rb +12 -9
  16. data/lib/peddler/{api → apis}/finances_2024_06_19.rb +3 -3
  17. data/lib/peddler/apis/finances_v0.rb +135 -0
  18. data/lib/peddler/{api → apis}/fulfillment_inbound_2024_03_20.rb +84 -54
  19. data/lib/peddler/{api → apis}/fulfillment_inbound_v0.rb +27 -20
  20. data/lib/peddler/{api → apis}/fulfillment_outbound_2020_07_01.rb +16 -16
  21. data/lib/peddler/{api → apis}/invoices_2024_06_19.rb +9 -9
  22. data/lib/peddler/{api → apis}/listings_items_2020_09_01.rb +5 -5
  23. data/lib/peddler/{api → apis}/listings_items_2021_08_01.rb +7 -41
  24. data/lib/peddler/{api → apis}/listings_restrictions_2021_08_01.rb +3 -3
  25. data/lib/peddler/{api → apis}/merchant_fulfillment_v0.rb +14 -14
  26. data/lib/peddler/{api → apis}/messaging_v1.rb +15 -15
  27. data/lib/peddler/{api → apis}/notifications_v1.rb +10 -10
  28. data/lib/peddler/{api → apis}/orders_v0.rb +13 -13
  29. data/lib/peddler/{api → apis}/product_fees_v0.rb +5 -5
  30. data/lib/peddler/{api → apis}/product_pricing_2022_05_01.rb +8 -8
  31. data/lib/peddler/{api → apis}/product_pricing_v0.rb +8 -8
  32. data/lib/peddler/{api → apis}/product_type_definitions_2020_09_01.rb +4 -4
  33. data/lib/peddler/{api → apis}/replenishment_2022_11_07.rb +5 -5
  34. data/lib/peddler/{api → apis}/reports_2021_06_30.rb +12 -12
  35. data/lib/peddler/{api → apis}/sales_v1.rb +3 -3
  36. data/lib/peddler/{api → apis}/sellers_v1.rb +4 -4
  37. data/lib/peddler/{api → apis}/services_v1.rb +19 -19
  38. data/lib/peddler/{api → apis}/shipment_invoicing_v0.rb +5 -5
  39. data/lib/peddler/{api → apis}/shipping_v1.rb +11 -11
  40. data/lib/peddler/{api → apis}/shipping_v2.rb +19 -19
  41. data/lib/peddler/{api → apis}/solicitations_v1.rb +4 -4
  42. data/lib/peddler/{api → apis}/supply_sources_2020_07_01.rb +8 -8
  43. data/lib/peddler/{api → apis}/tokens_2021_03_01.rb +3 -3
  44. data/lib/peddler/{api → apis}/uploads_2020_11_01.rb +3 -3
  45. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_inventory_v1.rb +4 -4
  46. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_orders_2021_12_28.rb +5 -5
  47. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_orders_v1.rb +6 -6
  48. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_payments_v1.rb +4 -4
  49. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +9 -9
  50. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_shipping_2021_12_28.rb +17 -17
  51. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_shipping_v1.rb +30 -30
  52. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_transactions_2021_12_28.rb +4 -4
  53. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_transactions_v1.rb +4 -4
  54. data/lib/peddler/{api → apis}/vendor_invoices_v1.rb +4 -4
  55. data/lib/peddler/{api → apis}/vendor_orders_v1.rb +7 -7
  56. data/lib/peddler/{api → apis}/vendor_shipments_v1.rb +6 -6
  57. data/lib/peddler/{api → apis}/vendor_transaction_status_v1.rb +3 -3
  58. data/lib/peddler/endpoint.rb +2 -2
  59. data/lib/peddler/error.rb +21 -12
  60. data/lib/peddler/helpers/feeds_2021_06_30.rb +26 -0
  61. data/lib/peddler/json_feed_document.rb +31 -0
  62. data/lib/peddler/marketplace.rb +46 -2
  63. data/lib/peddler/response.rb +46 -0
  64. data/lib/peddler/version.rb +1 -1
  65. data/lib/peddler.rb +54 -55
  66. metadata +59 -56
  67. data/lib/peddler/api/finances_v0.rb +0 -148
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18b989739aa0f7ab2781e4f2f921b61a6f188ffc72145eb9308e47d3f5072e96
4
- data.tar.gz: 0ea9798e14b2e7474fef0c8b492d43e90d427fee962d4f837fc46722750733b8
3
+ metadata.gz: 9b77e82d88e0346785039821e8aef1e5dc14719e36ac939b817903802fc675a6
4
+ data.tar.gz: db657904ecc6bfaf47702c09500028d0e1ed9ebca2c7b6aa482069523dade394
5
5
  SHA512:
6
- metadata.gz: 9acfcab4a74ef4842c1cb28e94b1a57591caba5080e07a6db34d8f20f69b0d215efdcfb98761fefeaf840cb4a0c91cc574807651c8beb309dbfc91ad66502b05
7
- data.tar.gz: 281d96aa87b0ea0c480282049124c8ed3037e4a31ef8251b7a6cc3e8c17acbb53e8253a41f248a6e3a95eea7c6d3363d740e0d23dffe2b6e1caaf82bbbdbea09
6
+ metadata.gz: b6cb81b4ea08ef72b5b4e30dc331872b011688c6af694b4fad67df00cc3076c9832fbc8a57382c07d2adde0669b604f3ef0a8b33cad73a63c87377f061f0e309
7
+ data.tar.gz: 04e7f28ce2915d764181b5deccfdf9830113ee386adee0dcdef1b7c1c617c2f6f5d85dffef708346b5e3add2907debc3c83fb65a82ed11d581cffc2fe28afe28
data/README.md CHANGED
@@ -4,10 +4,17 @@
4
4
  [![Maintainability](https://api.codeclimate.com/v1/badges/281e6176048f3c0a1ed3/maintainability)][maintainability]
5
5
  [![Test Coverage](https://api.codeclimate.com/v1/badges/281e6176048f3c0a1ed3/test_coverage)][test-coverage]
6
6
 
7
+ > **_NOTE:_** This README explains the main branch, which may contain unreleased code. For the README of the latest release, please refer to [this link][latest-release-readme].
8
+
7
9
  **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
10
 
11
+ Peddler is automatically generated from the Open API models provided by Amazon.
12
+
9
13
  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.
10
14
 
15
+ - [API models][api-models]
16
+ - [API samples][api-samples]
17
+
11
18
  ![Peddler](https://github.com/hakanensari/peddler/blob/main/images/peddler.jpg?raw=true)
12
19
 
13
20
  ## Installation
@@ -15,7 +22,7 @@ To begin using the Amazon SP-API, you must [register as a developer][register-as
15
22
  Add this line to your Gemfile.
16
23
 
17
24
  ```ruby
18
- gem "peddler", "3.0.0.beta1"
25
+ gem "peddler", "~> 4.0"
19
26
  ```
20
27
 
21
28
  And then execute:
@@ -113,7 +120,7 @@ response = api.get_catalog_item(
113
120
  marketplaceIds: ["ATVPDKIKX0DER"],
114
121
  asin: "B08N5WRWNW"
115
122
  )
116
- items = response.parse.dig("items")
123
+ items = response.dig("items")
117
124
  ```
118
125
 
119
126
  #### Orders API (v0)
@@ -126,7 +133,7 @@ response = api.get_orders(
126
133
  marketplaceIds: ["ATVPDKIKX0DER"],
127
134
  createdAfter: "2023-01-01T00:00:00Z"
128
135
  )
129
- response.parse.dig("orders")
136
+ response.dig("orders")
130
137
  ```
131
138
 
132
139
  #### Feeds API (2021-06-30)
@@ -145,7 +152,7 @@ upload_url = response.parse["url"]
145
152
 
146
153
  # Upload the feed content to the provided URL
147
154
  feed_content = File.read("inventory_update.xml")
148
- api.upload_feed_document(upload_url, feed_content)
155
+ api.upload_feed_document(upload_url, feed_content, "text/xml; charset=UTF-8")
149
156
 
150
157
  # Create the feed
151
158
  response = api.create_feed(
@@ -338,7 +345,6 @@ purchase_orders = response.parse["purchaseOrders"]
338
345
 
339
346
  Enables vendors to manage shipping labels and shipping information for direct fulfillment orders.
340
347
 
341
-
342
348
  ```ruby
343
349
  api = Peddler.vendor_direct_fulfillment_shipping_2021_12_28(aws_region, access_token)
344
350
  response = api.get_packing_slip(
@@ -351,7 +357,6 @@ response.parse
351
357
 
352
358
  Allows vendors to receive orders for direct fulfillment and provide shipment confirmations.
353
359
 
354
-
355
360
  ```ruby
356
361
  api = Peddler.vendor_direct_fulfillment_orders_2021_12_28(aws_region, access_token)
357
362
  response = api.get_orders(
@@ -488,17 +493,20 @@ response.parse
488
493
 
489
494
  ## TODO
490
495
 
491
- - Code generate models to parse payload. Consider using `dry-struct`.
492
- - Code generate the APIs section—descriptions and code examples—in this README here.
493
- - Schedule code generation with GitHub Actions. Push new gem when models change.
494
- - Review and consider applying [these patches][patches].
496
+ - [ ] Code generate payload parsers.
497
+ - [ ] Code generate the APIs section—descriptions and code examples—in this README here.
498
+ - [ ] Schedule code generation with GitHub Actions. Push new gem when models change.
499
+ - [ ] Review and consider applying [these patches][patches].
495
500
 
496
501
  [build]: https://github.com/hakanensari/peddler/actions
497
502
  [maintainability]: https://codeclimate.com/github/hakanensari/peddler/maintainability
498
503
  [test-coverage]: https://codeclimate.com/github/hakanensari/peddler/test_coverage
504
+ [latest-release-readme]: https://github.com/lineofflight/peddler/tree/v3.0.0
499
505
  [docs-overview]: https://developer.amazonservices.com/sp-api-docs/overview
500
506
  [register-as-developer]: https://developer-docs.amazon.com/sp-api/docs/registering-as-a-developer
501
507
  [register-application]: https://developer-docs.amazon.com/sp-api/docs/registering-your-application
508
+ [api-models]: https://github.com/amzn/selling-partner-api-models
509
+ [api-samples]: https://github.com/amzn/selling-partner-api-samples
502
510
  [view-credentials]: https://developer-docs.amazon.com/sp-api/docs/viewing-your-application-information-and-credentials
503
511
  [authorization]: https://developer-docs.amazon.com/sp-api/docs/authorizing-selling-partner-api-applications
504
512
  [rate-limits]: https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits
data/lib/peddler/api.rb CHANGED
@@ -4,6 +4,8 @@ require "http"
4
4
 
5
5
  require "peddler/endpoint"
6
6
  require "peddler/error"
7
+ require "peddler/marketplace"
8
+ require "peddler/response"
7
9
  require "peddler/version"
8
10
 
9
11
  module Peddler
@@ -12,6 +14,11 @@ module Peddler
12
14
  class CannotSandbox < StandardError; end
13
15
  class MustSandbox < StandardError; end
14
16
 
17
+ class << self
18
+ # @return [#call]
19
+ attr_accessor :parser
20
+ end
21
+
15
22
  # @return [Peddler::Endpoint]
16
23
  attr_reader :endpoint
17
24
 
@@ -31,6 +38,8 @@ module Peddler
31
38
  sandbox? ? endpoint.sandbox : endpoint.production
32
39
  end
33
40
 
41
+ # Switches to the SP-API sandbox to make test calls
42
+ #
34
43
  # @see https://developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox
35
44
  # @return [self]
36
45
  def sandbox
@@ -43,16 +52,6 @@ module Peddler
43
52
  @sandbox
44
53
  end
45
54
 
46
- # @raise [CannotSandbox] if in a sandbox environment
47
- def cannot_sandbox!
48
- raise CannotSandbox, "cannot run in a sandbox" if sandbox?
49
- end
50
-
51
- # @raise [MustSandbox] unless in a sandbox environment
52
- def must_sandbox!
53
- raise MustSandbox, "must run in a sandbox" unless sandbox?
54
- end
55
-
56
55
  # @see https://developer-docs.amazon.com/sp-api/docs/include-a-user-agent-header-in-all-requests
57
56
  # @see https://developer-docs.amazon.com/amazon-shipping/docs/connecting-to-the-selling-partner-api#step-3-add-headers-to-the-uri
58
57
  # @return [HTTP::Client]
@@ -67,13 +66,13 @@ module Peddler
67
66
 
68
67
  # Throttles with a rate limit and retries when the API returns a 429
69
68
  #
70
- # @param [Float] rate_limit The delay in seconds before retrying
69
+ # @param [Float] requests_per_second
71
70
  # @return [self]
72
- def meter(rate_limit)
71
+ def meter(requests_per_second)
73
72
  # HTTP v6.0 will implement retriable. Until then, point to their GitHub repo, or it's a no-op.
74
73
  # https://github.com/httprb/http/pull/790
75
- delay = sandbox? ? 0.2 : 1.0 / rate_limit
76
- retriable(delay: delay, retry_statuses: [429]) if @http.respond_to?(:retriable)
74
+ delay = sandbox? ? 0.2 : 1.0 / requests_per_second
75
+ retriable(delay: delay, tries: 3, retry_statuses: [429])
77
76
 
78
77
  self
79
78
  end
@@ -97,8 +96,8 @@ module Peddler
97
96
  # @param (see Performer#initialize)
98
97
  # @return [self]
99
98
  [:via, :use, :retriable].each do |method|
100
- define_method(method) do |*args, &block|
101
- @http = http.send(method, *args, &block)
99
+ define_method(method) do |*args, **kwargs, &block|
100
+ @http = http.send(method, *args, **kwargs, &block) if http.respond_to?(method)
102
101
  self
103
102
  end
104
103
  end
@@ -121,12 +120,28 @@ module Peddler
121
120
  raise error if error
122
121
  end
123
122
 
124
- response
123
+ Response.decorate(response, parser:)
125
124
  end
126
125
  end
127
126
 
127
+ attr_writer :parser
128
+
129
+ # @!attribute parser
130
+ # @return [#call]
131
+ def parser
132
+ @parser || self.class.parser
133
+ end
134
+
128
135
  private
129
136
 
137
+ def cannot_sandbox!
138
+ raise CannotSandbox, "cannot run in a sandbox" if sandbox?
139
+ end
140
+
141
+ def must_sandbox!
142
+ raise MustSandbox, "must run in a sandbox" unless sandbox?
143
+ end
144
+
130
145
  def user_agent
131
146
  "Peddler/#{Peddler::VERSION} (Language=Ruby; #{Socket.gethostname})"
132
147
  end
@@ -5,11 +5,11 @@ require "peddler/api"
5
5
  module Peddler
6
6
  class << self
7
7
  def amazon_warehousing_and_distribution_2024_05_09(...)
8
- API::AmazonWarehousingAndDistribution20240509.new(...)
8
+ APIs::AmazonWarehousingAndDistribution20240509.new(...)
9
9
  end
10
10
  end
11
11
 
12
- class API
12
+ module APIs
13
13
  # The Selling Partner API for Amazon Warehousing and Distribution
14
14
  #
15
15
  # The Selling Partner API for Amazon Warehousing and Distribution (AWD) provides programmatic access to information
@@ -22,7 +22,7 @@ module Peddler
22
22
  # @param sku_quantities [String] If equal to `SHOW`, the response includes the shipment SKU quantity details.
23
23
  # Defaults to `HIDE`, in which case the response does not contain SKU quantities
24
24
  # @param rate_limit [Float] Requests per second
25
- # @return [Hash] The API response
25
+ # @return [Peddler::Response] The API response
26
26
  def get_inbound_shipment(shipment_id, sku_quantities: nil, rate_limit: 2.0)
27
27
  path = "/awd/2024-05-09/inboundShipments/#{shipment_id}"
28
28
  params = {
@@ -47,7 +47,7 @@ module Peddler
47
47
  # @param max_results [Integer] Maximum number of results to return.
48
48
  # @param next_token [String] Token to retrieve the next set of paginated results.
49
49
  # @param rate_limit [Float] Requests per second
50
- # @return [Hash] The API response
50
+ # @return [Peddler::Response] The API response
51
51
  def list_inbound_shipments(sort_by: nil, sort_order: nil, shipment_status: nil, updated_after: nil,
52
52
  updated_before: nil, max_results: 25, next_token: nil, rate_limit: 1.0)
53
53
  path = "/awd/2024-05-09/inboundShipments"
@@ -74,7 +74,7 @@ module Peddler
74
74
  # @param next_token [String] Token to retrieve the next set of paginated results.
75
75
  # @param max_results [Integer] Maximum number of results to return.
76
76
  # @param rate_limit [Float] Requests per second
77
- # @return [Hash] The API response
77
+ # @return [Peddler::Response] The API response
78
78
  def list_inventory(sku: nil, sort_order: nil, details: nil, next_token: nil, max_results: 25, rate_limit: 2.0)
79
79
  path = "/awd/2024-05-09/inventory"
80
80
  params = {
@@ -5,11 +5,11 @@ require "peddler/api"
5
5
  module Peddler
6
6
  class << self
7
7
  def aplus_content_2020_11_01(...)
8
- API::AplusContent20201101.new(...)
8
+ APIs::AplusContent20201101.new(...)
9
9
  end
10
10
  end
11
11
 
12
- class API
12
+ module APIs
13
13
  # Selling Partner API for A+ Content Management
14
14
  #
15
15
  # With the A+ Content API, you can build applications that help selling partners add rich marketing content to their
@@ -28,7 +28,7 @@ module Peddler
28
28
  # other parameter will cause the request to fail. When no nextPageToken value is returned there are no more
29
29
  # pages to return. A pageToken value is not usable across different operations.
30
30
  # @param rate_limit [Float] Requests per second
31
- # @return [Hash] The API response
31
+ # @return [Peddler::Response] The API response
32
32
  def search_content_documents(marketplace_id, page_token: nil, rate_limit: 10.0)
33
33
  cannot_sandbox!
34
34
 
@@ -46,7 +46,7 @@ module Peddler
46
46
  # @param marketplace_id [String] The identifier for the marketplace where the A+ Content is published.
47
47
  # @param post_content_document_request [Hash] The content document request details.
48
48
  # @param rate_limit [Float] Requests per second
49
- # @return [Hash] The API response
49
+ # @return [Peddler::Response] The API response
50
50
  def create_content_document(marketplace_id, post_content_document_request, rate_limit: 10.0)
51
51
  cannot_sandbox!
52
52
 
@@ -67,7 +67,7 @@ module Peddler
67
67
  # @param marketplace_id [String] The identifier for the marketplace where the A+ Content is published.
68
68
  # @param included_data_set [Array<String>] The set of A+ Content data types to include in the response.
69
69
  # @param rate_limit [Float] Requests per second
70
- # @return [Hash] The API response
70
+ # @return [Peddler::Response] The API response
71
71
  def get_content_document(content_reference_key, marketplace_id, included_data_set, rate_limit: 10.0)
72
72
  cannot_sandbox!
73
73
 
@@ -88,7 +88,7 @@ module Peddler
88
88
  # @param marketplace_id [String] The identifier for the marketplace where the A+ Content is published.
89
89
  # @param post_content_document_request [Hash] The content document request details.
90
90
  # @param rate_limit [Float] Requests per second
91
- # @return [Hash] The API response
91
+ # @return [Peddler::Response] The API response
92
92
  def update_content_document(content_reference_key, marketplace_id, post_content_document_request,
93
93
  rate_limit: 10.0)
94
94
  cannot_sandbox!
@@ -118,7 +118,7 @@ module Peddler
118
118
  # other parameter will cause the request to fail. When no nextPageToken value is returned there are no more
119
119
  # pages to return. A pageToken value is not usable across different operations.
120
120
  # @param rate_limit [Float] Requests per second
121
- # @return [Hash] The API response
121
+ # @return [Peddler::Response] The API response
122
122
  def list_content_document_asin_relations(content_reference_key, marketplace_id, included_data_set: nil,
123
123
  asin_set: nil, page_token: nil, rate_limit: 10.0)
124
124
  cannot_sandbox!
@@ -144,7 +144,7 @@ module Peddler
144
144
  # @param marketplace_id [String] The identifier for the marketplace where the A+ Content is published.
145
145
  # @param post_content_document_asin_relations_request [Hash] The content document ASIN relations request details.
146
146
  # @param rate_limit [Float] Requests per second
147
- # @return [Hash] The API response
147
+ # @return [Peddler::Response] The API response
148
148
  def post_content_document_asin_relations(content_reference_key, marketplace_id,
149
149
  post_content_document_asin_relations_request, rate_limit: 10.0)
150
150
  cannot_sandbox!
@@ -164,7 +164,7 @@ module Peddler
164
164
  # @param asin_set [Array<String>] The set of ASINs.
165
165
  # @param post_content_document_request [Hash] The content document request details.
166
166
  # @param rate_limit [Float] Requests per second
167
- # @return [Hash] The API response
167
+ # @return [Peddler::Response] The API response
168
168
  def validate_content_document_asin_relations(marketplace_id, post_content_document_request, asin_set: nil,
169
169
  rate_limit: 10.0)
170
170
  cannot_sandbox!
@@ -189,7 +189,7 @@ module Peddler
189
189
  # other parameter will cause the request to fail. When no nextPageToken value is returned there are no more
190
190
  # pages to return. A pageToken value is not usable across different operations.
191
191
  # @param rate_limit [Float] Requests per second
192
- # @return [Hash] The API response
192
+ # @return [Peddler::Response] The API response
193
193
  def search_content_publish_records(marketplace_id, asin, page_token: nil, rate_limit: 10.0)
194
194
  cannot_sandbox!
195
195
 
@@ -210,7 +210,7 @@ module Peddler
210
210
  # any A+ content identifier.
211
211
  # @param marketplace_id [String] The identifier for the marketplace where the A+ Content is published.
212
212
  # @param rate_limit [Float] Requests per second
213
- # @return [Hash] The API response
213
+ # @return [Peddler::Response] The API response
214
214
  def post_content_document_approval_submission(content_reference_key, marketplace_id, rate_limit: 10.0)
215
215
  cannot_sandbox!
216
216
 
@@ -230,7 +230,7 @@ module Peddler
230
230
  # any A+ content identifier.
231
231
  # @param marketplace_id [String] The identifier for the marketplace where the A+ Content is published.
232
232
  # @param rate_limit [Float] Requests per second
233
- # @return [Hash] The API response
233
+ # @return [Peddler::Response] The API response
234
234
  def post_content_document_suspend_submission(content_reference_key, marketplace_id, rate_limit: 10.0)
235
235
  cannot_sandbox!
236
236
 
@@ -5,11 +5,11 @@ require "peddler/api"
5
5
  module Peddler
6
6
  class << self
7
7
  def application_integrations_2024_04_01(...)
8
- API::ApplicationIntegrations20240401.new(...)
8
+ APIs::ApplicationIntegrations20240401.new(...)
9
9
  end
10
10
  end
11
11
 
12
- class API
12
+ module APIs
13
13
  # The Selling Partner API for third party application integrations.
14
14
  #
15
15
  # With the AppIntegrations API v2024-04-01, you can send notifications to Amazon Selling Partners and display the
@@ -20,7 +20,7 @@ module Peddler
20
20
  # @note This operation can make a static sandbox call.
21
21
  # @param body [Hash] The request body for the `createNotification` operation.
22
22
  # @param rate_limit [Float] Requests per second
23
- # @return [Hash] The API response
23
+ # @return [Peddler::Response] The API response
24
24
  def create_notification(body, rate_limit: 1.0)
25
25
  path = "/appIntegrations/2024-04-01/notifications"
26
26
 
@@ -32,7 +32,7 @@ module Peddler
32
32
  # @note This operation can make a static sandbox call.
33
33
  # @param body [Hash] The request body for the `deleteNotifications` operation.
34
34
  # @param rate_limit [Float] Requests per second
35
- # @return [Hash] The API response
35
+ # @return [Peddler::Response] The API response
36
36
  def delete_notifications(body, rate_limit: 1.0)
37
37
  path = "/appIntegrations/2024-04-01/notifications/deletion"
38
38
 
@@ -45,7 +45,7 @@ module Peddler
45
45
  # @param notification_id [String] A `notificationId` uniquely identifies a notification.
46
46
  # @param body [Hash] The request body for the `recordActionFeedback` operation.
47
47
  # @param rate_limit [Float] Requests per second
48
- # @return [Hash] The API response
48
+ # @return [Peddler::Response] The API response
49
49
  def record_action_feedback(notification_id, body, rate_limit: 1.0)
50
50
  path = "/appIntegrations/2024-04-01/notifications/#{notification_id}/feedback"
51
51
 
@@ -5,11 +5,11 @@ require "peddler/api"
5
5
  module Peddler
6
6
  class << self
7
7
  def application_management_2023_11_30(...)
8
- API::ApplicationManagement20231130.new(...)
8
+ APIs::ApplicationManagement20231130.new(...)
9
9
  end
10
10
  end
11
11
 
12
- class API
12
+ module APIs
13
13
  # Selling Partner API for Application Management
14
14
  #
15
15
  # The Selling Partner API for Application Management lets you programmatically update the client secret on
@@ -22,7 +22,7 @@ module Peddler
22
22
  # secret](https://developer-docs.amazon.com/sp-api/v0/docs/application-management-api-v2023-11-30-use-case-guide#tutorial-rotate-your-applications-client-secret).
23
23
  #
24
24
  # @param rate_limit [Float] Requests per second
25
- # @return [Hash] The API response
25
+ # @return [Peddler::Response] The API response
26
26
  def rotate_application_client_secret(rate_limit: 0.0167)
27
27
  cannot_sandbox!
28
28
 
@@ -5,11 +5,11 @@ require "peddler/api"
5
5
  module Peddler
6
6
  class << self
7
7
  def catalog_items_2020_12_01(...)
8
- API::CatalogItems20201201.new(...)
8
+ APIs::CatalogItems20201201.new(...)
9
9
  end
10
10
  end
11
11
 
12
- class API
12
+ module APIs
13
13
  # Selling Partner API for Catalog Items
14
14
  #
15
15
  # The Selling Partner API for Catalog Items provides programmatic access to information about items in the Amazon
@@ -35,7 +35,7 @@ module Peddler
35
35
  # @param locale [String] Locale for retrieving localized summaries. Defaults to the primary locale of the
36
36
  # marketplace.
37
37
  # @param rate_limit [Float] Requests per second
38
- # @return [Hash] The API response
38
+ # @return [Peddler::Response] The API response
39
39
  def search_catalog_items(keywords, marketplace_ids, included_data: "summaries", brand_names: nil,
40
40
  classification_ids: nil, page_size: 10, page_token: nil, keywords_locale: nil, locale: nil, rate_limit: 2.0)
41
41
  path = "/catalog/2020-12-01/items"
@@ -65,7 +65,7 @@ module Peddler
65
65
  # @param locale [String] Locale for retrieving localized summaries. Defaults to the primary locale of the
66
66
  # marketplace.
67
67
  # @param rate_limit [Float] Requests per second
68
- # @return [Hash] The API response
68
+ # @return [Peddler::Response] The API response
69
69
  def get_catalog_item(asin, marketplace_ids, included_data: "summaries", locale: nil, rate_limit: 2.0)
70
70
  path = "/catalog/2020-12-01/items/#{asin}"
71
71
  params = {
@@ -5,12 +5,12 @@ require "peddler/api"
5
5
  module Peddler
6
6
  class << self
7
7
  def catalog_items_2022_04_01(...)
8
- API::CatalogItems20220401.new(...)
8
+ APIs::CatalogItems20220401.new(...)
9
9
  end
10
10
  end
11
11
 
12
- class API
13
- # Selling Partner API for Catalog Items
12
+ module APIs
13
+ # Catalog Items v2022-04-01
14
14
  #
15
15
  # The Selling Partner API for Catalog Items provides programmatic access to information about items in the Amazon
16
16
  # catalog. For more information, refer to the
@@ -43,7 +43,7 @@ module Peddler
43
43
  # @param keywords_locale [String] The language of the keywords provided for `keywords`-based queries. Defaults to
44
44
  # the primary locale of the marketplace. **Note:** Cannot be used with `identifiers`.
45
45
  # @param rate_limit [Float] Requests per second
46
- # @return [Hash] The API response
46
+ # @return [Peddler::Response] The API response
47
47
  def search_catalog_items(marketplace_ids, identifiers: nil, identifiers_type: nil, included_data: ["summaries"],
48
48
  locale: nil, seller_id: nil, keywords: nil, brand_names: nil, classification_ids: nil, page_size: 10,
49
49
  page_token: nil, keywords_locale: nil, rate_limit: 2.0)
@@ -77,7 +77,7 @@ module Peddler
77
77
  # @param locale [String] Locale for retrieving localized summaries. Defaults to the primary locale of the
78
78
  # marketplace.
79
79
  # @param rate_limit [Float] Requests per second
80
- # @return [Hash] The API response
80
+ # @return [Peddler::Response] The API response
81
81
  def get_catalog_item(asin, marketplace_ids, included_data: ["summaries"], locale: nil, rate_limit: 2.0)
82
82
  path = "/catalog/2022-04-01/items/#{asin}"
83
83
  params = {
@@ -5,11 +5,11 @@ require "peddler/api"
5
5
  module Peddler
6
6
  class << self
7
7
  def catalog_items_v0(...)
8
- API::CatalogItemsV0.new(...)
8
+ APIs::CatalogItemsV0.new(...)
9
9
  end
10
10
  end
11
11
 
12
- class API
12
+ module APIs
13
13
  # Selling Partner API for Catalog Items
14
14
  #
15
15
  # The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the
@@ -40,7 +40,7 @@ module Peddler
40
40
  # @param jan [String] A Japanese article number that uniquely identifies the product, manufacturer, and its
41
41
  # attributes.
42
42
  # @param rate_limit [Float] Requests per second
43
- # @return [Hash] The API response
43
+ # @return [Peddler::Response] The API response
44
44
  def list_catalog_items(marketplace_id, query: nil, query_context_id: nil, seller_sku: nil, upc: nil, ean: nil,
45
45
  isbn: nil, jan: nil, rate_limit: nil)
46
46
  path = "/catalog/v0/items"
@@ -69,7 +69,7 @@ module Peddler
69
69
  # @param marketplace_id [String] A marketplace identifier. Specifies the marketplace for the item.
70
70
  # @param asin [String] The Amazon Standard Identification Number (ASIN) of the item.
71
71
  # @param rate_limit [Float] Requests per second
72
- # @return [Hash] The API response
72
+ # @return [Peddler::Response] The API response
73
73
  def get_catalog_item(marketplace_id, asin, rate_limit: nil)
74
74
  path = "/catalog/v0/items/#{asin}"
75
75
  params = {
@@ -87,7 +87,7 @@ module Peddler
87
87
  # @param seller_sku [String] Used to identify items in the given marketplace. SellerSKU is qualified by the
88
88
  # seller's SellerId, which is included with every operation that you submit.
89
89
  # @param rate_limit [Float] Requests per second
90
- # @return [Hash] The API response
90
+ # @return [Peddler::Response] The API response
91
91
  def list_catalog_categories(marketplace_id, asin: nil, seller_sku: nil, rate_limit: 1.0)
92
92
  path = "/catalog/v0/categories"
93
93
  params = {
@@ -5,11 +5,11 @@ require "peddler/api"
5
5
  module Peddler
6
6
  class << self
7
7
  def data_kiosk_2023_11_15(...)
8
- API::DataKiosk20231115.new(...)
8
+ APIs::DataKiosk20231115.new(...)
9
9
  end
10
10
  end
11
11
 
12
- class API
12
+ module APIs
13
13
  # Selling Partner API for Data Kiosk
14
14
  #
15
15
  # The Selling Partner API for Data Kiosk lets you submit GraphQL queries from a variety of schemas to help selling
@@ -31,7 +31,7 @@ module Peddler
31
31
  # with the request that generated this token, with the exception of `pageSize` which can be modified between
32
32
  # calls to `getQueries`. In the absence of this token value, `getQueries` returns the first page of results.
33
33
  # @param rate_limit [Float] Requests per second
34
- # @return [Hash] The API response
34
+ # @return [Peddler::Response] The API response
35
35
  def get_queries(processing_statuses: nil, page_size: 10, created_since: nil, created_until: nil,
36
36
  pagination_token: nil, rate_limit: 0.0222)
37
37
  path = "/dataKiosk/2023-11-15/queries"
@@ -55,7 +55,7 @@ module Peddler
55
55
  # @note This operation can make a static sandbox call.
56
56
  # @param body [Hash] The body of the request.
57
57
  # @param rate_limit [Float] Requests per second
58
- # @return [Hash] The API response
58
+ # @return [Peddler::Response] The API response
59
59
  def create_query(body, rate_limit: 0.0167)
60
60
  path = "/dataKiosk/2023-11-15/queries"
61
61
 
@@ -71,7 +71,7 @@ module Peddler
71
71
  # @param query_id [String] The identifier for the query. This identifier is unique only in combination with a
72
72
  # selling partner account ID.
73
73
  # @param rate_limit [Float] Requests per second
74
- # @return [Hash] The API response
74
+ # @return [Peddler::Response] The API response
75
75
  def cancel_query(query_id, rate_limit: 0.0222)
76
76
  path = "/dataKiosk/2023-11-15/queries/#{query_id}"
77
77
 
@@ -84,7 +84,7 @@ module Peddler
84
84
  # @note This operation can make a static sandbox call.
85
85
  # @param query_id [String] The query identifier.
86
86
  # @param rate_limit [Float] Requests per second
87
- # @return [Hash] The API response
87
+ # @return [Peddler::Response] The API response
88
88
  def get_query(query_id, rate_limit: 2.0)
89
89
  path = "/dataKiosk/2023-11-15/queries/#{query_id}"
90
90
 
@@ -97,7 +97,7 @@ module Peddler
97
97
  # @note This operation can make a static sandbox call.
98
98
  # @param document_id [String] The identifier for the Data Kiosk document.
99
99
  # @param rate_limit [Float] Requests per second
100
- # @return [Hash] The API response
100
+ # @return [Peddler::Response] The API response
101
101
  def get_document(document_id, rate_limit: 0.0167)
102
102
  path = "/dataKiosk/2023-11-15/documents/#{document_id}"
103
103