peddler 3.0.0.beta1 → 4.0.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 (81) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +108 -110
  3. data/lib/peddler/api.rb +56 -18
  4. data/lib/peddler/{api → apis}/amazon_warehousing_and_distribution_2024_05_09.rb +38 -26
  5. data/lib/peddler/{api → apis}/aplus_content_2020_11_01.rb +97 -59
  6. data/lib/peddler/apis/application_integrations_2024_04_01.rb +56 -0
  7. data/lib/peddler/{api → apis}/application_management_2023_11_30.rb +14 -4
  8. data/lib/peddler/{api → apis}/catalog_items_2020_12_01.rb +34 -23
  9. data/lib/peddler/{api → apis}/catalog_items_2022_04_01.rb +39 -29
  10. data/lib/peddler/{api → apis}/catalog_items_v0.rb +43 -30
  11. data/lib/peddler/{api → apis}/data_kiosk_2023_11_15.rb +47 -31
  12. data/lib/peddler/apis/easy_ship_2022_03_23.rb +126 -0
  13. data/lib/peddler/{api → apis}/fba_inbound_eligibility_v1.rb +15 -7
  14. data/lib/peddler/{api → apis}/fba_inventory_v1.rb +45 -29
  15. data/lib/peddler/{api → apis}/feeds_2021_06_30.rb +54 -33
  16. data/lib/peddler/apis/finances_2024_06_19.rb +50 -0
  17. data/lib/peddler/{api → apis}/finances_v0.rb +50 -36
  18. data/lib/peddler/{api → apis}/fulfillment_inbound_2024_03_20.rb +384 -255
  19. data/lib/peddler/{api → apis}/fulfillment_inbound_v0.rb +138 -93
  20. data/lib/peddler/{api → apis}/fulfillment_outbound_2020_07_01.rb +105 -68
  21. data/lib/peddler/apis/invoices_2024_06_19.rb +180 -0
  22. data/lib/peddler/apis/listings_items_2020_09_01.rb +95 -0
  23. data/lib/peddler/apis/listings_items_2021_08_01.rb +136 -0
  24. data/lib/peddler/{api → apis}/listings_restrictions_2021_08_01.rb +21 -11
  25. data/lib/peddler/apis/merchant_fulfillment_v0.rb +80 -0
  26. data/lib/peddler/{api → apis}/messaging_v1.rb +107 -75
  27. data/lib/peddler/{api → apis}/notifications_v1.rb +63 -32
  28. data/lib/peddler/{api → apis}/orders_v0.rb +99 -84
  29. data/lib/peddler/apis/product_fees_v0.rb +77 -0
  30. data/lib/peddler/{api → apis}/product_pricing_2022_05_01.rb +24 -13
  31. data/lib/peddler/{api → apis}/product_pricing_v0.rb +70 -52
  32. data/lib/peddler/{api → apis}/product_type_definitions_2020_09_01.rb +32 -21
  33. data/lib/peddler/{api → apis}/replenishment_2022_11_07.rb +25 -13
  34. data/lib/peddler/{api → apis}/reports_2021_06_30.rb +71 -47
  35. data/lib/peddler/{api → apis}/sales_v1.rb +22 -14
  36. data/lib/peddler/{api → apis}/sellers_v1.rb +19 -7
  37. data/lib/peddler/{api → apis}/services_v1.rb +156 -116
  38. data/lib/peddler/apis/shipment_invoicing_v0.rb +59 -0
  39. data/lib/peddler/apis/shipping_v1.rb +132 -0
  40. data/lib/peddler/{api → apis}/shipping_v2.rb +150 -98
  41. data/lib/peddler/{api → apis}/solicitations_v1.rb +21 -11
  42. data/lib/peddler/apis/supply_sources_2020_07_01.rb +100 -0
  43. data/lib/peddler/{api → apis}/tokens_2021_03_01.rb +15 -7
  44. data/lib/peddler/{api → apis}/uploads_2020_11_01.rb +18 -8
  45. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_inventory_v1.rb +14 -6
  46. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_orders_2021_12_28.rb +33 -21
  47. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_orders_v1.rb +33 -21
  48. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_payments_v1.rb +13 -5
  49. data/lib/peddler/apis/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +45 -0
  50. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_shipping_2021_12_28.rb +86 -60
  51. data/lib/peddler/apis/vendor_direct_fulfillment_shipping_v1.rb +189 -0
  52. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_transactions_2021_12_28.rb +14 -6
  53. data/lib/peddler/{api → apis}/vendor_direct_fulfillment_transactions_v1.rb +14 -6
  54. data/lib/peddler/apis/vendor_invoices_v1.rb +30 -0
  55. data/lib/peddler/{api → apis}/vendor_orders_v1.rb +59 -48
  56. data/lib/peddler/apis/vendor_shipments_v1.rb +132 -0
  57. data/lib/peddler/{api → apis}/vendor_transaction_status_v1.rb +14 -5
  58. data/lib/peddler/endpoint.rb +51 -0
  59. data/lib/peddler/error.rb +21 -11
  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 +93 -0
  63. data/lib/peddler/response.rb +46 -0
  64. data/lib/peddler/token.rb +70 -0
  65. data/lib/peddler/version.rb +1 -1
  66. data/lib/peddler.rb +55 -52
  67. metadata +64 -57
  68. data/lib/peddler/access_token.rb +0 -76
  69. data/lib/peddler/api/easy_ship_2022_03_23.rb +0 -108
  70. data/lib/peddler/api/listings_items_2020_09_01.rb +0 -84
  71. data/lib/peddler/api/listings_items_2021_08_01.rb +0 -154
  72. data/lib/peddler/api/merchant_fulfillment_v0.rb +0 -64
  73. data/lib/peddler/api/product_fees_v0.rb +0 -69
  74. data/lib/peddler/api/shipment_invoicing_v0.rb +0 -46
  75. data/lib/peddler/api/shipping_v1.rb +0 -107
  76. data/lib/peddler/api/supply_sources_2020_07_01.rb +0 -82
  77. data/lib/peddler/api/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +0 -35
  78. data/lib/peddler/api/vendor_direct_fulfillment_shipping_v1.rb +0 -165
  79. data/lib/peddler/api/vendor_invoices_v1.rb +0 -22
  80. data/lib/peddler/api/vendor_shipments_v1.rb +0 -120
  81. data/lib/peddler/region.rb +0 -30
