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
@@ -53,13 +53,17 @@ module Peddler
53
53
  # @param sku [String] Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an
54
54
  # error. Do not include this filter if you want the response to include order metrics for all SKUs. Example:
55
55
  # TestSKU, if you want the response to include order metrics for only SKU TestSKU.
56
+ # @param amazon_program [String] Filters the results by the Amazon program that you specify. Do not include this
57
+ # filter if you want the response to include order metrics for all programs. **Example:** `AmazonHaul` returns
58
+ # order metrics for the Amazon Haul program only.
56
59
  # @param rate_limit [Float] Requests per second
57
60
  # @return [Peddler::Response] The API response
58
61
  def get_order_metrics(marketplace_ids, interval, granularity, granularity_time_zone: nil, buyer_type: "All",
59
- fulfillment_network: nil, first_day_of_week: "Monday", asin: nil, sku: nil, rate_limit: 0.5)
62
+ fulfillment_network: nil, first_day_of_week: "Monday", asin: nil, sku: nil, amazon_program: nil,
63
+ rate_limit: 0.5)
60
64
  path = "/sales/v1/orderMetrics"
61
65
  params = {
62
- "marketplaceIds" => marketplace_ids,
66
+ "marketplaceIds" => stringify_array(marketplace_ids),
63
67
  "interval" => interval,
64
68
  "granularityTimeZone" => granularity_time_zone,
65
69
  "granularity" => granularity,
@@ -68,6 +72,7 @@ module Peddler
68
72
  "firstDayOfWeek" => first_day_of_week,
69
73
  "asin" => asin,
70
74
  "sku" => sku,
75
+ "amazonProgram" => amazon_program,
71
76
  }.compact
72
77
 
73
78
  meter(rate_limit).get(path, params:)
@@ -38,7 +38,7 @@ module Peddler
38
38
  # @param account_id [String] The ID of the Amazon Seller Wallet account.
39
39
  # @return [Peddler::Response] The API response
40
40
  def get_account(account_id)
41
- path = "/finances/transfers/wallet/2024-03-01/accounts/#{account_id}"
41
+ path = "/finances/transfers/wallet/2024-03-01/accounts/#{percent_encode(account_id)}"
42
42
 
43
43
  get(path)
44
44
  end
@@ -49,7 +49,7 @@ module Peddler
49
49
  # @param account_id [String] The ID of the Amazon Seller Wallet account.
50
50
  # @return [Peddler::Response] The API response
51
51
  def list_account_balances(account_id)
52
- path = "/finances/transfers/wallet/2024-03-01/accounts/#{account_id}/balance"
52
+ path = "/finances/transfers/wallet/2024-03-01/accounts/#{percent_encode(account_id)}/balance"
53
53
 
54
54
  get(path)
55
55
  end
@@ -116,7 +116,7 @@ module Peddler
116
116
  # @param transaction_id [String] The ID of the Amazon Seller Wallet transaction.
117
117
  # @return [Peddler::Response] The API response
118
118
  def get_transaction(transaction_id)
119
- path = "/finances/transfers/wallet/2024-03-01/transactions/#{transaction_id}"
119
+ path = "/finances/transfers/wallet/2024-03-01/transactions/#{percent_encode(transaction_id)}"
120
120
 
121
121
  get(path)
122
122
  end
@@ -174,7 +174,7 @@ module Peddler
174
174
  # @param transfer_schedule_id [String] The schedule ID of the Amazon Seller Wallet transfer.
175
175
  # @return [Peddler::Response] The API response
176
176
  def get_transfer_schedule(transfer_schedule_id)
177
- path = "/finances/transfers/wallet/2024-03-01/transferSchedules/#{transfer_schedule_id}"
177
+ path = "/finances/transfers/wallet/2024-03-01/transferSchedules/#{percent_encode(transfer_schedule_id)}"
178
178
 
179
179
  get(path)
180
180
  end
@@ -186,7 +186,7 @@ module Peddler
186
186
  # @param transfer_schedule_id [String] A unique reference ID for a scheduled transfer.
187
187
  # @return [Peddler::Response] The API response
188
188
  def delete_schedule_transaction(transfer_schedule_id)
189
- path = "/finances/transfers/wallet/2024-03-01/transferSchedules/#{transfer_schedule_id}"
189
+ path = "/finances/transfers/wallet/2024-03-01/transferSchedules/#{percent_encode(transfer_schedule_id)}"
190
190
 
