peddler 4.3.1 → 4.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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +459 -109
  3. data/lib/peddler/api.rb +13 -11
  4. data/lib/peddler/apis/amazon_warehousing_and_distribution_2024_05_09.rb +7 -7
  5. data/lib/peddler/apis/aplus_content_2020_11_01.rb +10 -10
  6. data/lib/peddler/apis/application_integrations_2024_04_01.rb +1 -1
  7. data/lib/peddler/apis/catalog_items_2020_12_01.rb +8 -8
  8. data/lib/peddler/apis/catalog_items_2022_04_01.rb +9 -9
  9. data/lib/peddler/apis/customer_feedback_2024_06_01.rb +143 -0
  10. data/lib/peddler/apis/data_kiosk_2023_11_15.rb +4 -4
  11. data/lib/peddler/apis/fba_inbound_eligibility_v1.rb +1 -1
  12. data/lib/peddler/apis/fba_inventory_v1.rb +3 -3
  13. data/lib/peddler/apis/feeds_2021_06_30.rb +6 -6
  14. data/lib/peddler/apis/finances_2024_06_01.rb +1 -1
  15. data/lib/peddler/apis/finances_2024_06_19.rb +14 -6
  16. data/lib/peddler/apis/finances_v0.rb +2 -2
  17. data/lib/peddler/apis/fulfillment_inbound_2024_03_20.rb +40 -40
  18. data/lib/peddler/apis/fulfillment_inbound_v0.rb +8 -8
  19. data/lib/peddler/apis/fulfillment_outbound_2020_07_01.rb +7 -7
  20. data/lib/peddler/apis/invoices_2024_06_19.rb +4 -4
  21. data/lib/peddler/apis/listings_items_2020_09_01.rb +6 -6
  22. data/lib/peddler/apis/listings_items_2021_08_01.rb +20 -26
  23. data/lib/peddler/apis/listings_restrictions_2021_08_01.rb +1 -1
  24. data/lib/peddler/apis/merchant_fulfillment_v0.rb +2 -2
  25. data/lib/peddler/apis/messaging_v1.rb +26 -26
  26. data/lib/peddler/apis/notifications_v1.rb +6 -6
  27. data/lib/peddler/apis/orders_v0.rb +20 -20
  28. data/lib/peddler/apis/product_fees_v0.rb +2 -2
  29. data/lib/peddler/apis/product_pricing_v0.rb +6 -6
  30. data/lib/peddler/apis/product_type_definitions_2020_09_01.rb +4 -4
  31. data/lib/peddler/apis/reports_2021_06_30.rb +12 -9
  32. data/lib/peddler/apis/sales_v1.rb +7 -2
  33. data/lib/peddler/apis/seller_wallet_2024_03_01.rb +5 -5
  34. data/lib/peddler/apis/services_v1.rb +27 -27
  35. data/lib/peddler/apis/shipment_invoicing_v0.rb +3 -3
  36. data/lib/peddler/apis/shipping_v1.rb +5 -5
  37. data/lib/peddler/apis/shipping_v2.rb +6 -6
  38. data/lib/peddler/apis/solicitations_v1.rb +4 -4
  39. data/lib/peddler/apis/supply_sources_2020_07_01.rb +4 -4
  40. data/lib/peddler/apis/uploads_2020_11_01.rb +2 -2
  41. data/lib/peddler/apis/vendor_direct_fulfillment_inventory_v1.rb +1 -1
  42. data/lib/peddler/apis/vendor_direct_fulfillment_orders_2021_12_28.rb +1 -1
  43. data/lib/peddler/apis/vendor_direct_fulfillment_orders_v1.rb +1 -1
  44. data/lib/peddler/apis/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +1 -1
  45. data/lib/peddler/apis/vendor_direct_fulfillment_shipping_2021_12_28.rb +4 -4
  46. data/lib/peddler/apis/vendor_direct_fulfillment_shipping_v1.rb +3 -3
  47. data/lib/peddler/apis/vendor_direct_fulfillment_transactions_2021_12_28.rb +1 -1
  48. data/lib/peddler/apis/vendor_direct_fulfillment_transactions_v1.rb +1 -1
  49. data/lib/peddler/apis/vendor_orders_v1.rb +1 -1
  50. data/lib/peddler/apis/vendor_shipments_v1.rb +1 -1
  51. data/lib/peddler/apis/vendor_transaction_status_v1.rb +1 -1
  52. data/lib/peddler/config.rb +17 -0
  53. data/lib/peddler/error.rb +35 -8
  54. data/lib/peddler/helpers/feeds_2021_06_30.rb +22 -8
  55. data/lib/peddler/helpers/reports_2021_06_30.rb +38 -0
  56. data/lib/peddler/marketplace.rb +14 -0
  57. data/lib/peddler/response.rb +52 -5
  58. data/lib/peddler/token.rb +4 -15
  59. data/lib/peddler/version.rb +1 -1
  60. data/lib/peddler.rb +54 -0
  61. metadata +8 -13
  62. data/lib/peddler/parsers/openapi_parser_generator.rb +0 -550
  63. data/lib/peddler/parsers/smart_parser.rb +0 -199
