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 shipping_v2(...)
8
+ APIs::ShippingV2.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
7
13
  # Amazon Shipping API
8
14
  #
9
15
  # The Amazon Shipping API is designed to support outbound shipping use cases both for orders originating on
@@ -12,32 +18,38 @@ module Peddler
12
18
  class ShippingV2 < API
13
19
  # Returns the available shipping service offerings.
14
20
  #
15
- # @param [Hash] body
16
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
21
+ # @note This operation can make a dynamic sandbox call.
22
+ # @param body [Hash]
23
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
17
24
  # AmazonShipping_UK.
18
- # @return [Hash] The API response
19
- def get_rates(body, x_amzn_shipping_business_id: nil)
25
+ # @param rate_limit [Float] Requests per second
26
+ # @return [Peddler::Response] The API response
27
+ def get_rates(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
20
28
  path = "/shipping/v2/shipments/rates"
21
29
 
22
- rate_limit(80.0).post(path, body:)
30
+ meter(rate_limit).post(path, body:)
23
31
  end
24
32
 
25
33
  # Purchases the shipping service for a shipment using the best fit service offering. Returns purchase related
26
34
  # details and documents.
27
35
  #
28
- # @param [Hash] body
29
- # @param [String] x_amzn_idempotency_key A unique value which the server uses to recognize subsequent retries of
36
+ # @param body [Hash]
37
+ # @param x_amzn_idempotency_key [String] A unique value which the server uses to recognize subsequent retries of
30
38
  # the same request.
31
- # @param [String] locale The IETF Language Tag. Note that this only supports the primary language subtag with one
39
+ # @param locale [String] The IETF Language Tag. Note that this only supports the primary language subtag with one
32
40
  # secondary language subtag (i.e. en-US, fr-CA). The secondary language subtag is almost always a regional
33
41
  # designation. This does not support additional subtags beyond the primary and secondary language subtags.
34
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
42
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
35
43
  # AmazonShipping_UK.
36
- # @return [Hash] The API response
37
- def direct_purchase_shipment(body, x_amzn_idempotency_key: nil, locale: nil, x_amzn_shipping_business_id: nil)
44
+ # @param rate_limit [Float] Requests per second
45
+ # @return [Peddler::Response] The API response
46
+ def direct_purchase_shipment(body, x_amzn_idempotency_key: nil, locale: nil, x_amzn_shipping_business_id: nil,
47
+ rate_limit: 80.0)
48
+ cannot_sandbox!
49
+
38
50
  path = "/shipping/v2/shipments/directPurchase"
39
51
 
40
- rate_limit(80.0).post(path, body:)
52
+ meter(rate_limit).post(path, body:)
41
53
  end
42
54
 
43
55
  # Purchases a shipping service and returns purchase related details and documents. Note: You must complete the
@@ -45,63 +57,71 @@ module Peddler
45
57
  # 10 minutes have expired, you will receive an error response with the error code equal to "TOKEN_EXPIRED". If you
46
58
  # receive this error response, you must get the rates for the shipment again.
47
59
  #
48
- # @param [Hash] body
49
- # @param [String] x_amzn_idempotency_key A unique value which the server uses to recognize subsequent retries of
60
+ # @note This operation can make a dynamic sandbox call.
61
+ # @param body [Hash]
62
+ # @param x_amzn_idempotency_key [String] A unique value which the server uses to recognize subsequent retries of
50
63
  # the same request.
51
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
64
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
52
65
  # AmazonShipping_UK.
53
- # @return [Hash] The API response
54
- def purchase_shipment(body, x_amzn_idempotency_key: nil, x_amzn_shipping_business_id: nil)
66
+ # @param rate_limit [Float] Requests per second
67
+ # @return [Peddler::Response] The API response
68
+ def purchase_shipment(body, x_amzn_idempotency_key: nil, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
55
69
  path = "/shipping/v2/shipments"
56
70
 
57
- rate_limit(80.0).post(path, body:)
71
+ meter(rate_limit).post(path, body:)
58
72
  end
59
73
 
60
74
  # Purchases a shipping service identifier and returns purchase-related details and documents.
61
75
  #
62
- # @param [Hash] body
63
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
76
+ # @note This operation can make a dynamic sandbox call.
77
+ # @param body [Hash]
78
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
64
79
  # AmazonShipping_UK.
65
- # @return [Hash] The API response
66
- def one_click_shipment(body, x_amzn_shipping_business_id: nil)
80
+ # @param rate_limit [Float] Requests per second
81
+ # @return [Peddler::Response] The API response
82
+ def one_click_shipment(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
67
83
  path = "/shipping/v2/oneClickShipment"
68
84
 
69
- rate_limit(80.0).post(path, body:)
85
+ meter(rate_limit).post(path, body:)
70
86
  end
71
87
 
72
88
  # Returns tracking information for a purchased shipment.
73
89
  #
74
- # @param [String] tracking_id A carrier-generated tracking identifier originally returned by the purchaseShipment
90
+ # @note This operation can make a dynamic sandbox call.
91
+ # @param tracking_id [String] A carrier-generated tracking identifier originally returned by the purchaseShipment
75
92
  # operation.
76
- # @param [String] carrier_id A carrier identifier originally returned by the getRates operation for the selected
93
+ # @param carrier_id [String] A carrier identifier originally returned by the getRates operation for the selected
77
94
  # rate.
78
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
95
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
79
96
  # AmazonShipping_UK.
80
- # @return [Hash] The API response
81
- def get_tracking(tracking_id, carrier_id, x_amzn_shipping_business_id: nil)
97
+ # @param rate_limit [Float] Requests per second
98
+ # @return [Peddler::Response] The API response
99
+ def get_tracking(tracking_id, carrier_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
82
100
  path = "/shipping/v2/tracking"
83
101
  params = {
84
102
  "trackingId" => tracking_id,
85
103
  "carrierId" => carrier_id,
86
104
  }.compact
87
105
 
88
- rate_limit(80.0).get(path, params:)
106
+ meter(rate_limit).get(path, params:)
89
107
  end
90
108
 
91
109
  # Returns the shipping documents associated with a package in a shipment.
92
110
  #
93
- # @param [String] shipment_id The shipment identifier originally returned by the purchaseShipment operation.
94
- # @param [String] package_client_reference_id The package client reference identifier originally provided in the
111
+ # @note This operation can make a dynamic sandbox call.
112
+ # @param shipment_id [String] The shipment identifier originally returned by the purchaseShipment operation.
113
+ # @param package_client_reference_id [String] The package client reference identifier originally provided in the
95
114
  # request body parameter for the getRates operation.
96
- # @param [String] format The file format of the document. Must be one of the supported formats returned by the
115
+ # @param format [String] The file format of the document. Must be one of the supported formats returned by the
97
116
  # getRates operation.
98
- # @param [Number] dpi The resolution of the document (for example, 300 means 300 dots per inch). Must be one of
117
+ # @param dpi [Number] The resolution of the document (for example, 300 means 300 dots per inch). Must be one of
99
118
  # the supported resolutions returned in the response to the getRates operation.
100
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
119
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
101
120
  # AmazonShipping_UK.
102
- # @return [Hash] The API response
121
+ # @param rate_limit [Float] Requests per second
122
+ # @return [Peddler::Response] The API response
103
123
  def get_shipment_documents(shipment_id, package_client_reference_id, format: nil, dpi: nil,
104
- x_amzn_shipping_business_id: nil)
124
+ x_amzn_shipping_business_id: nil, rate_limit: 80.0)
105
125
  path = "/shipping/v2/shipments/#{shipment_id}/documents"
106
126
  params = {
107
127
  "packageClientReferenceId" => package_client_reference_id,
@@ -109,150 +129,182 @@ module Peddler
109
129
  "dpi" => dpi,
110
130
  }.compact
111
131
 
112
- rate_limit(80.0).get(path, params:)
132
+ meter(rate_limit).get(path, params:)
113
133
  end
114
134
 
115
135
  # Cancels a purchased shipment. Returns an empty object if the shipment is successfully cancelled.
116
136
  #
117
- # @param [String] shipment_id The shipment identifier originally returned by the purchaseShipment operation.
118
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
137
+ # @note This operation can make a dynamic sandbox call.
138
+ # @param shipment_id [String] The shipment identifier originally returned by the purchaseShipment operation.
139
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
119
140
  # AmazonShipping_UK.
120
- # @return [Hash] The API response
121
- def cancel_shipment(shipment_id, x_amzn_shipping_business_id: nil)
141
+ # @param rate_limit [Float] Requests per second
142
+ # @return [Peddler::Response] The API response
143
+ def cancel_shipment(shipment_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
122
144
  path = "/shipping/v2/shipments/#{shipment_id}/cancel"
123
145
 
124
- rate_limit(80.0).put(path)
146
+ meter(rate_limit).put(path)
125
147
  end
126
148
 
127
149
  # Returns the JSON schema to use for providing additional inputs when needed to purchase a shipping offering. Call
128
150
  # the getAdditionalInputs operation when the response to a previous call to the getRates operation indicates that
129
151
  # additional inputs are required for the rate (shipping offering) that you want to purchase.
130
152
  #
131
- # @param [String] request_token The request token returned in the response to the getRates operation.
132
- # @param [String] rate_id The rate identifier for the shipping offering (rate) returned in the response to the
153
+ # @note This operation can make a static sandbox call.
154
+ # @param request_token [String] The request token returned in the response to the getRates operation.
155
+ # @param rate_id [String] The rate identifier for the shipping offering (rate) returned in the response to the
133
156
  # getRates operation.
134
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
157
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
135
158
  # AmazonShipping_UK.
136
- # @return [Hash] The API response
137
- def get_additional_inputs(request_token, rate_id, x_amzn_shipping_business_id: nil)
159
+ # @param rate_limit [Float] Requests per second
160
+ # @return [Peddler::Response] The API response
161
+ def get_additional_inputs(request_token, rate_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
138
162
  path = "/shipping/v2/shipments/additionalInputs/schema"
139
163
  params = {
140
164
  "requestToken" => request_token,
141
165
  "rateId" => rate_id,
142
166
  }.compact
143
167
 
144
- rate_limit(80.0).get(path, params:)
168
+ meter(rate_limit).get(path, params:)
145
169
  end
146
170
 
147
171
  # This API will return a list of input schema required to register a shipper account with the carrier.
148
172
  #
149
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
173
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
150
174
  # AmazonShipping_UK.
151
- # @return [Hash] The API response
152
- def get_carrier_account_form_inputs(x_amzn_shipping_business_id: nil)
175
+ # @param rate_limit [Float] Requests per second
176
+ # @return [Peddler::Response] The API response
177
+ def get_carrier_account_form_inputs(x_amzn_shipping_business_id: nil, rate_limit: 80.0)
178
+ cannot_sandbox!
179
+
153
180
  path = "/shipping/v2/carrierAccountFormInputs"
154
181
 
155
- rate_limit(80.0).get(path)
182
+ meter(rate_limit).get(path)
156
183
  end
157
184
 
158
185
  # This API will return Get all carrier accounts for a merchant.
159
186
  #
160
- # @param [Hash] body
161
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
187
+ # @param body [Hash]
188
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
162
189
  # AmazonShipping_UK.
163
- # @return [Hash] The API response
164
- def get_carrier_accounts(body, x_amzn_shipping_business_id: nil)
190
+ # @param rate_limit [Float] Requests per second
191
+ # @return [Peddler::Response] The API response
192
+ def get_carrier_accounts(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
193
+ cannot_sandbox!
194
+
165
195
  path = "/shipping/v2/carrierAccounts"
166
196
 
167
- rate_limit(80.0).put(path, body:)
197
+ meter(rate_limit).put(path, body:)
168
198
  end
169
199
 
170
200
  # This API associates/links the specified carrier account with the merchant.
171
201
  #
172
- # @param [String] carrier_id The unique identifier associated with the carrier account.
173
- # @param [Hash] body
174
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
202
+ # @param carrier_id [String] The unique identifier associated with the carrier account.
203
+ # @param body [Hash]
204
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
175
205
  # AmazonShipping_UK.
176
- # @return [Hash] The API response
177
- def link_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil)
206
+ # @param rate_limit [Float] Requests per second
207
+ # @return [Peddler::Response] The API response
208
+ def link_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
209
+ cannot_sandbox!
210
+
178
211
  path = "/shipping/v2/carrierAccounts/#{carrier_id}"
179
212
 
180
- rate_limit(80.0).put(path, body:)
213
+ meter(rate_limit).put(path, body:)
181
214
  end
182
215
 
183
216
  # This API Unlink the specified carrier account with the merchant.
184
217
  #
185
- # @param [String] carrier_id carrier Id to unlink with merchant.
186
- # @param [Hash] body
187
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
218
+ # @param carrier_id [String] carrier Id to unlink with merchant.
219
+ # @param body [Hash]
220
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
188
221
  # AmazonShipping_UK.
189
- # @return [Hash] The API response
190
- def unlink_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil)
222
+ # @param rate_limit [Float] Requests per second
223
+ # @return [Peddler::Response] The API response
224
+ def unlink_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
225
+ cannot_sandbox!
226
+
191
227
  path = "/shipping/v2/carrierAccounts/#{carrier_id}/unlink"
192
228
 
193
- rate_limit(80.0).put(path, body:)
229
+ meter(rate_limit).put(path, body:)
194
230
  end
195
231
 
196
232
  # This API Call to generate the collection form.
197
233
  #
198
- # @param [Hash] body
199
- # @param [String] x_amzn_idempotency_key A unique value which the server uses to recognize subsequent retries of
234
+ # @param body [Hash]
235
+ # @param x_amzn_idempotency_key [String] A unique value which the server uses to recognize subsequent retries of
200
236
  # the same request.
201
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
237
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
202
238
  # AmazonShipping_UK.
203
- # @return [Hash] The API response
204
- def generate_collection_form(body, x_amzn_idempotency_key: nil, x_amzn_shipping_business_id: nil)
239
+ # @param rate_limit [Float] Requests per second
240
+ # @return [Peddler::Response] The API response
241
+ def generate_collection_form(body, x_amzn_idempotency_key: nil, x_amzn_shipping_business_id: nil,
242
+ rate_limit: 80.0)
243
+ cannot_sandbox!
244
+
205
245
  path = "/shipping/v2/collectionForms"
206
246
 
207
- rate_limit(80.0).post(path, body:)
247
+ meter(rate_limit).post(path, body:)
208
248
  end
209
249
 
210
250
  # This API Call to get the history of the previously generated collection forms.
211
251
  #
212
- # @param [Hash] body
213
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
252
+ # @param body [Hash]
253
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
214
254
  # AmazonShipping_UK.
215
- # @return [Hash] The API response
216
- def get_collection_form_history(body, x_amzn_shipping_business_id: nil)
255
+ # @param rate_limit [Float] Requests per second
256
+ # @return [Peddler::Response] The API response
257
+ def get_collection_form_history(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
258
+ cannot_sandbox!
259
+
217
260
  path = "/shipping/v2/collectionForms/history"
218
261
 
219
- rate_limit(80.0).put(path, body:)
262
+ meter(rate_limit).put(path, body:)
220
263
  end
221
264
 
222
265
  # This API Get all unmanifested carriers with shipment locations. Any locations which has unmanifested shipments
223
266
  # with an eligible carrier for manifesting shall be returned.
224
267
  #
225
- # @param [Hash] body
226
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
268
+ # @param body [Hash]
269
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
227
270
  # AmazonShipping_UK.
228
- # @return [Hash] The API response
229
- def get_unmanifested_shipments(body, x_amzn_shipping_business_id: nil)
271
+ # @param rate_limit [Float] Requests per second
272
+ # @return [Peddler::Response] The API response
273
+ def get_unmanifested_shipments(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
274
+ cannot_sandbox!
275
+
230
276
  path = "/shipping/v2/unmanifestedShipments"
231
277
 
232
- rate_limit(80.0).put(path, body:)
278
+ meter(rate_limit).put(path, body:)
233
279
  end
234
280
 
235
281
  # This API reprint a collection form.
236
282
  #
237
- # @param [String] collection_form_id collection form Id to reprint a collection.
238
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
283
+ # @param collection_form_id [String] collection form Id to reprint a collection.
284
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
239
285
  # AmazonShipping_UK.
240
- # @return [Hash] The API response
241
- def get_collection_form(collection_form_id, x_amzn_shipping_business_id: nil)
286
+ # @param rate_limit [Float] Requests per second
287
+ # @return [Peddler::Response] The API response
288
+ def get_collection_form(collection_form_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
289
+ cannot_sandbox!
290
+
242
291
  path = "/shipping/v2/collectionForms/#{collection_form_id}"
243
292
 
244
- rate_limit(80.0).get(path)
293
+ meter(rate_limit).get(path)
245
294
  end
246
295
 
247
296
  # Returns a list of access points in proximity of input postal code.
248
297
  #
249
- # @param [Array<String>] access_point_types
250
- # @param [String] country_code
251
- # @param [String] postal_code
252
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
298
+ # @note This operation can make a dynamic sandbox call.
299
+ # @param access_point_types [Array<String>]
300
+ # @param country_code [String]
301
+ # @param postal_code [String]
302
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
253
303
  # AmazonShipping_UK.
254
- # @return [Hash] The API response
255
- def get_access_points(access_point_types, country_code, postal_code, x_amzn_shipping_business_id: nil)
304
+ # @param rate_limit [Float] Requests per second
305
+ # @return [Peddler::Response] The API response
306
+ def get_access_points(access_point_types, country_code, postal_code, x_amzn_shipping_business_id: nil,
307
+ rate_limit: 80.0)
256
308
  path = "/shipping/v2/accessPoints"
257
309
  params = {
258
310
  "accessPointTypes" => access_point_types,
@@ -260,7 +312,7 @@ module Peddler
260
312
  "postalCode" => postal_code,
261
313
  }.compact
262
314
 
263
- rate_limit(80.0).get(path, params:)
315
+ meter(rate_limit).get(path, params:)
264
316
  end
265
317
  end
266
318
  end
@@ -3,7 +3,13 @@
3
3
  require "peddler/api"
4
4
 
5
5
  module Peddler
6
- class API
6
+ class << self
7
+ def solicitations_v1(...)
8
+ APIs::SolicitationsV1.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
7
13
  # Selling Partner API for Solicitations
8
14
  #
9
15
  # With the Solicitations API you can build applications that send non-critical solicitations to buyers. You can get
@@ -18,35 +24,39 @@ module Peddler
18
24
  # parameter(s) to call an operation that sends a solicitation. Currently only the
19
25
  # productReviewAndSellerFeedbackSolicitation solicitation type is available.
20
26
  #
21
- # @param [String] amazon_order_id An Amazon order identifier. This specifies the order for which you want a list
27
+ # @note This operation can make a static sandbox call.
28
+ # @param amazon_order_id [String] An Amazon order identifier. This specifies the order for which you want a list
22
29
  # of available solicitation types.
23
- # @param [Array<String>] marketplace_ids A marketplace identifier. This specifies the marketplace in which the
30
+ # @param marketplace_ids [Array<String>] A marketplace identifier. This specifies the marketplace in which the
24
31
  # order was placed. Only one marketplace can be specified.
25
- # @return [Hash] The API response
26
- def get_solicitation_actions_for_order(amazon_order_id, marketplace_ids)
32
+ # @param rate_limit [Float] Requests per second
33
+ # @return [Peddler::Response] The API response
34
+ def get_solicitation_actions_for_order(amazon_order_id, marketplace_ids, rate_limit: 1.0)
27
35
  path = "/solicitations/v1/orders/#{amazon_order_id}"
28
36
  params = {
29
37
  "marketplaceIds" => marketplace_ids,
30
38
  }.compact
31
39
 
32
- rate_limit(1.0).get(path, params:)
40
+ meter(rate_limit).get(path, params:)
33
41
  end
34
42
 
35
43
  # Sends a solicitation to a buyer asking for seller feedback and a product review for the specified order. Send
36
44
  # only one productReviewAndSellerFeedback or free form proactive message per order.
37
45
  #
38
- # @param [String] amazon_order_id An Amazon order identifier. This specifies the order for which a solicitation is
46
+ # @note This operation can make a static sandbox call.
47
+ # @param amazon_order_id [String] An Amazon order identifier. This specifies the order for which a solicitation is
39
48
  # sent.
40
- # @param [Array<String>] marketplace_ids A marketplace identifier. This specifies the marketplace in which the
49
+ # @param marketplace_ids [Array<String>] A marketplace identifier. This specifies the marketplace in which the
41
50
  # order was placed. Only one marketplace can be specified.
42
- # @return [Hash] The API response
43
- def create_product_review_and_seller_feedback_solicitation(amazon_order_id, marketplace_ids)
51
+ # @param rate_limit [Float] Requests per second
52
+ # @return [Peddler::Response] The API response
53
+ def create_product_review_and_seller_feedback_solicitation(amazon_order_id, marketplace_ids, rate_limit: 1.0)
44
54
  path = "/solicitations/v1/orders/#{amazon_order_id}/solicitations/productReviewAndSellerFeedback"
45
55
  params = {
46
56
  "marketplaceIds" => marketplace_ids,
47
57
  }.compact
48
58
 
49
- rate_limit(1.0).post(path, params:)
59
+ meter(rate_limit).post(path, params:)
50
60
  end
51
61
  end
52
62
  end
@@ -0,0 +1,100 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def supply_sources_2020_07_01(...)
8
+ APIs::SupplySources20200701.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
13
+ # Selling Partner API for Supply Sources
14
+ #
15
+ # Manage configurations and capabilities of seller supply sources.
16
+ class SupplySources20200701 < API
17
+ # The path to retrieve paginated supply sources.
18
+ #
19
+ # @note This operation can make a static sandbox call.
20
+ # @param next_page_token [String] The pagination token to retrieve a specific page of results.
21
+ # @param page_size [Number] The number of supply sources to return per paginated request.
22
+ # @param rate_limit [Float] Requests per second
23
+ # @return [Peddler::Response] The API response
24
+ def get_supply_sources(next_page_token: nil, page_size: 10, rate_limit: nil)
25
+ path = "/supplySources/2020-07-01/supplySources"
26
+ params = {
27
+ "nextPageToken" => next_page_token,
28
+ "pageSize" => page_size,
29
+ }.compact
30
+
31
+ get(path, params:)
32
+ end
33
+
34
+ # Create a new supply source.
35
+ #
36
+ # @note This operation can make a static sandbox call.
37
+ # @param payload [Hash] A request to create a supply source.
38
+ # @param rate_limit [Float] Requests per second
39
+ # @return [Peddler::Response] The API response
40
+ def create_supply_source(payload, rate_limit: nil)
41
+ path = "/supplySources/2020-07-01/supplySources"
42
+ body = payload
43
+
44
+ post(path, body:)
45
+ end
46
+
47
+ # Retrieve a supply source.
48
+ #
49
+ # @note This operation can make a static sandbox call.
50
+ # @param supply_source_id [String] The unique identifier of a supply source.
51
+ # @param rate_limit [Float] Requests per second
52
+ # @return [Peddler::Response] The API response
53
+ def get_supply_source(supply_source_id, rate_limit: nil)
54
+ path = "/supplySources/2020-07-01/supplySources/#{supply_source_id}"
55
+
56
+ get(path)
57
+ end
58
+
59
+ # Update the configuration and capabilities of a supply source.
60
+ #
61
+ # @note This operation can make a static sandbox call.
62
+ # @param supply_source_id [String] The unique identitier of a supply source.
63
+ # @param payload [Hash]
64
+ # @param rate_limit [Float] Requests per second
65
+ # @return [Peddler::Response] The API response
66
+ def update_supply_source(supply_source_id, payload: nil, rate_limit: nil)
67
+ path = "/supplySources/2020-07-01/supplySources/#{supply_source_id}"
68
+ body = payload
69
+
70
+ put(path, body:)
71
+ end
72
+
73
+ # Archive a supply source, making it inactive. Cannot be undone.
74
+ #
75
+ # @note This operation can make a static sandbox call.
76
+ # @param supply_source_id [String] The unique identifier of a supply source.
77
+ # @param rate_limit [Float] Requests per second
78
+ # @return [Peddler::Response] The API response
79
+ def archive_supply_source(supply_source_id, rate_limit: nil)
80
+ path = "/supplySources/2020-07-01/supplySources/#{supply_source_id}"
81
+
82
+ delete(path)
83
+ end
84
+
85
+ # Update the status of a supply source.
86
+ #
87
+ # @note This operation can make a static sandbox call.
88
+ # @param supply_source_id [String] The unique identifier of a supply source.
89
+ # @param payload [Hash]
90
+ # @param rate_limit [Float] Requests per second
91
+ # @return [Peddler::Response] The API response
92
+ def update_supply_source_status(supply_source_id, payload: nil, rate_limit: nil)
93
+ path = "/supplySources/2020-07-01/supplySources/#{supply_source_id}/status"
94
+ body = payload
95
+
96
+ put(path, body:)
97
+ end
98
+ end
99
+ end
100
+ end
@@ -3,14 +3,20 @@
3
3
  require "peddler/api"
4
4
 
5
5
  module Peddler
6
- class API
6
+ class << self
7
+ def tokens_2021_03_01(...)
8
+ APIs::Tokens20210301.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
7
13
  # Selling Partner API for Tokens
8
14
  #
9
15
  # The Selling Partner API for Tokens provides a secure way to access a customer's PII (Personally Identifiable
10
16
  # Information). You can call the Tokens API to get a Restricted Data Token (RDT) for one or more restricted
11
17
  # resources that you specify. The RDT authorizes subsequent calls to restricted operations that correspond to the
12
- # restricted resources that you specified. For more information, see the [Tokens API Use Case
13
- # Guide](doc:tokens-api-use-case-guide).
18
+ # restricted resources that you specified. For more information, see the
19
+ # {https://developer-docs.amazon.com/sp-api/docs/tokens-api-use-case-guide Tokens API Use Case Guide}.
14
20
  class Tokens20210301 < API
15
21
  # Returns a Restricted Data Token (RDT) for one or more restricted resources that you specify. A restricted
16
22
  # resource is the HTTP method and path from a restricted operation that returns Personally Identifiable
@@ -18,12 +24,14 @@ module Peddler
18
24
  # Case Guide for a list of restricted operations. Use the RDT returned here as the access token in subsequent
19
25
  # calls to the corresponding restricted operations.
20
26
  #
21
- # @param [Hash] body The restricted data token request details.
22
- # @return [Hash] The API response
23
- def create_restricted_data_token(body)
27
+ # @note This operation can make a static sandbox call.
28
+ # @param body [Hash] The restricted data token request details.
29
+ # @param rate_limit [Float] Requests per second
30
+ # @return [Peddler::Response] The API response
31
+ def create_restricted_data_token(body, rate_limit: 1.0)
24
32
  path = "/tokens/2021-03-01/restrictedDataToken"
25
33
 
26
- rate_limit(1.0).post(path, body:)
34
+ meter(rate_limit).post(path, body:)
27
35
  end
28
36
  end
29
37
  end