191
191
  delete(path)
192
192
  end
@@ -22,7 +22,7 @@ module Peddler
22
22
  # @param rate_limit [Float] Requests per second
23
23
  # @return [Peddler::Response] The API response
24
24
  def get_service_job_by_service_job_id(service_job_id, rate_limit: 20.0)
25
- path = "/service/v1/serviceJobs/#{service_job_id}"
25
+ path = "/service/v1/serviceJobs/#{percent_encode(service_job_id)}"
26
26
 
27
27
  meter(rate_limit).get(path)
28
28
  end
@@ -36,7 +36,7 @@ module Peddler
36
36
  # @param rate_limit [Float] Requests per second
37
37
  # @return [Peddler::Response] The API response
38
38
  def cancel_service_job_by_service_job_id(service_job_id, cancellation_reason_code, rate_limit: 5.0)
39
- path = "/service/v1/serviceJobs/#{service_job_id}/cancellations"
39
+ path = "/service/v1/serviceJobs/#{percent_encode(service_job_id)}/cancellations"
40
40
  params = {
41
41
  "cancellationReasonCode" => cancellation_reason_code,
42
42
  }.compact
@@ -51,7 +51,7 @@ module Peddler
51
51
  # @param rate_limit [Float] Requests per second
52
52
  # @return [Peddler::Response] The API response
53
53
  def complete_service_job_by_service_job_id(service_job_id, rate_limit: 5.0)
54
- path = "/service/v1/serviceJobs/#{service_job_id}/completions"
54
+ path = "/service/v1/serviceJobs/#{percent_encode(service_job_id)}/completions"
55
55
 
56
56
  meter(rate_limit).put(path)
57
57
  end
@@ -97,8 +97,8 @@ module Peddler
97
97
  required_skills: nil, store_ids: nil, rate_limit: 10.0)
98
98
  path = "/service/v1/serviceJobs"
99
99
  params = {
100
- "serviceOrderIds" => service_order_ids,
101
- "serviceJobStatus" => service_job_status,
100
+ "serviceOrderIds" => stringify_array(service_order_ids),
101
+ "serviceJobStatus" => stringify_array(service_job_status),
102
102
  "pageToken" => page_token,
103
103
  "pageSize" => page_size,
104
104
  "sortField" => sort_field,
@@ -109,10 +109,10 @@ module Peddler
109
109
  "lastUpdatedBefore" => last_updated_before,
110
110
  "scheduleStartDate" => schedule_start_date,
111
111
  "scheduleEndDate" => schedule_end_date,
112
- "marketplaceIds" => marketplace_ids,
113
- "asins" => asins,
114
- "requiredSkills" => required_skills,
115
- "storeIds" => store_ids,
112
+ "marketplaceIds" => stringify_array(marketplace_ids),
113
+ "asins" => stringify_array(asins),
114
+ "requiredSkills" => stringify_array(required_skills),
115
+ "storeIds" => stringify_array(store_ids),
116
116
  }.compact
117
117
 
118
118
  meter(rate_limit).get(path, params:)
@@ -126,7 +126,7 @@ module Peddler
126
126
  # @param rate_limit [Float] Requests per second
127
127
  # @return [Peddler::Response] The API response
128
128
  def add_appointment_for_service_job_by_service_job_id(service_job_id, body, rate_limit: 5.0)
129
- path = "/service/v1/serviceJobs/#{service_job_id}/appointments"
129
+ path = "/service/v1/serviceJobs/#{percent_encode(service_job_id)}/appointments"
130
130
 
131
131
  meter(rate_limit).post(path, body:)
132
132
  end
@@ -141,7 +141,7 @@ module Peddler
141
141
  # @return [Peddler::Response] The API response
142
142
  def reschedule_appointment_for_service_job_by_service_job_id(service_job_id, appointment_id, body,
143
143
  rate_limit: 5.0)
144
- path = "/service/v1/serviceJobs/#{service_job_id}/appointments/#{appointment_id}"
144
+ path = "/service/v1/serviceJobs/#{percent_encode(service_job_id)}/appointments/#{percent_encode(appointment_id)}"
145
145
 
146
146
  meter(rate_limit).post(path, body:)
147
147
  end
@@ -156,7 +156,7 @@ module Peddler
156
156
  # @param rate_limit [Float] Requests per second
157
157
  # @return [Peddler::Response] The API response