@@ -3,7 +3,13 @@
3
3
  require "peddler/api"
4
4
 
5
5
  module Peddler
6
- class API
6
+ class << self
7
+ def fulfillment_outbound_2020_07_01(...)
8
+ APIs::FulfillmentOutbound20200701.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
7
13
  # Selling Partner APIs for Fulfillment Outbound
8
14
  #
9
15
  # The Selling Partner API for Fulfillment Outbound lets you create applications that help a seller fulfill
@@ -12,82 +18,95 @@ module Peddler
12
18
  class FulfillmentOutbound20200701 < API
13
19
  # Returns a list of fulfillment order previews based on shipping criteria that you specify.
14
20
  #
15
- # @param [Hash] body GetFulfillmentPreviewRequest parameter
16
- # @return [Hash] The API response
17
- def get_fulfillment_preview(body)
21
+ # @note This operation can make a dynamic sandbox call.
22
+ # @param body [Hash] GetFulfillmentPreviewRequest parameter
23
+ # @param rate_limit [Float] Requests per second
24
+ # @return [Peddler::Response] The API response
25
+ def get_fulfillment_preview(body, rate_limit: 2.0)
18
26
  path = "/fba/outbound/2020-07-01/fulfillmentOrders/preview"
19
27
 
20
- rate_limit(2.0).post(path, body:)
28
+ meter(rate_limit).post(path, body:)
21
29
  end
22
30
 
23
31
  # Returns delivery options that include an estimated delivery date and offer expiration, based on criteria that
24
32
  # you specify.
25
33
  #
26
- # @param [Hash] body GetDeliveryOffersRequest parameter
27
- # @return [Hash] The API response
28
- def delivery_offers(body)
34
+ # @note This operation can make a dynamic sandbox call.
35
+ # @param body [Hash] GetDeliveryOffersRequest parameter
36
+ # @param rate_limit [Float] Requests per second
37
+ # @return [Peddler::Response] The API response
38
+ def delivery_offers(body, rate_limit: 5.0)
29
39
  path = "/fba/outbound/2020-07-01/deliveryOffers"
30
40
 
31
- rate_limit(5.0).post(path, body:)
41
+ meter(rate_limit).post(path, body:)
32
42
  end
33
43
 
34
44
  # Returns a list of fulfillment orders fulfilled after (or at) a specified date-time, or indicated by the next
35
45
  # token parameter.
36
46
  #
37
- # @param [String] query_start_date A date used to select fulfillment orders that were last updated after (or at) a
47
+ # @note This operation can make a dynamic sandbox call.
48
+ # @param query_start_date [String] A date used to select fulfillment orders that were last updated after (or at) a
38
49
  # specified time. An update is defined as any change in fulfillment order status, including the creation of a
39
50
  # new fulfillment order.
40
- # @param [String] next_token A string token returned in the response to your previous request.
41
- # @return [Hash] The API response
42
- def list_all_fulfillment_orders(query_start_date: nil, next_token: nil)
51
+ # @param next_token [String] A string token returned in the response to your previous request.
52
+ # @param rate_limit [Float] Requests per second
53
+ # @return [Peddler::Response] The API response
54
+ def list_all_fulfillment_orders(query_start_date: nil, next_token: nil, rate_limit: 2.0)
43
55
  path = "/fba/outbound/2020-07-01/fulfillmentOrders"