data/lib/peddler/api.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "http"
4
+ require "uri"
4
5
 
5
6
  require "peddler/endpoint"
6
- require "peddler/error"
7
7
  require "peddler/marketplace"
8
8
  require "peddler/response"
9
9
  require "peddler/version"
@@ -78,8 +78,6 @@ module Peddler
78
78
  def meter(requests_per_second)
79
79
  return self if retries.zero?
80
80
 
81
- # HTTP v6.0 will implement retriable. Until then, point to their GitHub repo, or it's a no-op.
82
- # https://github.com/httprb/http/pull/790
83
81
  delay = sandbox? ? 0.2 : 1.0 / requests_per_second
84
82
  retriable(delay:, tries: retries + 1, retry_statuses: [429])
85
83
 
@@ -106,7 +104,7 @@ module Peddler
106
104
  # @return [self]
107
105
  [:via, :use, :retriable].each do |method|
108
106
  define_method(method) do |*args, **kwargs, &block|
109
- @http = http.send(method, *args, **kwargs, &block) if http.respond_to?(method)
107
+ @http = http.send(method, *args, **kwargs, &block)
110
108
  self
111
109
  end
112
110
  end
@@ -123,13 +121,7 @@ module Peddler
123
121
  end
124
122
 
125
123
  response = http.send(method, uri, **options)
126
-
127
- if response.status.client_error?
128
- error = Error.build(response)
129
- raise error if error
130
- end
131
-
132
- Response.decorate(response, parser:)
124
+ Response.wrap(response, parser:)
133
125
  end
134
126
  end
135
127
 
@@ -158,5 +150,15 @@ module Peddler
158
150
  def timestamp
159
151
  Time.now.utc.strftime("%Y%m%dT%H%M%SZ")
160
152
  end
153
+
154
+ # Encodes URL path components
155
+ def percent_encode(component)
156
+ URI.encode_uri_component(component)
157
+ end
158
+
159
+ # Converts an array to a comma-separated string, or returns the value as-is if not an array
160
+ def stringify_array(val)
161
+ val.is_a?(Array) ? val.join(",") : val
162
+ end
161
163
  end
162
164
  end
@@ -35,7 +35,7 @@ module Peddler
35
35
  # @param rate_limit [Float] Requests per second
36
36
  # @return [Peddler::Response] The API response
37
37
  def get_inbound(order_id, rate_limit: 2.0)
38
- path = "/awd/2024-05-09/inboundOrders/#{order_id}"
38
+ path = "/awd/2024-05-09/inboundOrders/#{percent_encode(order_id)}"
39
39
 
40
40
  meter(rate_limit).get(path)
41
41
  end
@@ -49,7 +49,7 @@ module Peddler
49
49
  # @param rate_limit [Float] Requests per second
50
50
  # @return [Peddler::Response] The API response
51
51
  def update_inbound(order_id, body, rate_limit: 1.0)
52
- path = "/awd/2024-05-09/inboundOrders/#{order_id}"
52
+ path = "/awd/2024-05-09/inboundOrders/#{percent_encode(order_id)}"
53
53
 
54
54
  meter(rate_limit).put(path, body:)
55
55
  end
@@ -61,7 +61,7 @@ module Peddler
61
61
  # @param rate_limit [Float] Requests per second
62
62
  # @return [Peddler::Response] The API response
63
63
  def cancel_inbound(order_id, rate_limit: 1.0)
64
- path = "/awd/2024-05-09/inboundOrders/#{order_id}/cancellation"
64
+ path = "/awd/2024-05-09/inboundOrders/#{percent_encode(order_id)}/cancellation"
65
65
 
66
66
  meter(rate_limit).post(path)
67
67
  end
@@ -73,7 +73,7 @@ module Peddler
73
73
  # @param rate_limit [Float] Requests per second
74
74
  # @return [Peddler::Response] The API response
75
75
  def confirm_inbound(order_id, rate_limit: 1.0)