158
158
  def assign_appointment_resources(service_job_id, appointment_id, body, rate_limit: 1.0)
159
- path = "/service/v1/serviceJobs/#{service_job_id}/appointments/#{appointment_id}/resources"
159
+ path = "/service/v1/serviceJobs/#{percent_encode(service_job_id)}/appointments/#{percent_encode(appointment_id)}/resources"
160
160
 
161
161
  meter(rate_limit).put(path, body:)
162
162
  end
@@ -171,7 +171,7 @@ module Peddler
171
171
  # @param rate_limit [Float] Requests per second
172
172
  # @return [Peddler::Response] The API response
173
173
  def set_appointment_fulfillment_data(service_job_id, appointment_id, body, rate_limit: 5.0)
174
- path = "/service/v1/serviceJobs/#{service_job_id}/appointments/#{appointment_id}/fulfillment"
174
+ path = "/service/v1/serviceJobs/#{percent_encode(service_job_id)}/appointments/#{percent_encode(appointment_id)}/fulfillment"
175
175
 
176
176
  meter(rate_limit).put(path, body:)
177
177
  end
@@ -186,9 +186,9 @@ module Peddler
186
186
  # @param rate_limit [Float] Requests per second
187
187
  # @return [Peddler::Response] The API response
188
188
  def get_range_slot_capacity(resource_id, body, marketplace_ids, next_page_token: nil, rate_limit: 5.0)
189
- path = "/service/v1/serviceResources/#{resource_id}/capacity/range"
189
+ path = "/service/v1/serviceResources/#{percent_encode(resource_id)}/capacity/range"
190
190
  params = {
191
- "marketplaceIds" => marketplace_ids,
191
+ "marketplaceIds" => stringify_array(marketplace_ids),
192
192
  "nextPageToken" => next_page_token,
193
193
  }.compact
194
194
 
@@ -205,9 +205,9 @@ module Peddler
205
205
  # @param rate_limit [Float] Requests per second
206
206
  # @return [Peddler::Response] The API response
207
207
  def get_fixed_slot_capacity(resource_id, body, marketplace_ids, next_page_token: nil, rate_limit: 5.0)
208
- path = "/service/v1/serviceResources/#{resource_id}/capacity/fixed"
208
+ path = "/service/v1/serviceResources/#{percent_encode(resource_id)}/capacity/fixed"
209
209
  params = {
210
- "marketplaceIds" => marketplace_ids,
210
+ "marketplaceIds" => stringify_array(marketplace_ids),
211
211
  "nextPageToken" => next_page_token,
212
212
  }.compact
213
213
 
@@ -223,9 +223,9 @@ module Peddler
223
223
  # @param rate_limit [Float] Requests per second
224
224
  # @return [Peddler::Response] The API response
225
225
  def update_schedule(resource_id, body, marketplace_ids, rate_limit: 5.0)
226
- path = "/service/v1/serviceResources/#{resource_id}/schedules"
226
+ path = "/service/v1/serviceResources/#{percent_encode(resource_id)}/schedules"
227
227
  params = {
228
- "marketplaceIds" => marketplace_ids,
228
+ "marketplaceIds" => stringify_array(marketplace_ids),
229
229
  }.compact
230
230
 
231
231
  meter(rate_limit).put(path, body:, params:)
@@ -241,7 +241,7 @@ module Peddler
241
241
  def create_reservation(body, marketplace_ids, rate_limit: 5.0)
242
242
  path = "/service/v1/reservation"
243
243
  params = {
244
- "marketplaceIds" => marketplace_ids,
244
+ "marketplaceIds" => stringify_array(marketplace_ids),
245
245
  }.compact
246
246
 
247
247
  meter(rate_limit).post(path, body:, params:)
@@ -256,9 +256,9 @@ module Peddler
256
256
  # @param rate_limit [Float] Requests per second
257
257
  # @return [Peddler::Response] The API response
258
258
  def update_reservation(reservation_id, body, marketplace_ids, rate_limit: 5.0)
259
- path = "/service/v1/reservation/#{reservation_id}"
259
+ path = "/service/v1/reservation/#{percent_encode(reservation_id)}"
260
260
  params = {
261
- "marketplaceIds" => marketplace_ids,
261
+ "marketplaceIds" => stringify_array(marketplace_ids),
262
262
  }.compact
263
263
 
264
264
  meter(rate_limit).put(path, body:, params:)