44
56
  params = {
45
57
  "queryStartDate" => query_start_date,
46
58
  "nextToken" => next_token,
47
59
  }.compact
48
60
 
49
- rate_limit(2.0).get(path, params:)
61
+ meter(rate_limit).get(path, params:)
50
62
  end
51
63
 
52
64
  # Requests that Amazon ship items from the seller's inventory in Amazon's fulfillment network to a destination
53
65
  # address.
54
66
  #
55
- # @param [Hash] body CreateFulfillmentOrderRequest parameter
56
- # @return [Hash] The API response
57
- def create_fulfillment_order(body)
67
+ # @note This operation can make a dynamic sandbox call.
68
+ # @param body [Hash] CreateFulfillmentOrderRequest parameter
69
+ # @param rate_limit [Float] Requests per second
70
+ # @return [Peddler::Response] The API response
71
+ def create_fulfillment_order(body, rate_limit: 2.0)
58
72
  path = "/fba/outbound/2020-07-01/fulfillmentOrders"
59
73
 
60
- rate_limit(2.0).post(path, body:)
74
+ meter(rate_limit).post(path, body:)
61
75
  end
62
76
 
63
77
  # Returns delivery tracking information for a package in an outbound shipment for a Multi-Channel Fulfillment
64
78
  # order.
65
79
  #
66
- # @param [Integer] package_number The unencrypted package identifier returned by the `getFulfillmentOrder`
80
+ # @note This operation can make a dynamic sandbox call.
81
+ # @param package_number [Integer] The unencrypted package identifier returned by the `getFulfillmentOrder`
67
82
  # operation.
68
- # @return [Hash] The API response
69
- def get_package_tracking_details(package_number)
83
+ # @param rate_limit [Float] Requests per second
84
+ # @return [Peddler::Response] The API response
85
+ def get_package_tracking_details(package_number, rate_limit: 2.0)
70
86
  path = "/fba/outbound/2020-07-01/tracking"
71
87
  params = {
72
88
  "packageNumber" => package_number,
73
89
  }.compact
74
90
 
75
- rate_limit(2.0).get(path, params:)
91
+ meter(rate_limit).get(path, params:)
76
92
  end
77
93
 
78
94
  # Returns a list of return reason codes for a seller SKU in a given marketplace. The parameters for this operation
79
95
  # may contain special characters that require URL encoding. To avoid errors with SKUs when encoding URLs, refer to
80
96
  # [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
81
97
  #
82
- # @param [String] seller_sku The seller SKU for which return reason codes are required.
83
- # @param [String] marketplace_id The marketplace for which the seller wants return reason codes.
84
- # @param [String] seller_fulfillment_order_id The identifier assigned to the item by the seller when the
98
+ # @note This operation can make a dynamic sandbox call.
99
+ # @param seller_sku [String] The seller SKU for which return reason codes are required.
100
+ # @param marketplace_id [String] The marketplace for which the seller wants return reason codes.
101
+ # @param seller_fulfillment_order_id [String] The identifier assigned to the item by the seller when the
85
102
  # fulfillment order was created. The service uses this value to determine the marketplace for which the seller
86
103
  # wants return reason codes.
87
- # @param [String] language The language that the `TranslatedDescription` property of the `ReasonCodeDetails`
104
+ # @param language [String] The language that the `TranslatedDescription` property of the `ReasonCodeDetails`
88
105
  # response object should be translated into.
89
- # @return [Hash] The API response
90
- def list_return_reason_codes(seller_sku, marketplace_id: nil, seller_fulfillment_order_id: nil, language: nil)
106
+ # @param rate_limit [Float] Requests per second
107
+ # @return [Peddler::Response] The API response
108
+ def list_return_reason_codes(seller_sku, marketplace_id: nil, seller_fulfillment_order_id: nil, language: nil,
109
+ rate_limit: 2.0)
91
110
  path = "/fba/outbound/2020-07-01/returnReasonCodes"
92
111
  params = {
93
112
  "sellerSku" => seller_sku,
@@ -96,55 +115,63 @@ module Peddler
96
115
  "language" => language,
97
116
  }.compact
98
117
 
99
- rate_limit(2.0).get(path, params:)
118
+ meter(rate_limit).get(path, params:)
100
119
  end
101
120
 
102
121
  # Creates a fulfillment return.
103
122
  #
104
- # @param [Hash] body CreateFulfillmentReturnRequest parameter
105
- # @param [String] seller_fulfillment_order_id An identifier assigned by the seller to the fulfillment order at the
123
+ # @note This operation can make a dynamic sandbox call.
124
+ # @param body [Hash] CreateFulfillmentReturnRequest parameter
125
+ # @param seller_fulfillment_order_id [String] An identifier assigned by the seller to the fulfillment order at the
106
126
  # time it was created. The seller uses their own records to find the correct `SellerFulfillmentOrderId` value