76
- path = "/awd/2024-05-09/inboundOrders/#{order_id}/confirmation"
76
+ path = "/awd/2024-05-09/inboundOrders/#{percent_encode(order_id)}/confirmation"
77
77
 
78
78
  meter(rate_limit).post(path)
79
79
  end
@@ -87,7 +87,7 @@ module Peddler
87
87
  # @param rate_limit [Float] Requests per second
88
88
  # @return [Peddler::Response] The API response
89
89
  def get_inbound_shipment(shipment_id, sku_quantities: nil, rate_limit: 2.0)
90
- path = "/awd/2024-05-09/inboundShipments/#{shipment_id}"
90
+ path = "/awd/2024-05-09/inboundShipments/#{percent_encode(shipment_id)}"
91
91
  params = {
92
92
  "skuQuantities" => sku_quantities,
93
93
  }.compact
@@ -106,7 +106,7 @@ module Peddler
106
106
  # @param rate_limit [Float] Requests per second
107
107
  # @return [Peddler::Response] The API response
108
108
  def get_inbound_shipment_labels(shipment_id, page_type: nil, format_type: nil, rate_limit: 1.0)
109
- path = "/awd/2024-05-09/inboundShipments/#{shipment_id}/labels"
109
+ path = "/awd/2024-05-09/inboundShipments/#{percent_encode(shipment_id)}/labels"
110
110
  params = {
111
111
  "pageType" => page_type,
112
112
  "formatType" => format_type,
@@ -123,7 +123,7 @@ module Peddler
123
123
  # @param rate_limit [Float] Requests per second
124
124
  # @return [Peddler::Response] The API response
125
125
  def update_inbound_shipment_transport_details(shipment_id, body, rate_limit: 1.0)
126
- path = "/awd/2024-05-09/inboundShipments/#{shipment_id}/transport"
126
+ path = "/awd/2024-05-09/inboundShipments/#{percent_encode(shipment_id)}/transport"
127
127
 
128
128
  meter(rate_limit).put(path, body:)
129
129
  end
@@ -72,10 +72,10 @@ module Peddler
72
72
  def get_content_document(content_reference_key, marketplace_id, included_data_set, rate_limit: 10.0)
73
73
  cannot_sandbox!
74
74
 
75
- path = "/aplus/2020-11-01/contentDocuments/#{content_reference_key}"
75
+ path = "/aplus/2020-11-01/contentDocuments/#{percent_encode(content_reference_key)}"
76
76
  params = {
77
77
  "marketplaceId" => marketplace_id,
78
- "includedDataSet" => included_data_set,
78
+ "includedDataSet" => stringify_array(included_data_set),
79
79
  }.compact
80
80
 
81
81
  meter(rate_limit).get(path, params:)
@@ -96,7 +96,7 @@ module Peddler
96
96
  rate_limit: 10.0)
97
97
  cannot_sandbox!
98
98
 
99
- path = "/aplus/2020-11-01/contentDocuments/#{content_reference_key}"
99
+ path = "/aplus/2020-11-01/contentDocuments/#{percent_encode(content_reference_key)}"
100
100
  body = post_content_document_request
101
101
  params = {
102
102
  "marketplaceId" => marketplace_id,
@@ -125,11 +125,11 @@ module Peddler
125
125
  asin_set: nil, page_token: nil, rate_limit: 10.0)
126
126
  cannot_sandbox!
127
127
 
128
- path = "/aplus/2020-11-01/contentDocuments/#{content_reference_key}/asins"
128
+ path = "/aplus/2020-11-01/contentDocuments/#{percent_encode(content_reference_key)}/asins"
129
129
  params = {
130
130
  "marketplaceId" => marketplace_id,
131
- "includedDataSet" => included_data_set,
132
- "asinSet" => asin_set,
131
+ "includedDataSet" => stringify_array(included_data_set),
132
+ "asinSet" => stringify_array(asin_set),
133
133
  "pageToken" => page_token,
134
134
  }.compact
135
135
 
@@ -154,7 +154,7 @@ module Peddler
154
154
  post_content_document_asin_relations_request, rate_limit: 10.0)
155
155
  cannot_sandbox!
156
156
 
157
- path = "/aplus/2020-11-01/contentDocuments/#{content_reference_key}/asins"
157
+ path = "/aplus/2020-11-01/contentDocuments/#{percent_encode(content_reference_key)}/asins"
158
158
  body = post_content_document_asin_relations_request