@@ -272,9 +272,9 @@ module Peddler
272
272
  # @param rate_limit [Float] Requests per second
273
273
  # @return [Peddler::Response] The API response
274
274
  def cancel_reservation(reservation_id, marketplace_ids, rate_limit: 5.0)
275
- path = "/service/v1/reservation/#{reservation_id}"
275
+ path = "/service/v1/reservation/#{percent_encode(reservation_id)}"
276
276
  params = {
277
- "marketplaceIds" => marketplace_ids,
277
+ "marketplaceIds" => stringify_array(marketplace_ids),
278
278
  }.compact
279
279
 
280
280
  meter(rate_limit).delete(path, params:)
@@ -295,9 +295,9 @@ module Peddler
295
295
  # @return [Peddler::Response] The API response
296
296
  def get_appointmment_slots_by_job_id(service_job_id, marketplace_ids, start_time: nil, end_time: nil,
297
297
  rate_limit: 5.0)
298
- path = "/service/v1/serviceJobs/#{service_job_id}/appointmentSlots"
298
+ path = "/service/v1/serviceJobs/#{percent_encode(service_job_id)}/appointmentSlots"
299
299
  params = {
300
- "marketplaceIds" => marketplace_ids,
300
+ "marketplaceIds" => stringify_array(marketplace_ids),
301
301
  "startTime" => start_time,
302
302
  "endTime" => end_time,
303
303
  }.compact
@@ -324,7 +324,7 @@ module Peddler
324
324
  params = {
325
325
  "asin" => asin,
326
326
  "storeId" => store_id,
327
- "marketplaceIds" => marketplace_ids,
327
+ "marketplaceIds" => stringify_array(marketplace_ids),
328
328
  "startTime" => start_time,
329
329
  "endTime" => end_time,
330
330
  }.compact
@@ -25,7 +25,7 @@ module Peddler
25
25
  # @param rate_limit [Float] Requests per second
26
26
  # @return [Peddler::Response] The API response
27
27
  def get_shipment_details(shipment_id, rate_limit: 1.133)
28
- path = "/fba/outbound/brazil/v0/shipments/#{shipment_id}"
28
+ path = "/fba/outbound/brazil/v0/shipments/#{percent_encode(shipment_id)}"
29
29
 
30
30
  meter(rate_limit).get(path)
31
31
  end
@@ -38,7 +38,7 @@ module Peddler
38
38
  # @param rate_limit [Float] Requests per second
39
39
  # @return [Peddler::Response] The API response
40
40
  def submit_invoice(shipment_id, body, rate_limit: 1.133)
41
- path = "/fba/outbound/brazil/v0/shipments/#{shipment_id}/invoice"
41
+ path = "/fba/outbound/brazil/v0/shipments/#{percent_encode(shipment_id)}/invoice"
42
42
 
43
43
  meter(rate_limit).post(path, body:)
44
44
  end
@@ -50,7 +50,7 @@ module Peddler
50
50
  # @param rate_limit [Float] Requests per second
51
51
  # @return [Peddler::Response] The API response
52
52
  def get_invoice_status(shipment_id, rate_limit: 1.133)
53
- path = "/fba/outbound/brazil/v0/shipments/#{shipment_id}/invoice/status"
53
+ path = "/fba/outbound/brazil/v0/shipments/#{percent_encode(shipment_id)}/invoice/status"
54
54
 
55
55
  meter(rate_limit).get(path)
56
56
  end
@@ -37,7 +37,7 @@ module Peddler
37
37
  # @param rate_limit [Float] Requests per second
38
38
  # @return [Peddler::Response] The API response
39
39
  def get_shipment(shipment_id, rate_limit: 5.0)
40
- path = "/shipping/v1/shipments/#{shipment_id}"
40
+ path = "/shipping/v1/shipments/#{percent_encode(shipment_id)}"
41
41
 
42
42
  meter(rate_limit).get(path)
43
43
  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 cancel_shipment(shipment_id, rate_limit: 5.0)
52
- path = "/shipping/v1/shipments/#{shipment_id}/cancel"
52
+ path = "/shipping/v1/shipments/#{percent_encode(shipment_id)}/cancel"
53
53
 
54
54
  meter(rate_limit).post(path)
55
55
  end
@@ -62,7 +62,7 @@ module Peddler
62
62
  # @param rate_limit [Float] Requests per second
63
63
  # @return [Peddler::Response] The API response