107
127
  # based on the buyer's request to return items.
108
- # @return [Hash] The API response
109
- def create_fulfillment_return(body, seller_fulfillment_order_id)
128
+ # @param rate_limit [Float] Requests per second
129
+ # @return [Peddler::Response] The API response
130
+ def create_fulfillment_return(body, seller_fulfillment_order_id, rate_limit: 2.0)
110
131
  path = "/fba/outbound/2020-07-01/fulfillmentOrders/#{seller_fulfillment_order_id}/return"
111
132
 
112
- rate_limit(2.0).put(path, body:)
133
+ meter(rate_limit).put(path, body:)
113
134
  end
114
135
 
115
136
  # Returns the fulfillment order indicated by the specified order identifier.
116
137
  #
117
- # @param [String] seller_fulfillment_order_id The identifier assigned to the item by the seller when the
138
+ # @note This operation can make a dynamic sandbox call.
139
+ # @param seller_fulfillment_order_id [String] The identifier assigned to the item by the seller when the
118
140
  # fulfillment order was created.
119
- # @return [Hash] The API response
120
- def get_fulfillment_order(seller_fulfillment_order_id)
141
+ # @param rate_limit [Float] Requests per second
142
+ # @return [Peddler::Response] The API response
143
+ def get_fulfillment_order(seller_fulfillment_order_id, rate_limit: 2.0)
121
144
  path = "/fba/outbound/2020-07-01/fulfillmentOrders/#{seller_fulfillment_order_id}"
122
145
 
123
- rate_limit(2.0).get(path)
146
+ meter(rate_limit).get(path)
124
147
  end
125
148
 
126
149
  # Updates and/or requests shipment for a fulfillment order with an order hold on it.
127
150
  #
128
- # @param [Hash] body UpdateFulfillmentOrderRequest parameter
129
- # @param [String] seller_fulfillment_order_id The identifier assigned to the item by the seller when the
151
+ # @note This operation can make a dynamic sandbox call.
152
+ # @param body [Hash] UpdateFulfillmentOrderRequest parameter
153
+ # @param seller_fulfillment_order_id [String] The identifier assigned to the item by the seller when the
130
154
  # fulfillment order was created.
131
- # @return [Hash] The API response
132
- def update_fulfillment_order(body, seller_fulfillment_order_id)
155
+ # @param rate_limit [Float] Requests per second
156
+ # @return [Peddler::Response] The API response
157
+ def update_fulfillment_order(body, seller_fulfillment_order_id, rate_limit: 2.0)
133
158
  path = "/fba/outbound/2020-07-01/fulfillmentOrders/#{seller_fulfillment_order_id}"
134
159
 
135
- rate_limit(2.0).put(path, body:)
160
+ meter(rate_limit).put(path, body:)
136
161
  end
137
162
 
138
163
  # Requests that Amazon stop attempting to fulfill the fulfillment order indicated by the specified order
139
164
  # identifier.
140
165
  #
141
- # @param [String] seller_fulfillment_order_id The identifier assigned to the item by the seller when the
166
+ # @note This operation can make a dynamic sandbox call.
167
+ # @param seller_fulfillment_order_id [String] The identifier assigned to the item by the seller when the
142
168
  # fulfillment order was created.
143
- # @return [Hash] The API response
144
- def cancel_fulfillment_order(seller_fulfillment_order_id)
169
+ # @param rate_limit [Float] Requests per second
170
+ # @return [Peddler::Response] The API response
171
+ def cancel_fulfillment_order(seller_fulfillment_order_id, rate_limit: 2.0)
145
172
  path = "/fba/outbound/2020-07-01/fulfillmentOrders/#{seller_fulfillment_order_id}/cancel"
146
173
 
147
- rate_limit(2.0).put(path)
174
+ meter(rate_limit).put(path)
148
175
  end
149
176
 
150
177
  # Requests that Amazon update the status of an order in the sandbox testing environment. This is a sandbox-only
@@ -153,11 +180,15 @@ module Peddler
153
180
  # Partner API sandbox](https://developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more
154
181
  # information.
155
182
  #
156
- # @param [String] seller_fulfillment_order_id The identifier assigned to the item by the seller when the
183
+ # @note This operation can make a dynamic sandbox call.
184
+ # @param seller_fulfillment_order_id [String] The identifier assigned to the item by the seller when the
157
185
  # fulfillment order was created.