159
159
  params = {
160
160
  "marketplaceId" => marketplace_id,
@@ -180,7 +180,7 @@ module Peddler
180
180
  body = post_content_document_request
181
181
  params = {
182
182
  "marketplaceId" => marketplace_id,
183
- "asinSet" => asin_set,
183
+ "asinSet" => stringify_array(asin_set),
184
184
  }.compact
185
185
 
186
186
  meter(rate_limit).post(path, body:, params:)
@@ -223,7 +223,7 @@ module Peddler
223
223
  def post_content_document_approval_submission(content_reference_key, marketplace_id, rate_limit: 10.0)
224
224
  cannot_sandbox!
225
225
 
226
- path = "/aplus/2020-11-01/contentDocuments/#{content_reference_key}/approvalSubmissions"
226
+ path = "/aplus/2020-11-01/contentDocuments/#{percent_encode(content_reference_key)}/approvalSubmissions"
227
227
  params = {
228
228
  "marketplaceId" => marketplace_id,
229
229
  }.compact
@@ -244,7 +244,7 @@ module Peddler
244
244
  def post_content_document_suspend_submission(content_reference_key, marketplace_id, rate_limit: 10.0)
245
245
  cannot_sandbox!
246
246
 
247
- path = "/aplus/2020-11-01/contentDocuments/#{content_reference_key}/suspendSubmissions"
247
+ path = "/aplus/2020-11-01/contentDocuments/#{percent_encode(content_reference_key)}/suspendSubmissions"
248
248
  params = {
249
249
  "marketplaceId" => marketplace_id,
250
250
  }.compact
@@ -47,7 +47,7 @@ module Peddler
47
47
  # @param rate_limit [Float] Requests per second
48
48
  # @return [Peddler::Response] The API response
49
49
  def record_action_feedback(notification_id, body, rate_limit: 1.0)
50
- path = "/appIntegrations/2024-04-01/notifications/#{notification_id}/feedback"
50
+ path = "/appIntegrations/2024-04-01/notifications/#{percent_encode(notification_id)}/feedback"
51
51
 
52
52
  meter(rate_limit).post(path, body:)
53
53
  end
@@ -40,11 +40,11 @@ module Peddler
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"
42
42
  params = {
43
- "keywords" => keywords,
44
- "marketplaceIds" => marketplace_ids,
45
- "includedData" => included_data,
46
- "brandNames" => brand_names,
47
- "classificationIds" => classification_ids,
43
+ "keywords" => stringify_array(keywords),
44
+ "marketplaceIds" => stringify_array(marketplace_ids),
45
+ "includedData" => stringify_array(included_data),
46
+ "brandNames" => stringify_array(brand_names),
47
+ "classificationIds" => stringify_array(classification_ids),
48
48
  "pageSize" => page_size,
49
49
  "pageToken" => page_token,
50
50
  "keywordsLocale" => keywords_locale,
@@ -67,10 +67,10 @@ module Peddler
67
67
  # @param rate_limit [Float] Requests per second
68
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
- path = "/catalog/2020-12-01/items/#{asin}"
70
+ path = "/catalog/2020-12-01/items/#{percent_encode(asin)}"
71
71
  params = {
72
- "marketplaceIds" => marketplace_ids,
73
- "includedData" => included_data,
72
+ "marketplaceIds" => stringify_array(marketplace_ids),
73
+ "includedData" => stringify_array(included_data),
74
74
  "locale" => locale,
75
75
  }.compact
76
76
 
@@ -50,15 +50,15 @@ module Peddler
50
50
  page_token: nil, keywords_locale: nil, rate_limit: 5.0)
51
51
  path = "/catalog/2022-04-01/items"
52
52
  params = {
53
- "identifiers" => identifiers,
53
+ "identifiers" => stringify_array(identifiers),
54
54
  "identifiersType" => identifiers_type,
55
- "marketplaceIds" => marketplace_ids,
56
- "includedData" => included_data,
55
+ "marketplaceIds" => stringify_array(marketplace_ids),
56
+ "includedData" => stringify_array(included_data),
57
57
  "locale" => locale,
58
58
  "sellerId" => seller_id,
59
- "keywords" => keywords,
60
- "brandNames" => brand_names,
61
- "classificationIds" => classification_ids,
59
+ "keywords" => stringify_array(keywords),
60
+ "brandNames" => stringify_array(brand_names),
61
+ "classificationIds" => stringify_array(classification_ids),
62
62
  "pageSize" => page_size,
63
63
  "pageToken" => page_token,
64
64
  "keywordsLocale" => keywords_locale,
@@ -80,10 +80,10 @@ module Peddler
80
80
  # @param rate_limit [Float] Requests per second
81
81
  # @return [Peddler::Response] The API response
82
82
  def get_catalog_item(asin, marketplace_ids, included_data: ["summaries"], locale: nil, rate_limit: 5.0)
83
- path = "/catalog/2022-04-01/items/#{asin}"
83
+ path = "/catalog/2022-04-01/items/#{percent_encode(asin)}"
84
84
  params = {
85
- "marketplaceIds" => marketplace_ids,
86
- "includedData" => included_data,
85
+ "marketplaceIds" => stringify_array(marketplace_ids),
86
+ "includedData" => stringify_array(included_data),
87
87
  "locale" => locale,
88
88
  }.compact
89
89
 
@@ -0,0 +1,143 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def customer_feedback_2024_06_01(...)
8
+ APIs::CustomerFeedback20240601.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
13
+ # The Selling Partner API for CustomerFeedback
14
+ #
15
+ # The Selling Partner API for Customer Feedback (Customer Feedback API) provides information about customer reviews
16
+ # and returns at both the item and browse node level.
17
+ class CustomerFeedback20240601 < API
18
+ # Retrieve an item's ten most positive and ten most negative review topics.
19
+ #
20
+ # @note This operation can make a static sandbox call.
21
+ # @param asin [String] The Amazon Standard Identification Number (ASIN) is the unique identifier of a product
22
+ # within a marketplace. The value must be a child ASIN.
23
+ # @param marketplace_id [String] The MarketplaceId is the globally unique identifier of a marketplace, you can
24
+ # refer to the marketplaceId here : https://developer-docs.amazon.com/sp-api/docs/marketplace-ids.
25
+ # @param sort_by [String] The metric by which to sort data in the response.
26
+ # @return [Peddler::Response] The API response
27
+ def get_item_review_topics(asin, marketplace_id, sort_by)
28
+ path = "/customerFeedback/2024-06-01/items/#{percent_encode(asin)}/reviews/topics"
29
+ params = {
30
+ "marketplaceId" => marketplace_id,
31
+ "sortBy" => sort_by,
32
+ }.compact
33
+
34
+ get(path, params:)
35
+ end
36
+
37
+ # This API returns the associated browse node of the requested ASIN. A browse node is a location in a browse tree
38
+ # that is used for navigation, product classification, and website content on the Amazon retail website.
39
+ #
40
+ # @note This operation can make a static sandbox call.
41
+ # @param asin [String] The Amazon Standard Identification Number (ASIN) is the unique identifier of a product
42
+ # within a marketplace.
43
+ # @param marketplace_id [String] The MarketplaceId is the globally unique identifier of a marketplace, you can
44
+ # refer to the marketplaceId here : https://developer-docs.amazon.com/sp-api/docs/marketplace-ids.
45
+ # @return [Peddler::Response] The API response
46
+ def get_item_browse_node(asin, marketplace_id)
47
+ path = "/customerFeedback/2024-06-01/items/#{percent_encode(asin)}/browseNode"
48
+ params = {
49
+ "marketplaceId" => marketplace_id,
50
+ }.compact
51
+
52
+ get(path, params:)
53
+ end
54
+
55
+ # Retrieve a browse node's ten most positive and ten most negative review topics.
56
+ #
57
+ # @note This operation can make a static sandbox call.
58
+ # @param browse_node_id [String] The ID of a browse node. A browse node is a named location in a browse tree that
59
+ # is used for navigation, product classification, and website content.
60
+ # @param marketplace_id [String] The MarketplaceId is the globally unique identifier of a marketplace, you can
61
+ # refer to the marketplaceId here : https://developer-docs.amazon.com/sp-api/docs/marketplace-ids.
62
+ # @param sort_by [String] The metric by which to sort the data in the response.
63
+ # @return [Peddler::Response] The API response
64
+ def get_browse_node_review_topics(browse_node_id, marketplace_id, sort_by)
65
+ path = "/customerFeedback/2024-06-01/browseNodes/#{percent_encode(browse_node_id)}/reviews/topics"
66
+ params = {
67
+ "marketplaceId" => marketplace_id,
68
+ "sortBy" => sort_by,
69
+ }.compact
70
+
71
+ get(path, params:)
72
+ end
73
+
74
+ # Retrieve an item's positive and negative review trends for the past six months.
75
+ #
76
+ # @note This operation can make a static sandbox call.
77
+ # @param asin [String] The Amazon Standard Identification Number (ASIN) is the unique identifier of a product
78
+ # within a marketplace. This API takes child ASIN as an input.
79
+ # @param marketplace_id [String] The MarketplaceId is the globally unique identifier of a marketplace, you can
80
+ # refer to the marketplaceId here : https://developer-docs.amazon.com/sp-api/docs/marketplace-ids.
81
+ # @return [Peddler::Response] The API response
82
+ def get_item_review_trends(asin, marketplace_id)
83
+ path = "/customerFeedback/2024-06-01/items/#{percent_encode(asin)}/reviews/trends"
84
+ params = {
85
+ "marketplaceId" => marketplace_id,
86
+ }.compact
87
+
88
+ get(path, params:)
89
+ end
90
+
91
+ # Retrieve the positive and negative review trends of items in a browse node for the past six months.
92
+ #
93
+ # @note This operation can make a static sandbox call.
94
+ # @param browse_node_id [String] A browse node ID is a unique identifier of a browse node. A browse node is a
95
+ # named location in a browse tree that is used for navigation, product classification, and website content.
96
+ # @param marketplace_id [String] The marketplace ID is the globally unique identifier of a marketplace. For more
97
+ # information, refer to [Marketplace IDs](https://developer-docs.amazon.com/sp-api/docs/marketplace-ids).
98
+ # @return [Peddler::Response] The API response
99
+ def get_browse_node_review_trends(browse_node_id, marketplace_id)
100
+ path = "/customerFeedback/2024-06-01/browseNodes/#{percent_encode(browse_node_id)}/reviews/trends"
101
+ params = {
102
+ "marketplaceId" => marketplace_id,
103
+ }.compact
104
+
105
+ get(path, params:)
106
+ end
107
+
108
+ # Retrieve the topics that customers mention when they return items in a browse node.
109
+ #
110
+ # @note This operation can make a static sandbox call.
111
+ # @param browse_node_id [String] A browse node ID is a unique identifier for a browse node. A browse node is a
112
+ # named location in a browse tree that is used for navigation, product classification, and website content.
113
+ # @param marketplace_id [String] The MarketplaceId is the globally unique identifier of a marketplace, you can
114
+ # refer to the marketplaceId here : https://developer-docs.amazon.com/sp-api/docs/marketplace-ids.
115
+ # @return [Peddler::Response] The API response
116
+ def get_browse_node_return_topics(browse_node_id, marketplace_id)
117
+ path = "/customerFeedback/2024-06-01/browseNodes/#{percent_encode(browse_node_id)}/returns/topics"
118
+ params = {
119
+ "marketplaceId" => marketplace_id,
120
+ }.compact
121
+
122
+ get(path, params:)
123
+ end
124
+
125
+ # Retrieve the trends of topics that customers mention when they return items in a browse node.
126
+ #
127
+ # @note This operation can make a static sandbox call.
128
+ # @param browse_node_id [String] A browse node ID is a unique identifier of a browse node. A browse node is a
129
+ # named location in a browse tree that is used for navigation, product classification, and website content.
130
+ # @param marketplace_id [String] The MarketplaceId is the globally unique identifier of a marketplace, you can
131
+ # refer to the marketplaceId here : https://developer-docs.amazon.com/sp-api/docs/marketplace-ids.
132
+ # @return [Peddler::Response] The API response
133
+ def get_browse_node_return_trends(browse_node_id, marketplace_id)
134
+ path = "/customerFeedback/2024-06-01/browseNodes/#{percent_encode(browse_node_id)}/returns/trends"
135
+ params = {
136
+ "marketplaceId" => marketplace_id,
137
+ }.compact
138
+
139
+ get(path, params:)
140
+ end
141
+ end
142
+ end
143
+ end
@@ -36,7 +36,7 @@ module Peddler
36
36
  pagination_token: nil, rate_limit: 0.0222)
37
37
  path = "/dataKiosk/2023-11-15/queries"
38
38
  params = {
39
- "processingStatuses" => processing_statuses,
39
+ "processingStatuses" => stringify_array(processing_statuses),
40
40
  "pageSize" => page_size,
41
41
  "createdSince" => created_since,
42
42
  "createdUntil" => created_until,
@@ -73,7 +73,7 @@ module Peddler
73
73
  # @param rate_limit [Float] Requests per second
74
74
  # @return [Peddler::Response] The API response
75
75
  def cancel_query(query_id, rate_limit: 0.0222)
76
- path = "/dataKiosk/2023-11-15/queries/#{query_id}"
76
+ path = "/dataKiosk/2023-11-15/queries/#{percent_encode(query_id)}"
77
77
 
78
78
  meter(rate_limit).delete(path)
79
79
  end
@@ -86,7 +86,7 @@ module Peddler
86
86
  # @param rate_limit [Float] Requests per second
87
87
  # @return [Peddler::Response] The API response
88
88
  def get_query(query_id, rate_limit: 2.0)
89
- path = "/dataKiosk/2023-11-15/queries/#{query_id}"
89
+ path = "/dataKiosk/2023-11-15/queries/#{percent_encode(query_id)}"
90
90
 
91
91
  meter(rate_limit).get(path)
92
92
  end
@@ -99,7 +99,7 @@ module Peddler
99
99
  # @param rate_limit [Float] Requests per second
100
100
  # @return [Peddler::Response] The API response
101
101
  def get_document(document_id, rate_limit: 0.0167)
102
- path = "/dataKiosk/2023-11-15/documents/#{document_id}"
102
+ path = "/dataKiosk/2023-11-15/documents/#{percent_encode(document_id)}"
103
103
 
104
104
  meter(rate_limit).get(path)
105
105
  end
@@ -32,7 +32,7 @@ module Peddler
32
32
  def get_item_eligibility_preview(asin, program, marketplace_ids: nil, rate_limit: 1.0)
33
33
  path = "/fba/inbound/v1/eligibility/itemPreview"
34
34
  params = {
35
- "marketplaceIds" => marketplace_ids,
35
+ "marketplaceIds" => stringify_array(marketplace_ids),
36
36
  "asin" => asin,
37
37
  "program" => program,
38
38
  }.compact
@@ -53,10 +53,10 @@ module Peddler
53
53
  "granularityType" => granularity_type,
54
54
  "granularityId" => granularity_id,
55
55
  "startDateTime" => start_date_time,
56
- "sellerSkus" => seller_skus,
56
+ "sellerSkus" => stringify_array(seller_skus),
57
57
  "sellerSku" => seller_sku,
58
58
  "nextToken" => next_token,
59
- "marketplaceIds" => marketplace_ids,
59
+ "marketplaceIds" => stringify_array(marketplace_ids),
60
60
  }.compact
61
61
 
62
62
  meter(rate_limit).get(path, params:)
@@ -89,7 +89,7 @@ module Peddler
89
89
  def delete_inventory_item(seller_sku, marketplace_id)
90
90
  must_sandbox!
91
91
 
92
- path = "/fba/inventory/v1/items/#{seller_sku}"
92
+ path = "/fba/inventory/v1/items/#{percent_encode(seller_sku)}"
93
93
  params = {
94
94
  "marketplaceId" => marketplace_id,
95
95
  }.compact
@@ -41,10 +41,10 @@ module Peddler
41
41
  created_until: nil, next_token: nil, rate_limit: 0.0222)