64
64
  def purchase_labels(shipment_id, body, rate_limit: 5.0)
65
- path = "/shipping/v1/shipments/#{shipment_id}/purchaseLabels"
65
+ path = "/shipping/v1/shipments/#{percent_encode(shipment_id)}/purchaseLabels"
66
66
 
67
67
  meter(rate_limit).post(path, body:)
68
68
  end
@@ -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 retrieve_shipping_label(shipment_id, tracking_id, body, rate_limit: 5.0)
79
- path = "/shipping/v1/shipments/#{shipment_id}/containers/#{tracking_id}/label"
79
+ path = "/shipping/v1/shipments/#{percent_encode(shipment_id)}/containers/#{percent_encode(tracking_id)}/label"
80
80
 
81
81
  meter(rate_limit).post(path, body:)
82
82
  end
@@ -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 get_tracking_information(tracking_id, rate_limit: 1.0)
126
- path = "/shipping/v1/tracking/#{tracking_id}"
126
+ path = "/shipping/v1/tracking/#{percent_encode(tracking_id)}"
127
127
 
128
128
  meter(rate_limit).get(path)
129
129
  end
@@ -121,7 +121,7 @@ module Peddler
121
121
  # @return [Peddler::Response] The API response
122
122
  def get_shipment_documents(shipment_id, package_client_reference_id, format: nil, dpi: nil,
123
123
  x_amzn_shipping_business_id: nil, rate_limit: 80.0)