158
- # @param [Hash] body The identifier assigned to the item by the seller when the fulfillment order was created.
159
- # @return [Hash] The API response
160
- def submit_fulfillment_order_status_update(seller_fulfillment_order_id, body)
186
+ # @param body [Hash] The identifier assigned to the item by the seller when the fulfillment order was created.
187
+ # @param rate_limit [Float] Requests per second
188
+ # @return [Peddler::Response] The API response
189
+ def submit_fulfillment_order_status_update(seller_fulfillment_order_id, body, rate_limit: nil)
190
+ must_sandbox!
191
+
161
192
  path = "/fba/outbound/2020-07-01/fulfillmentOrders/#{seller_fulfillment_order_id}/status"
162
193
 
163
194
  put(path, body:)
@@ -166,29 +197,33 @@ module Peddler
166
197
  # Returns a list of features available for Multi-Channel Fulfillment orders in the marketplace you specify, and
167
198
  # whether the seller for which you made the call is enrolled for each feature.
168
199
  #
169
- # @param [String] marketplace_id The marketplace for which to return the list of features.
170
- # @return [Hash] The API response
171
- def get_features(marketplace_id)
200
+ # @note This operation can make a dynamic sandbox call.
201
+ # @param marketplace_id [String] The marketplace for which to return the list of features.
202
+ # @param rate_limit [Float] Requests per second
203
+ # @return [Peddler::Response] The API response
204
+ def get_features(marketplace_id, rate_limit: 2.0)
172
205
  path = "/fba/outbound/2020-07-01/features"
173
206
  params = {
174
207
  "marketplaceId" => marketplace_id,
175
208
  }.compact
176
209
 
177
- rate_limit(2.0).get(path, params:)
210
+ meter(rate_limit).get(path, params:)
178
211
  end
179
212
 
180
213
  # Returns a list of inventory items that are eligible for the fulfillment feature you specify.
181
214
  #
182
- # @param [String] marketplace_id The marketplace for which to return a list of the inventory that is eligible for
215
+ # @note This operation can make a dynamic sandbox call.
216
+ # @param marketplace_id [String] The marketplace for which to return a list of the inventory that is eligible for
183
217
  # the specified feature.
184
- # @param [String] feature_name The name of the feature for which to return a list of eligible inventory.
185
- # @param [String] next_token A string token returned in the response to your previous request that is used to
218
+ # @param feature_name [String] The name of the feature for which to return a list of eligible inventory.
219
+ # @param next_token [String] A string token returned in the response to your previous request that is used to
186
220
  # return the next response page. A value of null will return the first page.
187
- # @param [String] query_start_date A date that you can use to select inventory that has been updated since a
221
+ # @param query_start_date [String] A date that you can use to select inventory that has been updated since a
188
222
  # specified date. An update is defined as any change in feature-enabled inventory availability. The date must be
189
223
  # in the format yyyy-MM-ddTHH:mm:ss.sssZ
190
- # @return [Hash] The API response
191
- def get_feature_inventory(marketplace_id, feature_name, next_token: nil, query_start_date: nil)
224
+ # @param rate_limit [Float] Requests per second
225
+ # @return [Peddler::Response] The API response
226
+ def get_feature_inventory(marketplace_id, feature_name, next_token: nil, query_start_date: nil, rate_limit: 2.0)
192
227
  path = "/fba/outbound/2020-07-01/features/inventory/#{feature_name}"
193
228
  params = {
194
229
  "marketplaceId" => marketplace_id,
@@ -196,7 +231,7 @@ module Peddler
196
231
  "queryStartDate" => query_start_date,
197
232
  }.compact
198
233
 
199
- rate_limit(2.0).get(path, params:)
234
+ meter(rate_limit).get(path, params:)
200
235
  end
201
236
 
202
237
  # Returns the number of items with the sellerSKU you specify that can have orders fulfilled using the specified
@@ -204,18 +239,20 @@ module Peddler
204
239
  # parameters for this operation may contain special characters that require URL encoding. To avoid errors with
205
240
  # SKUs when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
206
241
  #
207
- # @param [String] marketplace_id The marketplace for which to return the count.
208
- # @param [String] feature_name The name of the feature.
209
- # @param [String] seller_sku Used to identify an item in the given marketplace. `SellerSKU` is qualified by the
242
+ # @note This operation can make a dynamic sandbox call.
243
+ # @param marketplace_id [String] The marketplace for which to return the count.
244
+ # @param feature_name [String] The name of the feature.
245
+ # @param seller_sku [String] Used to identify an item in the given marketplace. `SellerSKU` is qualified by the
210
246
  # seller's `SellerId`, which is included with every operation that you submit.
211
- # @return [Hash] The API response
212
- def get_feature_sku(marketplace_id, feature_name, seller_sku)
247
+ # @param rate_limit [Float] Requests per second
248
+ # @return [Peddler::Response] The API response
249
+ def get_feature_sku(marketplace_id, feature_name, seller_sku, rate_limit: 2.0)
213
250
  path = "/fba/outbound/2020-07-01/features/inventory/#{feature_name}/#{seller_sku}"