42
42
  path = "/feeds/2021-06-30/feeds"
43
43
  params = {
44
- "feedTypes" => feed_types,
45
- "marketplaceIds" => marketplace_ids,
44
+ "feedTypes" => stringify_array(feed_types),
45
+ "marketplaceIds" => stringify_array(marketplace_ids),
46
46
  "pageSize" => page_size,
47
- "processingStatuses" => processing_statuses,
47
+ "processingStatuses" => stringify_array(processing_statuses),
48
48
  "createdSince" => created_since,
49
49
  "createdUntil" => created_until,
50
50
  "nextToken" => next_token,
@@ -76,7 +76,7 @@ module Peddler
76
76
  # @param rate_limit [Float] Requests per second
77
77
  # @return [Peddler::Response] The API response
78
78
  def cancel_feed(feed_id, rate_limit: 2.0)
79
- path = "/feeds/2021-06-30/feeds/#{feed_id}"
79
+ path = "/feeds/2021-06-30/feeds/#{percent_encode(feed_id)}"
80
80
 
81
81
  meter(rate_limit).delete(path)
82
82
  end
@@ -89,7 +89,7 @@ module Peddler
89
89
  # @param rate_limit [Float] Requests per second
90
90
  # @return [Peddler::Response] The API response
91
91
  def get_feed(feed_id, rate_limit: 2.0)
92
- path = "/feeds/2021-06-30/feeds/#{feed_id}"
92
+ path = "/feeds/2021-06-30/feeds/#{percent_encode(feed_id)}"
93
93
 
94
94
  meter(rate_limit).get(path)
95
95
  end
@@ -116,7 +116,7 @@ module Peddler
116
116
  # @param rate_limit [Float] Requests per second
117
117
  # @return [Peddler::Response] The API response
118
118
  def get_feed_document(feed_document_id, rate_limit: 0.0222)
119
- path = "/feeds/2021-06-30/documents/#{feed_document_id}"
119
+ path = "/feeds/2021-06-30/documents/#{percent_encode(feed_document_id)}"
120
120
 
121
121
  meter(rate_limit).get(path)
122
122
  end
@@ -43,7 +43,7 @@ module Peddler
43
43
  path = "/finances/transfers/2024-06-01/paymentMethods"
44
44
  params = {
45
45
  "marketplaceId" => marketplace_id,
46
- "paymentMethodTypes" => payment_method_types,
46
+ "paymentMethodTypes" => stringify_array(payment_method_types),
47
47
  }.compact
48
48
 
49
49
  meter(rate_limit).get(path, params:)
@@ -16,27 +16,35 @@ module Peddler
16
16
  # can obtain financial events for a given order or date range without having to wait until a statement period
17
17
  # closes.
18
18
  class Finances20240619 < API
19
- # Returns transactions for the given parameters. It may take up to 48 hours for transactions to appear in your
20
- # transaction events.
19
+ # Returns transactions for the given parameters. Financial events might not include orders from the last 48 hours.
21
20
  #
22
21
  # @note This operation can make a static sandbox call.
23
- # @param posted_after [String] A date used for selecting transactions posted after (or at) a specified time. The
24
- # date-time must be no later than two minutes before the request was submitted, in ISO 8601 date time format.
22
+ # @param posted_after [String] The response includes financial events posted on or after this date. This date must
23
+ # be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The date-time must
24
+ # be more than two minutes before the time of the request.
25
25
  # @param posted_before [String] A date used for selecting transactions posted before (but not at) a specified
26
26
  # time. The date-time must be later than PostedAfter and no later than two minutes before the request was
27
27
  # submitted, in ISO 8601 date time format. If PostedAfter and PostedBefore are more than 180 days apart, no
28
28
  # transactions are returned. You must specify the PostedAfter parameter if you specify the PostedBefore
29
29
  # parameter. Default: Now minus two minutes.
30
- # @param marketplace_id [String] A string token used to select Marketplace ID.
30
+ # @param marketplace_id [String] The identifier of the marketplace from which you want to retrieve transactions.
31
+ # The marketplace ID is the globally unique identifier of a marketplace. To find the ID for your marketplace,
32
+ # refer to [Marketplace IDs](https://developer-docs.amazon.com/sp-api/docs/marketplace-ids).
33
+ # @param transaction_status [String] The status of the transaction. **Possible values:** * `DEFERRED`: the
34
+ # transaction is currently deferred. * `RELEASED`: the transaction is currently released. * `DEFERRED_RELEASED`:
35
+ # the transaction was deferred in the past, but is now released. The status of a deferred transaction is updated
36
+ # to `DEFERRED_RELEASED` when the transaction is released.
31
37
  # @param next_token [String] A string token returned in the response of your previous request.
32
38
  # @param rate_limit [Float] Requests per second
33
39
  # @return [Peddler::Response] The API response
34
- def list_transactions(posted_after, posted_before: nil, marketplace_id: nil, next_token: nil, rate_limit: 0.5)
40
+ def list_transactions(posted_after, posted_before: nil, marketplace_id: nil, transaction_status: nil,
41
+ next_token: nil, rate_limit: 0.5)
35
42
  path = "/finances/2024-06-19/transactions"
36
43
  params = {
37
44
  "postedAfter" => posted_after,
38
45
  "postedBefore" => posted_before,
39
46
  "marketplaceId" => marketplace_id,
47
+ "transactionStatus" => transaction_status,
40
48
  "nextToken" => next_token,
41
49
  }.compact
42
50
 
@@ -69,7 +69,7 @@ module Peddler
69
69
  # @return [Peddler::Response] The API response
70
70
  def list_financial_events_by_group_id(event_group_id, max_results_per_page: 100, posted_after: nil,
71
71
  posted_before: nil, next_token: nil, rate_limit: 0.5)
72
- path = "/finances/v0/financialEventGroups/#{event_group_id}/financialEvents"
72
+ path = "/finances/v0/financialEventGroups/#{percent_encode(event_group_id)}/financialEvents"
73
73
  params = {
74
74
  "MaxResultsPerPage" => max_results_per_page,
75
75
  "PostedAfter" => posted_after,
@@ -91,7 +91,7 @@ module Peddler
91
91
  # @param rate_limit [Float] Requests per second
92
92
  # @return [Peddler::Response] The API response
93
93
  def list_financial_events_by_order_id(order_id, max_results_per_page: 100, next_token: nil, rate_limit: 0.5)
94
- path = "/finances/v0/orders/#{order_id}/financialEvents"
94
+ path = "/finances/v0/orders/#{percent_encode(order_id)}/financialEvents"
95
95
  params = {
96
96
  "MaxResultsPerPage" => max_results_per_page,
97
97
  "NextToken" => next_token,