124
- path = "/shipping/v2/shipments/#{shipment_id}/documents"
124
+ path = "/shipping/v2/shipments/#{percent_encode(shipment_id)}/documents"
125
125
  params = {
126
126
  "packageClientReferenceId" => package_client_reference_id,
127
127
  "format" => format,
@@ -140,7 +140,7 @@ module Peddler
140
140
  # @param rate_limit [Float] Requests per second
141
141
  # @return [Peddler::Response] The API response
142
142
  def cancel_shipment(shipment_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
143
- path = "/shipping/v2/shipments/#{shipment_id}/cancel"
143
+ path = "/shipping/v2/shipments/#{percent_encode(shipment_id)}/cancel"
144
144
 
145
145
  meter(rate_limit).put(path)
146
146
  end
@@ -206,7 +206,7 @@ module Peddler
206
206
  # @param rate_limit [Float] Requests per second
207
207
  # @return [Peddler::Response] The API response
208
208
  def link_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil, rate_limit: 5.0)
209
- path = "/shipping/v2/carrierAccounts/#{carrier_id}"
209
+ path = "/shipping/v2/carrierAccounts/#{percent_encode(carrier_id)}"
210
210
 
211
211
  meter(rate_limit).post(path, body:)
212
212
  end
@@ -222,7 +222,7 @@ module Peddler
222
222
  def unlink_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
223
223
  cannot_sandbox!
224
224
 
225
- path = "/shipping/v2/carrierAccounts/#{carrier_id}/unlink"
225
+ path = "/shipping/v2/carrierAccounts/#{percent_encode(carrier_id)}/unlink"
226
226
 
227
227
  meter(rate_limit).put(path, body:)
228
228
  end
@@ -286,7 +286,7 @@ module Peddler
286
286
  def get_collection_form(collection_form_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
287
287
  cannot_sandbox!
288
288
 
289
- path = "/shipping/v2/collectionForms/#{collection_form_id}"
289
+ path = "/shipping/v2/collectionForms/#{percent_encode(collection_form_id)}"
290
290
 
291
291
  meter(rate_limit).get(path)
292
292
  end
@@ -305,7 +305,7 @@ module Peddler
305
305
  rate_limit: 80.0)
306
306
  path = "/shipping/v2/accessPoints"
307
307
  params = {
308
- "accessPointTypes" => access_point_types,
308
+ "accessPointTypes" => stringify_array(access_point_types),
309
309
  "countryCode" => country_code,
310
310
  "postalCode" => postal_code,
311
311
  }.compact
@@ -32,9 +32,9 @@ module Peddler
32
32
  # @param rate_limit [Float] Requests per second
33
33
  # @return [Peddler::Response] The API response
34
34
  def get_solicitation_actions_for_order(amazon_order_id, marketplace_ids, rate_limit: 1.0)
35
- path = "/solicitations/v1/orders/#{amazon_order_id}"
35
+ path = "/solicitations/v1/orders/#{percent_encode(amazon_order_id)}"
36
36
  params = {
37
- "marketplaceIds" => marketplace_ids,
37
+ "marketplaceIds" => stringify_array(marketplace_ids),
38
38
  }.compact
39
39
 
40
40
  meter(rate_limit).get(path, params:)
@@ -51,9 +51,9 @@ module Peddler
51
51
  # @param rate_limit [Float] Requests per second
52
52
  # @return [Peddler::Response] The API response
53
53
  def create_product_review_and_seller_feedback_solicitation(amazon_order_id, marketplace_ids, rate_limit: 1.0)
54
- path = "/solicitations/v1/orders/#{amazon_order_id}/solicitations/productReviewAndSellerFeedback"
54
+ path = "/solicitations/v1/orders/#{percent_encode(amazon_order_id)}/solicitations/productReviewAndSellerFeedback"
55
55
  params = {
56
- "marketplaceIds" => marketplace_ids,
56
+ "marketplaceIds" => stringify_array(marketplace_ids),
57
57
  }.compact
58
58
 
59
59
  meter(rate_limit).post(path, params:)
@@ -48,7 +48,7 @@ module Peddler
48
48
  # @param supply_source_id [String] The unique identifier of a supply source.
49
49
  # @return [Peddler::Response] The API response
50
50
  def get_supply_source(supply_source_id)
51
- path = "/supplySources/2020-07-01/supplySources/#{supply_source_id}"
51
+ path = "/supplySources/2020-07-01/supplySources/#{percent_encode(supply_source_id)}"
52
52
 
53
53
  get(path)
54
54
  end
@@ -60,7 +60,7 @@ module Peddler
60
60
  # @param payload [Hash]
61
61
  # @return [Peddler::Response] The API response
62
62
  def update_supply_source(supply_source_id, payload: nil)
63
- path = "/supplySources/2020-07-01/supplySources/#{supply_source_id}"
63
+ path = "/supplySources/2020-07-01/supplySources/#{percent_encode(supply_source_id)}"
64
64
  body = payload
65
65
 
66
66
  put(path, body:)
@@ -72,7 +72,7 @@ module Peddler
72
72
  # @param supply_source_id [String] The unique identifier of a supply source.
73
73
  # @return [Peddler::Response] The API response
74
74
  def archive_supply_source(supply_source_id)
75
- path = "/supplySources/2020-07-01/supplySources/#{supply_source_id}"
75
+ path = "/supplySources/2020-07-01/supplySources/#{percent_encode(supply_source_id)}"
76
76
 
77
77
  delete(path)
78
78
  end
@@ -84,7 +84,7 @@ module Peddler
84
84
  # @param payload [Hash]
85
85
  # @return [Peddler::Response] The API response
86
86
  def update_supply_source_status(supply_source_id, payload: nil)
87
- path = "/supplySources/2020-07-01/supplySources/#{supply_source_id}/status"
87
+ path = "/supplySources/2020-07-01/supplySources/#{percent_encode(supply_source_id)}/status"
88
88
  body = payload
89
89
 
90
90
  put(path, body:)
@@ -37,9 +37,9 @@ module Peddler
37
37
  rate_limit: 10.0)
38
38
  cannot_sandbox!
39
39
 
40
- path = "/uploads/2020-11-01/uploadDestinations/#{resource}"
40
+ path = "/uploads/2020-11-01/uploadDestinations/#{percent_encode(resource)}"
41
41
  params = {
42
- "marketplaceIds" => marketplace_ids,
42
+ "marketplaceIds" => stringify_array(marketplace_ids),
43
43
  "contentMD5" => content_md5,
44
44
  "contentType" => content_type,
45
45
  }.compact
@@ -23,7 +23,7 @@ module Peddler
23
23
  # @param rate_limit [Float] Requests per second
24
24
  # @return [Peddler::Response] The API response
25
25
  def submit_inventory_update(body, warehouse_id, rate_limit: 10.0)
26
- path = "/vendor/directFulfillment/inventory/v1/warehouses/#{warehouse_id}/items"
26
+ path = "/vendor/directFulfillment/inventory/v1/warehouses/#{percent_encode(warehouse_id)}/items"
27
27
 
28
28
  meter(rate_limit).post(path, body:)
29
29
  end
@@ -63,7 +63,7 @@ module Peddler
63
63
  # @param rate_limit [Float] Requests per second