214
251
  params = {
215
252
  "marketplaceId" => marketplace_id,
216
253
  }.compact
217
254
 
218
- rate_limit(2.0).get(path, params:)
255
+ meter(rate_limit).get(path, params:)
219
256
  end
220
257
  end
221
258
  end
@@ -0,0 +1,180 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def invoices_2024_06_19(...)
8
+ APIs::Invoices20240619.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
13
+ # The Selling Partner API for Invoices.
14
+ #
15
+ # Use the Selling Partner API for Invoices to retrieve and manage invoice-related operations, which can help selling
16
+ # partners manage their bookkeeping processes.
17
+ class Invoices20240619 < API
18
+ # Returns marketplace-dependent schemas and their respective set of possible values.
19
+ #
20
+ # @note This operation can make a static sandbox call.
21
+ # @param marketplace_id [String] The marketplace identifier.
22
+ # @param rate_limit [Float] Requests per second
23
+ # @return [Peddler::Response] The API response
24
+ def get_invoices_attributes(marketplace_id, rate_limit: 1.0)
25
+ path = "/tax/invoices/2024-06-19/attributes"
26
+ params = {
27
+ "marketplaceId" => marketplace_id,
28
+ }.compact
29
+
30
+ meter(rate_limit).get(path, params:)
31
+ end
32
+
33
+ # Returns the invoice document's ID and URL. Use the URL to download the ZIP file, which contains the invoices
34
+ # from the corresponding `createInvoicesExport` request.
35
+ #
36
+ # @note This operation can make a static sandbox call.
37
+ # @param invoices_document_id [String] The export document identifier.
38
+ # @param rate_limit [Float] Requests per second
39
+ # @return [Peddler::Response] The API response
40
+ def get_invoices_document(invoices_document_id, rate_limit: 0.0167)
41
+ path = "/tax/invoices/2024-06-19/documents/#{invoices_document_id}"
42
+
43
+ meter(rate_limit).get(path)
44
+ end
45
+
46
+ # Creates an invoice export request.
47
+ #
48
+ # @note This operation can make a static sandbox call.
49
+ # @param body [Hash] Information required to create the export request.
50
+ # @param rate_limit [Float] Requests per second
51
+ # @return [Peddler::Response] The API response
52
+ def create_invoices_export(body, rate_limit: 0.167)
53
+ path = "/tax/invoices/2024-06-19/exports"
54
+
55
+ meter(rate_limit).post(path, body:)
56
+ end
57
+
58
+ # Returns invoice exports details for exports that match the filters that you specify.
59
+ #
60
+ # @note This operation can make a static sandbox call.
61
+ # @param marketplace_id [String] The returned exports match the specified marketplace.
62
+ # @param date_start [String] The earliest export creation date and time for exports that you want to include in
63
+ # the response. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time
64
+ # format. The default is 30 days ago.
65
+ # @param next_token [String] The response includes `nextToken` when the number of results exceeds the specified
66
+ # `pageSize` value. To get the next page of results, call the operation with this token and include the same
67
+ # arguments as the call that produced the token. To get a complete list, call this operation until `nextToken`
68
+ # is null. Note that this operation can return empty pages.
69
+ # @param page_size [Integer] The maximum number of invoices to return in a single call. Minimum: 1 Maximum: 100
70
+ # @param date_end [String] The latest export creation date and time for exports that you want to include in the
71
+ # response. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format.
72
+ # The default value is the time of the request.
73
+ # @param status [String] Return exports matching the status specified.
74
+ # @param rate_limit [Float] Requests per second
75
+ # @return [Peddler::Response] The API response
76
+ def get_invoices_exports(marketplace_id, date_start: nil, next_token: nil, page_size: nil, date_end: nil,
77
+ status: nil, rate_limit: 0.1)
78
+ path = "/tax/invoices/2024-06-19/exports"
79
+ params = {
80
+ "marketplaceId" => marketplace_id,
81
+ "dateStart" => date_start,
82
+ "nextToken" => next_token,
83
+ "pageSize" => page_size,
84
+ "dateEnd" => date_end,
85
+ "status" => status,
86
+ }.compact
87
+
88
+ meter(rate_limit).get(path, params:)
89
+ end
90
+
91
+ # Returns invoice export details (including the `exportDocumentId`, if available) for the export that you specify.
92
+ #
93
+ # @note This operation can make a static sandbox call.
94
+ # @param export_id [String] The unique identifier for the export.
95
+ # @param rate_limit [Float] Requests per second
96
+ # @return [Peddler::Response] The API response
97
+ def get_invoices_export(export_id, rate_limit: 2.0)
98
+ path = "/tax/invoices/2024-06-19/exports/#{export_id}"
99
+
100
+ meter(rate_limit).get(path)
101
+ end
102
+
103
+ # Returns invoice details for the invoices that match the filters that you specify.
104
+ #
105
+ # @note This operation can make a static sandbox call.
106
+ # @param transaction_identifier_name [String] The name of the transaction identifier filter. If you provide a
107
+ # value for this field, you must also provide a value for the `transactionIdentifierId` field.Use the
108
+ # `getInvoicesAttributes` operation to check `transactionIdentifierName` options.
109
+ # @param page_size [Integer] The maximum number of invoices you want to return in a single call. Minimum: 1
110
+ # Maximum: 200
111
+ # @param date_end [String] The latest invoice creation date for invoices that you want to include in the response.
112
+ # Dates are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format. The default
113
+ # is the current date-time.
114
+ # @param marketplace_id [String] The response includes only the invoices that match the specified marketplace.
115
+ # @param transaction_type [String] The marketplace-specific classification of the transaction type for which the
116
+ # invoice was created. Use the `getInvoicesAttributes` operation to check `transactionType` options.
117
+ # @param transaction_identifier_id [String] The ID of the transaction identifier filter. If you provide a value
118
+ # for this field, you must also provide a value for the `transactionIdentifierName` field.
119
+ # @param date_start [String] The earliest invoice creation date for invoices that you want to include in the
120
+ # response. Dates are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format.
121
+ # The default is 24 hours prior to the time of the request.
122
+ # @param series [String] Return invoices with the specified series number.
123
+ # @param next_token [String] The response includes `nextToken` when the number of results exceeds the specified
124
+ # `pageSize` value. To get the next page of results, call the operation with this token and include the same
125
+ # arguments as the call that produced the token. To get a complete list, call this operation until `nextToken`
126
+ # is null. Note that this operation can return empty pages.
127
+ # @param sort_order [String] Sort the invoices in the response in ascending or descending order.
128
+ # @param invoice_type [String] The marketplace-specific classification of the invoice type. Use the
129
+ # `getInvoicesAttributes` operation to check `invoiceType` options.
130
+ # @param statuses [Array<String>] A list of statuses that you can use to filter invoices. Use the
131
+ # `getInvoicesAttributes` operation to check invoice status options. Min count: 1
132
+ # @param external_invoice_id [String] Return invoices that match this external ID. This is typically the
133
+ # Government Invoice ID.
134
+ # @param sort_by [String] The attribute by which you want to sort the invoices in the response.
135
+ # @param rate_limit [Float] Requests per second
136
+ # @return [Peddler::Response] The API response
137
+ def get_invoices(marketplace_id, transaction_identifier_name: nil, page_size: nil, date_end: nil,
138
+ transaction_type: nil, transaction_identifier_id: nil, date_start: nil, series: nil, next_token: nil,
139
+ sort_order: nil, invoice_type: nil, statuses: nil, external_invoice_id: nil, sort_by: nil, rate_limit: 0.1)
140
+ path = "/tax/invoices/2024-06-19/invoices"
141
+ params = {
142
+ "transactionIdentifierName" => transaction_identifier_name,
143
+ "pageSize" => page_size,
144
+ "dateEnd" => date_end,
145
+ "marketplaceId" => marketplace_id,
146
+ "transactionType" => transaction_type,
147
+ "transactionIdentifierId" => transaction_identifier_id,
148
+ "dateStart" => date_start,
149
+ "series" => series,
150
+ "nextToken" => next_token,
151
+ "sortOrder" => sort_order,
152
+ "invoiceType" => invoice_type,
153
+ "statuses" => statuses,
154
+ "externalInvoiceId" => external_invoice_id,
155
+ "sortBy" => sort_by,
156
+ }.compact
157
+
158
+ meter(rate_limit).get(path, params:)
159
+ end
160
+
161
+ # Returns invoice data for the specified invoice. This operation returns only a subset of the invoices data; refer
162
+ # to the response definition to get all the possible attributes. To get the full invoice, use the
163
+ # `createInvoicesExport` operation to start an export request.
164
+ #
165
+ # @note This operation can make a static sandbox call.
166
+ # @param marketplace_id [String] The marketplace from which you want the invoice.
167
+ # @param invoice_id [String] The invoice identifier.
168
+ # @param rate_limit [Float] Requests per second
169
+ # @return [Peddler::Response] The API response
170
+ def get_invoice(marketplace_id, invoice_id, rate_limit: 2.0)
171
+ path = "/tax/invoices/2024-06-19/invoices/#{invoice_id}"
172
+ params = {
173
+ "marketplaceId" => marketplace_id,
174
+ }.compact
175
+
176
+ meter(rate_limit).get(path, params:)
177
+ end
178
+ end
179
+ end
180
+ end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def listings_items_2020_09_01(...)
8
+ APIs::ListingsItems20200901.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
13
+ # Selling Partner API for Listings Items
14
+ #
15
+ # The Selling Partner API for Listings Items (Listings Items API) provides programmatic access to selling partner
16
+ # listings on Amazon. Use this API in collaboration with the Selling Partner API for Product Type Definitions, which
17
+ # you use to retrieve the information about Amazon product types needed to use the Listings Items API. For more
18
+ # information, see the {https://developer-docs.amazon.com/sp-api/docs/listings-items-api-v2020-09-01-use-case-guide
19
+ # Listing Items API Use Case Guide}.
20
+ class ListingsItems20200901 < API
21
+ # Delete a listings item for a selling partner. **Note:** The parameters associated with this operation may
22
+ # contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when
23
+ # encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
24
+ #
25
+ # @note This operation can make a static sandbox call.
26
+ # @param seller_id [String] A selling partner identifier, such as a merchant account or vendor code.
27
+ # @param sku [String] A selling partner provided identifier for an Amazon listing.
28
+ # @param marketplace_ids [Array<String>] A comma-delimited list of Amazon marketplace identifiers for the request.
29
+ # @param issue_locale [String] A locale for localization of issues. When not provided, the default language code
30
+ # of the first marketplace is used. Examples: "en_US", "fr_CA", "fr_FR". Localized messages default to "en_US"
31
+ # when a localization is not available in the specified locale.
32
+ # @param rate_limit [Float] Requests per second
33
+ # @return [Peddler::Response] The API response
34
+ def delete_listings_item(seller_id, sku, marketplace_ids, issue_locale: nil, rate_limit: 5.0)
35
+ path = "/listings/2020-09-01/items/#{seller_id}/#{sku}"
36
+ params = {
37
+ "marketplaceIds" => marketplace_ids,
38
+ "issueLocale" => issue_locale,
39
+ }.compact
40
+
41
+ meter(rate_limit).delete(path, params:)
42
+ end
43
+
44
+ # Partially update (patch) a listings item for a selling partner. Only top-level listings item attributes can be
45
+ # patched. Patching nested attributes is not supported. **Note:** The parameters associated with this operation
46
+ # may contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when
47
+ # encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
48
+ #
49
+ # @note This operation can make a static sandbox call.
50
+ # @param seller_id [String] A selling partner identifier, such as a merchant account or vendor code.
51
+ # @param sku [String] A selling partner provided identifier for an Amazon listing.
52
+ # @param marketplace_ids [Array<String>] A comma-delimited list of Amazon marketplace identifiers for the request.
53
+ # @param issue_locale [String] A locale for localization of issues. When not provided, the default language code
54
+ # of the first marketplace is used. Examples: "en_US", "fr_CA", "fr_FR". Localized messages default to "en_US"
55
+ # when a localization is not available in the specified locale.
56
+ # @param body [Hash] The request body schema for the patchListingsItem operation.
57
+ # @param rate_limit [Float] Requests per second
58
+ # @return [Peddler::Response] The API response
59
+ def patch_listings_item(seller_id, sku, marketplace_ids, body, issue_locale: nil, rate_limit: 5.0)
60
+ path = "/listings/2020-09-01/items/#{seller_id}/#{sku}"
61
+ params = {
62
+ "marketplaceIds" => marketplace_ids,
63
+ "issueLocale" => issue_locale,
64
+ }.compact
65
+
66
+ meter(rate_limit).patch(path, body:, params:)
67
+ end
68
+
69
+ # Creates a new or fully-updates an existing listings item for a selling partner. **Note:** The parameters
70
+ # associated with this operation may contain special characters that must be encoded to successfully call the API.
71
+ # To avoid errors with SKUs when encoding URLs, refer to [URL
72
+ # Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding).
73
+ #
74
+ # @note This operation can make a static sandbox call.
75
+ # @param seller_id [String] A selling partner identifier, such as a merchant account or vendor code.
76
+ # @param sku [String] A selling partner provided identifier for an Amazon listing.
77
+ # @param marketplace_ids [Array<String>] A comma-delimited list of Amazon marketplace identifiers for the request.
78
+ # @param issue_locale [String] A locale for localization of issues. When not provided, the default language code
79
+ # of the first marketplace is used. Examples: "en_US", "fr_CA", "fr_FR". Localized messages default to "en_US"
80
+ # when a localization is not available in the specified locale.
81
+ # @param body [Hash] The request body schema for the putListingsItem operation.
82
+ # @param rate_limit [Float] Requests per second
83
+ # @return [Peddler::Response] The API response
84
+ def put_listings_item(seller_id, sku, marketplace_ids, body, issue_locale: nil, rate_limit: 5.0)
85
+ path = "/listings/2020-09-01/items/#{seller_id}/#{sku}"
86
+ params = {
87
+ "marketplaceIds" => marketplace_ids,
88
+ "issueLocale" => issue_locale,
89
+ }.compact
90
+
91
+ meter(rate_limit).put(path, body:, params:)
92
+ end
93
+ end
94
+ end
95
+ end