64
64
  # @return [Peddler::Response] The API response
65
65
  def get_order(purchase_order_number, rate_limit: 10.0)
66
- path = "/vendor/directFulfillment/orders/2021-12-28/purchaseOrders/#{purchase_order_number}"
66
+ path = "/vendor/directFulfillment/orders/2021-12-28/purchaseOrders/#{percent_encode(purchase_order_number)}"
67
67
 
68
68
  meter(rate_limit).get(path)
69
69
  end
@@ -63,7 +63,7 @@ module Peddler
63
63
  # @param rate_limit [Float] Requests per second
64
64
  # @return [Peddler::Response] The API response
65
65
  def get_order(purchase_order_number, rate_limit: 10.0)
66
- path = "/vendor/directFulfillment/orders/v1/purchaseOrders/#{purchase_order_number}"
66
+ path = "/vendor/directFulfillment/orders/v1/purchaseOrders/#{percent_encode(purchase_order_number)}"
67
67
 
68
68
  meter(rate_limit).get(path)
69
69
  end
@@ -34,7 +34,7 @@ module Peddler
34
34
  # operation.
35
35
  # @return [Peddler::Response] The API response
36
36
  def get_order_scenarios(transaction_id)
37
- path = "/vendor/directFulfillment/sandbox/2021-10-28/transactions/#{transaction_id}"
37
+ path = "/vendor/directFulfillment/sandbox/2021-10-28/transactions/#{percent_encode(transaction_id)}"
38
38
 
39
39
  get(path)
40
40
  end
@@ -68,7 +68,7 @@ module Peddler
68
68
  # @param rate_limit [Float] Requests per second
69
69
  # @return [Peddler::Response] The API response
70
70
  def get_shipping_label(purchase_order_number, rate_limit: 10.0)
71
- path = "/vendor/directFulfillment/shipping/2021-12-28/shippingLabels/#{purchase_order_number}"
71
+ path = "/vendor/directFulfillment/shipping/2021-12-28/shippingLabels/#{percent_encode(purchase_order_number)}"
72
72
 
73
73
  meter(rate_limit).get(path)
74
74
  end
@@ -82,7 +82,7 @@ module Peddler
82
82
  # @param rate_limit [Float] Requests per second
83
83
  # @return [Peddler::Response] The API response
84
84
  def create_shipping_labels(purchase_order_number, body, rate_limit: 10.0)
85
- path = "/vendor/directFulfillment/shipping/2021-12-28/shippingLabels/#{purchase_order_number}"
85
+ path = "/vendor/directFulfillment/shipping/2021-12-28/shippingLabels/#{percent_encode(purchase_order_number)}"
86
86
 
87
87
  meter(rate_limit).post(path, body:)
88
88
  end
@@ -152,7 +152,7 @@ module Peddler
152
152
  # @param rate_limit [Float] Requests per second
153
153
  # @return [Peddler::Response] The API response
154
154
  def get_customer_invoice(purchase_order_number, rate_limit: 10.0)
155
- path = "/vendor/directFulfillment/shipping/2021-12-28/customerInvoices/#{purchase_order_number}"
155
+ path = "/vendor/directFulfillment/shipping/2021-12-28/customerInvoices/#{percent_encode(purchase_order_number)}"
156
156
 
157
157
  meter(rate_limit).get(path)
158
158
  end
@@ -195,7 +195,7 @@ module Peddler
195
195
  # @param rate_limit [Float] Requests per second
196
196
  # @return [Peddler::Response] The API response
197
197
  def get_packing_slip(purchase_order_number, rate_limit: 10.0)
198
- path = "/vendor/directFulfillment/shipping/2021-12-28/packingSlips/#{purchase_order_number}"
198
+ path = "/vendor/directFulfillment/shipping/2021-12-28/packingSlips/#{percent_encode(purchase_order_number)}"
199
199
 
200
200
  meter(rate_limit).get(path)
201
201
  end
@@ -67,7 +67,7 @@ module Peddler
67
67
  # @param rate_limit [Float] Requests per second
68
68
  # @return [Peddler::Response] The API response
69
69
  def get_shipping_label(purchase_order_number, rate_limit: 10.0)
70
- path = "/vendor/directFulfillment/shipping/v1/shippingLabels/#{purchase_order_number}"
70
+ path = "/vendor/directFulfillment/shipping/v1/shippingLabels/#{percent_encode(purchase_order_number)}"
71
71
 
72
72
  meter(rate_limit).get(path)
73
73
  end
@@ -137,7 +137,7 @@ module Peddler
137
137
  # @param rate_limit [Float] Requests per second
138
138
  # @return [Peddler::Response] The API response
139
139
  def get_customer_invoice(purchase_order_number, rate_limit: 10.0)
140
- path = "/vendor/directFulfillment/shipping/v1/customerInvoices/#{purchase_order_number}"
140
+ path = "/vendor/directFulfillment/shipping/v1/customerInvoices/#{percent_encode(purchase_order_number)}"
141
141
 
142
142
  meter(rate_limit).get(path)
143
143
  end
@@ -180,7 +180,7 @@ module Peddler
180
180
  # @param rate_limit [Float] Requests per second
181
181
  # @return [Peddler::Response] The API response
182
182
  def get_packing_slip(purchase_order_number, rate_limit: 10.0)
183
- path = "/vendor/directFulfillment/shipping/v1/packingSlips/#{purchase_order_number}"
183
+ path = "/vendor/directFulfillment/shipping/v1/packingSlips/#{percent_encode(purchase_order_number)}"
184
184
 
185
185
  meter(rate_limit).get(path)
186
186
  end
@@ -23,7 +23,7 @@ module Peddler
23
23
  # @param rate_limit [Float] Requests per second
24
24
  # @return [Peddler::Response] The API response
25
25
  def get_transaction_status(transaction_id, rate_limit: 10.0)
26
- path = "/vendor/directFulfillment/transactions/2021-12-28/transactions/#{transaction_id}"
26
+ path = "/vendor/directFulfillment/transactions/2021-12-28/transactions/#{percent_encode(transaction_id)}"
27
27
 
28
28
  meter(rate_limit).get(path)
29
29
  end
@@ -23,7 +23,7 @@ module Peddler
23
23
  # @param rate_limit [Float] Requests per second
24
24
  # @return [Peddler::Response] The API response
25
25
  def get_transaction_status(transaction_id, rate_limit: 10.0)
26
- path = "/vendor/directFulfillment/transactions/v1/transactions/#{transaction_id}"
26
+ path = "/vendor/directFulfillment/transactions/v1/transactions/#{percent_encode(transaction_id)}"
27
27
 
28
28
  meter(rate_limit).get(path)
29
29
  end
@@ -78,7 +78,7 @@ module Peddler
78
78
  # @param rate_limit [Float] Requests per second
79
79
  # @return [Peddler::Response] The API response
80
80
  def get_purchase_order(purchase_order_number, rate_limit: 10.0)
81
- path = "/vendor/orders/v1/purchaseOrders/#{purchase_order_number}"
81
+ path = "/vendor/orders/v1/purchaseOrders/#{percent_encode(purchase_order_number)}"
82
82
 
83
83
  meter(rate_limit).get(path)
84
84
  end
@@ -132,7 +132,7 @@ module Peddler
132
132
  #
133
133
  # @param limit [Integer] The limit to the number of records returned. Default value is 50 records.
134
134
  # @param sort_order [String] Sort the list by shipment label creation date in ascending or descending order.
135
- # @param next_token [String] A token that is used to retrieve the next page of results. The response includes
135
+ # @param next_token [String] A token that you use to retrieve the next page of results. The response includes
136
136
  # `nextToken` when the number of results exceeds the specified `pageSize` value. To get the next page of
137
137
  # results, call the operation with this token and include the same arguments as the call that produced the
138
138
  # token. To get a complete list, call this operation until `nextToken` is null. Note that this operation can
@@ -24,7 +24,7 @@ module Peddler
24
24
  def get_transaction(transaction_id, rate_limit: 10.0)
25
25
  cannot_sandbox!
26
26
 
27
- path = "/vendor/transactions/v1/transactions/#{transaction_id}"
27
+ path = "/vendor/transactions/v1/transactions/#{percent_encode(transaction_id)}"
28
28
 
29
29
  meter(rate_limit).get(path)
30
30
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Peddler
4
+ class << self
5
+ attr_writer :raise_on_server_errors
6
+
7
+ def raise_on_server_errors
8
+ return @raise_on_server_errors if defined?(@raise_on_server_errors)
9
+
10
+ @raise_on_server_errors = false # Default to v4 behavior
11
+ end
12
+
13
+ def configure
14
+ yield self
15
+ end
16
+ end
17
+ end