peddler 2.4.5 → 3.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 (107) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +402 -140
  3. data/lib/peddler/api/amazon_warehousing_and_distribution_2024_05_09.rb +92 -0
  4. data/lib/peddler/api/aplus_content_2020_11_01.rb +246 -0
  5. data/lib/peddler/api/application_integrations_2024_04_01.rb +56 -0
  6. data/lib/peddler/api/application_management_2023_11_30.rb +35 -0
  7. data/lib/peddler/api/catalog_items_2020_12_01.rb +81 -0
  8. data/lib/peddler/api/catalog_items_2022_04_01.rb +93 -0
  9. data/lib/peddler/api/catalog_items_v0.rb +103 -0
  10. data/lib/peddler/api/data_kiosk_2023_11_15.rb +108 -0
  11. data/lib/peddler/api/easy_ship_2022_03_23.rb +127 -0
  12. data/lib/peddler/api/fba_inbound_eligibility_v1.rb +44 -0
  13. data/lib/peddler/api/fba_inventory_v1.rb +122 -0
  14. data/lib/peddler/api/feeds_2021_06_30.rb +122 -0
  15. data/lib/peddler/api/finances_2024_06_19.rb +50 -0
  16. data/lib/peddler/api/finances_v0.rb +148 -0
  17. data/lib/peddler/api/fulfillment_inbound_2024_03_20.rb +759 -0
  18. data/lib/peddler/api/fulfillment_inbound_v0.rb +352 -0
  19. data/lib/peddler/api/fulfillment_outbound_2020_07_01.rb +259 -0
  20. data/lib/peddler/api/invoices_2024_06_19.rb +180 -0
  21. data/lib/peddler/api/listings_items_2020_09_01.rb +95 -0
  22. data/lib/peddler/api/listings_items_2021_08_01.rb +170 -0
  23. data/lib/peddler/api/listings_restrictions_2021_08_01.rb +47 -0
  24. data/lib/peddler/api/merchant_fulfillment_v0.rb +80 -0
  25. data/lib/peddler/api/messaging_v1.rb +273 -0
  26. data/lib/peddler/api/notifications_v1.rb +145 -0
  27. data/lib/peddler/api/orders_v0.rb +279 -0
  28. data/lib/peddler/api/product_fees_v0.rb +77 -0
  29. data/lib/peddler/api/product_pricing_2022_05_01.rb +54 -0
  30. data/lib/peddler/api/product_pricing_v0.rb +162 -0
  31. data/lib/peddler/api/product_type_definitions_2020_09_01.rb +86 -0
  32. data/lib/peddler/api/replenishment_2022_11_07.rb +57 -0
  33. data/lib/peddler/api/reports_2021_06_30.rb +163 -0
  34. data/lib/peddler/api/sales_v1.rb +77 -0
  35. data/lib/peddler/api/sellers_v1.rb +45 -0
  36. data/lib/peddler/api/services_v1.rb +348 -0
  37. data/lib/peddler/api/shipment_invoicing_v0.rb +59 -0
  38. data/lib/peddler/api/shipping_v1.rb +132 -0
  39. data/lib/peddler/api/shipping_v2.rb +319 -0
  40. data/lib/peddler/api/solicitations_v1.rb +63 -0
  41. data/lib/peddler/api/supply_sources_2020_07_01.rb +100 -0
  42. data/lib/peddler/api/tokens_2021_03_01.rb +38 -0
  43. data/lib/peddler/api/uploads_2020_11_01.rb +50 -0
  44. data/lib/peddler/api/vendor_direct_fulfillment_inventory_v1.rb +32 -0
  45. data/lib/peddler/api/vendor_direct_fulfillment_orders_2021_12_28.rb +84 -0
  46. data/lib/peddler/api/vendor_direct_fulfillment_orders_v1.rb +84 -0
  47. data/lib/peddler/api/vendor_direct_fulfillment_payments_v1.rb +31 -0
  48. data/lib/peddler/api/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +45 -0
  49. data/lib/peddler/api/vendor_direct_fulfillment_shipping_2021_12_28.rb +203 -0
  50. data/lib/peddler/api/vendor_direct_fulfillment_shipping_v1.rb +189 -0
  51. data/lib/peddler/api/vendor_direct_fulfillment_transactions_2021_12_28.rb +32 -0
  52. data/lib/peddler/api/vendor_direct_fulfillment_transactions_v1.rb +32 -0
  53. data/lib/peddler/api/vendor_invoices_v1.rb +30 -0
  54. data/lib/peddler/api/vendor_orders_v1.rb +159 -0
  55. data/lib/peddler/api/vendor_shipments_v1.rb +132 -0
  56. data/lib/peddler/api/vendor_transaction_status_v1.rb +33 -0
  57. data/lib/peddler/api.rb +138 -0
  58. data/lib/peddler/endpoint.rb +51 -0
  59. data/lib/peddler/error.rb +31 -0
  60. data/lib/peddler/marketplace.rb +38 -68
  61. data/lib/peddler/token.rb +70 -0
  62. data/lib/peddler/version.rb +1 -1
  63. data/lib/peddler.rb +56 -1
  64. metadata +74 -80
  65. data/lib/mws/easy_ship/client.rb +0 -93
  66. data/lib/mws/easy_ship.rb +0 -3
  67. data/lib/mws/feeds/client.rb +0 -122
  68. data/lib/mws/feeds.rb +0 -3
  69. data/lib/mws/finances/client.rb +0 -82
  70. data/lib/mws/finances.rb +0 -3
  71. data/lib/mws/fulfillment_inbound_shipment/client.rb +0 -388
  72. data/lib/mws/fulfillment_inbound_shipment.rb +0 -3
  73. data/lib/mws/fulfillment_inventory/client.rb +0 -57
  74. data/lib/mws/fulfillment_inventory.rb +0 -3
  75. data/lib/mws/fulfillment_outbound_shipment/client.rb +0 -211
  76. data/lib/mws/fulfillment_outbound_shipment.rb +0 -3
  77. data/lib/mws/merchant_fulfillment/client.rb +0 -87
  78. data/lib/mws/merchant_fulfillment.rb +0 -3
  79. data/lib/mws/off_amazon_payments.rb +0 -3
  80. data/lib/mws/orders/client.rb +0 -120
  81. data/lib/mws/orders.rb +0 -3
  82. data/lib/mws/products/client.rb +0 -268
  83. data/lib/mws/products.rb +0 -3
  84. data/lib/mws/recommendations/client.rb +0 -72
  85. data/lib/mws/recommendations.rb +0 -3
  86. data/lib/mws/reports/client.rb +0 -236
  87. data/lib/mws/reports.rb +0 -3
  88. data/lib/mws/sellers/client.rb +0 -44
  89. data/lib/mws/sellers.rb +0 -3
  90. data/lib/mws/shipment_invoicing/client.rb +0 -74
  91. data/lib/mws/shipment_invoicing.rb +0 -3
  92. data/lib/mws/subscriptions/client.rb +0 -179
  93. data/lib/mws/subscriptions.rb +0 -3
  94. data/lib/mws.rb +0 -29
  95. data/lib/peddler/client.rb +0 -159
  96. data/lib/peddler/errors/builder.rb +0 -64
  97. data/lib/peddler/errors/class_generator.rb +0 -40
  98. data/lib/peddler/errors/error.rb +0 -45
  99. data/lib/peddler/errors/parser.rb +0 -28
  100. data/lib/peddler/flat_file_parser.rb +0 -56
  101. data/lib/peddler/headers.rb +0 -102
  102. data/lib/peddler/operation.rb +0 -78
  103. data/lib/peddler/parser.rb +0 -33
  104. data/lib/peddler/structured_list.rb +0 -23
  105. data/lib/peddler/vcr_matcher.rb +0 -97
  106. data/lib/peddler/xml_parser.rb +0 -38
  107. data/lib/peddler/xml_response_parser.rb +0 -25
@@ -0,0 +1,348 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def services_v1(...)
8
+ API::ServicesV1.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Services
14
+ #
15
+ # With the Services API, you can build applications that help service providers get and modify their service orders
16
+ # and manage their resources.
17
+ class ServicesV1 < API
18
+ # Gets details of service job indicated by the provided `serviceJobID`.
19
+ #
20
+ # @note This operation can make a static sandbox call.
21
+ # @param service_job_id [String] A service job identifier.
22
+ # @param rate_limit [Float] Requests per second
23
+ # @return [Hash] The API response
24
+ def get_service_job_by_service_job_id(service_job_id, rate_limit: 20.0)
25
+ path = "/service/v1/serviceJobs/#{service_job_id}"
26
+
27
+ meter(rate_limit).get(path)
28
+ end
29
+
30
+ # Cancels the service job indicated by the service job identifier specified.
31
+ #
32
+ # @note This operation can make a static sandbox call.
33
+ # @param service_job_id [String] An Amazon defined service job identifier.
34
+ # @param cancellation_reason_code [String] A cancel reason code that specifies the reason for cancelling a service
35
+ # job.
36
+ # @param rate_limit [Float] Requests per second
37
+ # @return [Hash] The API response
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"
40
+ params = {
41
+ "cancellationReasonCode" => cancellation_reason_code,
42
+ }.compact
43
+
44
+ meter(rate_limit).put(path, params:)
45
+ end
46
+
47
+ # Completes the service job indicated by the service job identifier specified.
48
+ #
49
+ # @note This operation can make a static sandbox call.
50
+ # @param service_job_id [String] An Amazon defined service job identifier.
51
+ # @param rate_limit [Float] Requests per second
52
+ # @return [Hash] The API response
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"
55
+
56
+ meter(rate_limit).put(path)
57
+ end
58
+
59
+ # Gets service job details for the specified filter query.
60
+ #
61
+ # @note This operation can make a static sandbox call.
62
+ # @param service_order_ids [Array<String>] List of service order ids for the query you want to perform.Max values
63
+ # supported 20.
64
+ # @param service_job_status [Array<String>] A list of one or more job status by which to filter the list of jobs.
65
+ # @param page_token [String] String returned in the response of your previous request.
66
+ # @param page_size [Integer] A non-negative integer that indicates the maximum number of jobs to return in the
67
+ # list, Value must be 1 - 20. Default 20.
68
+ # @param sort_field [String] Sort fields on which you want to sort the output.
69
+ # @param sort_order [String] Sort order for the query you want to perform.
70
+ # @param created_after [String] A date used for selecting jobs created at or after a specified time. Must be in
71
+ # ISO 8601 format. Required if `LastUpdatedAfter` is not specified. Specifying both `CreatedAfter` and
72
+ # `LastUpdatedAfter` returns an error.
73
+ # @param created_before [String] A date used for selecting jobs created at or before a specified time. Must be in
74
+ # ISO 8601 format.
75
+ # @param last_updated_after [String] A date used for selecting jobs updated at or after a specified time. Must be
76
+ # in ISO 8601 format. Required if `createdAfter` is not specified. Specifying both `CreatedAfter` and
77
+ # `LastUpdatedAfter` returns an error.
78
+ # @param last_updated_before [String] A date used for selecting jobs updated at or before a specified time. Must
79
+ # be in ISO 8601 format.
80
+ # @param schedule_start_date [String] A date used for filtering jobs schedules at or after a specified time. Must
81
+ # be in ISO 8601 format. Schedule end date should not be earlier than schedule start date.
82
+ # @param schedule_end_date [String] A date used for filtering jobs schedules at or before a specified time. Must
83
+ # be in ISO 8601 format. Schedule end date should not be earlier than schedule start date.
84
+ # @param marketplace_ids [Array<String>] Used to select jobs that were placed in the specified marketplaces.
85
+ # @param asins [Array<String>] List of Amazon Standard Identification Numbers (ASIN) of the items. Max values
86
+ # supported is 20.
87
+ # @param required_skills [Array<String>] A defined set of related knowledge, skills, experience, tools, materials,
88
+ # and work processes common to service delivery for a set of products and/or service scenarios. Max values
89
+ # supported is 20.
90
+ # @param store_ids [Array<String>] List of Amazon-defined identifiers for the region scope. Max values supported
91
+ # is 50.
92
+ # @param rate_limit [Float] Requests per second
93
+ # @return [Hash] The API response
94
+ def get_service_jobs(marketplace_ids, service_order_ids: nil, service_job_status: nil, page_token: nil,
95
+ page_size: 20, sort_field: nil, sort_order: nil, created_after: nil, created_before: nil,
96
+ last_updated_after: nil, last_updated_before: nil, schedule_start_date: nil, schedule_end_date: nil, asins: nil,
97
+ required_skills: nil, store_ids: nil, rate_limit: 10.0)
98
+ path = "/service/v1/serviceJobs"
99
+ params = {
100
+ "serviceOrderIds" => service_order_ids,
101
+ "serviceJobStatus" => service_job_status,
102
+ "pageToken" => page_token,
103
+ "pageSize" => page_size,
104
+ "sortField" => sort_field,
105
+ "sortOrder" => sort_order,
106
+ "createdAfter" => created_after,
107
+ "createdBefore" => created_before,
108
+ "lastUpdatedAfter" => last_updated_after,
109
+ "lastUpdatedBefore" => last_updated_before,
110
+ "scheduleStartDate" => schedule_start_date,
111
+ "scheduleEndDate" => schedule_end_date,
112
+ "marketplaceIds" => marketplace_ids,
113
+ "asins" => asins,
114
+ "requiredSkills" => required_skills,
115
+ "storeIds" => store_ids,
116
+ }.compact
117
+
118
+ meter(rate_limit).get(path, params:)
119
+ end
120
+
121
+ # Adds an appointment to the service job indicated by the service job identifier specified.
122
+ #
123
+ # @note This operation can make a static sandbox call.
124
+ # @param service_job_id [String] An Amazon defined service job identifier.
125
+ # @param body [Hash] Add appointment operation input details.
126
+ # @param rate_limit [Float] Requests per second
127
+ # @return [Hash] The API response
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"
130
+
131
+ meter(rate_limit).post(path, body:)
132
+ end
133
+
134
+ # Reschedules an appointment for the service job indicated by the service job identifier specified.
135
+ #
136
+ # @note This operation can make a static sandbox call.
137
+ # @param service_job_id [String] An Amazon defined service job identifier.
138
+ # @param appointment_id [String] An existing appointment identifier for the Service Job.
139
+ # @param body [Hash] Reschedule appointment operation input details.
140
+ # @param rate_limit [Float] Requests per second
141
+ # @return [Hash] The API response
142
+ def reschedule_appointment_for_service_job_by_service_job_id(service_job_id, appointment_id, body,
143
+ rate_limit: 5.0)
144
+ path = "/service/v1/serviceJobs/#{service_job_id}/appointments/#{appointment_id}"
145
+
146
+ meter(rate_limit).post(path, body:)
147
+ end
148
+
149
+ # Assigns new resource(s) or overwrite/update the existing one(s) to a service job appointment.
150
+ #
151
+ # @note This operation can make a static sandbox call.
152
+ # @param service_job_id [String] An Amazon-defined service job identifier. Get this value by calling the
153
+ # `getServiceJobs` operation of the Services API.
154
+ # @param appointment_id [String] An Amazon-defined identifier of active service job appointment.
155
+ # @param body [Hash]
156
+ # @param rate_limit [Float] Requests per second
157
+ # @return [Hash] The API response
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"
160
+
161
+ meter(rate_limit).put(path, body:)
162
+ end
163
+
164
+ # Updates the appointment fulfillment data related to a given `jobID` and `appointmentID`.
165
+ #
166
+ # @note This operation can make a static sandbox call.
167
+ # @param service_job_id [String] An Amazon-defined service job identifier. Get this value by calling the
168
+ # `getServiceJobs` operation of the Services API.
169
+ # @param appointment_id [String] An Amazon-defined identifier of active service job appointment.
170
+ # @param body [Hash] Appointment fulfillment data collection details.
171
+ # @param rate_limit [Float] Requests per second
172
+ # @return [Hash] The API response
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"
175
+
176
+ meter(rate_limit).put(path, body:)
177
+ end
178
+
179
+ # Provides capacity slots in a format similar to availability records.
180
+ #
181
+ # @note This operation can make a static sandbox call.
182
+ # @param resource_id [String] Resource Identifier.
183
+ # @param body [Hash] Request body.
184
+ # @param marketplace_ids [Array<String>] An identifier for the marketplace in which the resource operates.
185
+ # @param next_page_token [String] Next page token returned in the response of your previous request.
186
+ # @param rate_limit [Float] Requests per second
187
+ # @return [Hash] The API response
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"
190
+ params = {
191
+ "marketplaceIds" => marketplace_ids,
192
+ "nextPageToken" => next_page_token,
193
+ }.compact
194
+
195
+ meter(rate_limit).post(path, body:, params:)
196
+ end
197
+
198
+ # Provides capacity in fixed-size slots.
199
+ #
200
+ # @note This operation can make a static sandbox call.
201
+ # @param resource_id [String] Resource Identifier.
202
+ # @param body [Hash] Request body.
203
+ # @param marketplace_ids [Array<String>] An identifier for the marketplace in which the resource operates.
204
+ # @param next_page_token [String] Next page token returned in the response of your previous request.
205
+ # @param rate_limit [Float] Requests per second
206
+ # @return [Hash] The API response
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"
209
+ params = {
210
+ "marketplaceIds" => marketplace_ids,
211
+ "nextPageToken" => next_page_token,
212
+ }.compact
213
+
214
+ meter(rate_limit).post(path, body:, params:)
215
+ end
216
+
217
+ # Update the schedule of the given resource.
218
+ #
219
+ # @note This operation can make a static sandbox call.
220
+ # @param resource_id [String] Resource (store) Identifier
221
+ # @param body [Hash] Schedule details
222
+ # @param marketplace_ids [Array<String>] An identifier for the marketplace in which the resource operates.
223
+ # @param rate_limit [Float] Requests per second
224
+ # @return [Hash] The API response
225
+ def update_schedule(resource_id, body, marketplace_ids, rate_limit: 5.0)
226
+ path = "/service/v1/serviceResources/#{resource_id}/schedules"
227
+ params = {
228
+ "marketplaceIds" => marketplace_ids,
229
+ }.compact
230
+
231
+ meter(rate_limit).put(path, body:, params:)
232
+ end
233
+
234
+ # Create a reservation.
235
+ #
236
+ # @note This operation can make a static sandbox call.
237
+ # @param body [Hash] Reservation details
238
+ # @param marketplace_ids [Array<String>] An identifier for the marketplace in which the resource operates.
239
+ # @param rate_limit [Float] Requests per second
240
+ # @return [Hash] The API response
241
+ def create_reservation(body, marketplace_ids, rate_limit: 5.0)
242
+ path = "/service/v1/reservation"
243
+ params = {
244
+ "marketplaceIds" => marketplace_ids,
245
+ }.compact
246
+
247
+ meter(rate_limit).post(path, body:, params:)
248
+ end
249
+
250
+ # Update a reservation.
251
+ #
252
+ # @note This operation can make a static sandbox call.
253
+ # @param reservation_id [String] Reservation Identifier
254
+ # @param body [Hash] Reservation details
255
+ # @param marketplace_ids [Array<String>] An identifier for the marketplace in which the resource operates.
256
+ # @param rate_limit [Float] Requests per second
257
+ # @return [Hash] The API response
258
+ def update_reservation(reservation_id, body, marketplace_ids, rate_limit: 5.0)
259
+ path = "/service/v1/reservation/#{reservation_id}"
260
+ params = {
261
+ "marketplaceIds" => marketplace_ids,
262
+ }.compact
263
+
264
+ meter(rate_limit).put(path, body:, params:)
265
+ end
266
+
267
+ # Cancel a reservation.
268
+ #
269
+ # @note This operation can make a static sandbox call.
270
+ # @param reservation_id [String] Reservation Identifier
271
+ # @param marketplace_ids [Array<String>] An identifier for the marketplace in which the resource operates.
272
+ # @param rate_limit [Float] Requests per second
273
+ # @return [Hash] The API response
274
+ def cancel_reservation(reservation_id, marketplace_ids, rate_limit: 5.0)
275
+ path = "/service/v1/reservation/#{reservation_id}"
276
+ params = {
277
+ "marketplaceIds" => marketplace_ids,
278
+ }.compact
279
+
280
+ meter(rate_limit).delete(path, params:)
281
+ end
282
+
283
+ # Gets appointment slots for the service associated with the service job id specified.
284
+ #
285
+ # @note This operation can make a static sandbox call.
286
+ # @param service_job_id [String] A service job identifier to retrive appointment slots for associated service.
287
+ # @param marketplace_ids [Array<String>] An identifier for the marketplace in which the resource operates.
288
+ # @param start_time [String] A time from which the appointment slots will be retrieved. The specified time must be
289
+ # in ISO 8601 format. If `startTime` is provided, `endTime` should also be provided. Default value is as per
290
+ # business configuration.
291
+ # @param end_time [String] A time up to which the appointment slots will be retrieved. The specified time must be
292
+ # in ISO 8601 format. If `endTime` is provided, `startTime` should also be provided. Default value is as per
293
+ # business configuration. Maximum range of appointment slots can be 90 days.
294
+ # @param rate_limit [Float] Requests per second
295
+ # @return [Hash] The API response
296
+ def get_appointmment_slots_by_job_id(service_job_id, marketplace_ids, start_time: nil, end_time: nil,
297
+ rate_limit: 5.0)
298
+ path = "/service/v1/serviceJobs/#{service_job_id}/appointmentSlots"
299
+ params = {
300
+ "marketplaceIds" => marketplace_ids,
301
+ "startTime" => start_time,
302
+ "endTime" => end_time,
303
+ }.compact
304
+
305
+ meter(rate_limit).get(path, params:)
306
+ end
307
+
308
+ # Gets appointment slots as per the service context specified.
309
+ #
310
+ # @note This operation can make a static sandbox call.
311
+ # @param asin [String] ASIN associated with the service.
312
+ # @param store_id [String] Store identifier defining the region scope to retrive appointment slots.
313
+ # @param marketplace_ids [Array<String>] An identifier for the marketplace for which appointment slots are queried
314
+ # @param start_time [String] A time from which the appointment slots will be retrieved. The specified time must be
315
+ # in ISO 8601 format. If `startTime` is provided, `endTime` should also be provided. Default value is as per
316
+ # business configuration.
317
+ # @param end_time [String] A time up to which the appointment slots will be retrieved. The specified time must be
318
+ # in ISO 8601 format. If `endTime` is provided, `startTime` should also be provided. Default value is as per
319
+ # business configuration. Maximum range of appointment slots can be 90 days.
320
+ # @param rate_limit [Float] Requests per second
321
+ # @return [Hash] The API response
322
+ def get_appointment_slots(asin, store_id, marketplace_ids, start_time: nil, end_time: nil, rate_limit: 20.0)
323
+ path = "/service/v1/appointmentSlots"
324
+ params = {
325
+ "asin" => asin,
326
+ "storeId" => store_id,
327
+ "marketplaceIds" => marketplace_ids,
328
+ "startTime" => start_time,
329
+ "endTime" => end_time,
330
+ }.compact
331
+
332
+ meter(rate_limit).get(path, params:)
333
+ end
334
+
335
+ # Creates an upload destination.
336
+ #
337
+ # @note This operation can make a static sandbox call.
338
+ # @param body [Hash] Upload document operation input details.
339
+ # @param rate_limit [Float] Requests per second
340
+ # @return [Hash] The API response
341
+ def create_service_document_upload_destination(body, rate_limit: 5.0)
342
+ path = "/service/v1/documents"
343
+
344
+ meter(rate_limit).post(path, body:)
345
+ end
346
+ end
347
+ end
348
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def shipment_invoicing_v0(...)
8
+ API::ShipmentInvoicingV0.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Shipment Invoicing
14
+ #
15
+ # The Selling Partner API for Shipment Invoicing helps you programmatically retrieve shipment invoice information in
16
+ # the Brazil marketplace for a selling partner’s Fulfillment by Amazon (FBA) orders.
17
+ class ShipmentInvoicingV0 < API
18
+ # Returns the shipment details required to issue an invoice for the specified shipment.
19
+ #
20
+ # @note This operation can make a static sandbox call.
21
+ # @param shipment_id [String] The identifier for the shipment. Get this value from the FBAOutboundShipmentStatus
22
+ # notification. For information about subscribing to notifications, see the
23
+ # {https://developer-docs.amazon.com/sp-api/docs/notifications-api-v1-use-case-guide Notifications API Use Case
24
+ # Guide}.
25
+ # @param rate_limit [Float] Requests per second
26
+ # @return [Hash] The API response
27
+ def get_shipment_details(shipment_id, rate_limit: 1.133)
28
+ path = "/fba/outbound/brazil/v0/shipments/#{shipment_id}"
29
+
30
+ meter(rate_limit).get(path)
31
+ end
32
+
33
+ # Submits a shipment invoice document for a given shipment.
34
+ #
35
+ # @note This operation can make a static sandbox call.
36
+ # @param shipment_id [String] The identifier for the shipment.
37
+ # @param body [Hash]
38
+ # @param rate_limit [Float] Requests per second
39
+ # @return [Hash] The API response
40
+ def submit_invoice(shipment_id, body, rate_limit: 1.133)
41
+ path = "/fba/outbound/brazil/v0/shipments/#{shipment_id}/invoice"
42
+
43
+ meter(rate_limit).post(path, body:)
44
+ end
45
+
46
+ # Returns the invoice status for the shipment you specify.
47
+ #
48
+ # @note This operation can make a static sandbox call.
49
+ # @param shipment_id [String] The shipment identifier for the shipment.
50
+ # @param rate_limit [Float] Requests per second
51
+ # @return [Hash] The API response
52
+ def get_invoice_status(shipment_id, rate_limit: 1.133)
53
+ path = "/fba/outbound/brazil/v0/shipments/#{shipment_id}/invoice/status"
54
+
55
+ meter(rate_limit).get(path)
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,132 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def shipping_v1(...)
8
+ API::ShippingV1.new(...)
9
+ end
10
+ end
11
+
12
+ class API
13
+ # Selling Partner API for Shipping
14
+ #
15
+ # Provides programmatic access to Amazon Shipping APIs. **Note:** If you are new to the Amazon Shipping API, refer
16
+ # to the latest version of <a
17
+ # href="https://developer-docs.amazon.com/amazon-shipping/docs/shipping-api-v2-reference">Amazon Shipping API
18
+ # (v2)</a> on the <a href="https://developer-docs.amazon.com/amazon-shipping/">Amazon Shipping Developer
19
+ # Documentation</a> site.
20
+ class ShippingV1 < API
21
+ # Create a new shipment.
22
+ #
23
+ # @note This operation can make a static sandbox call.
24
+ # @param body [Hash]
25
+ # @param rate_limit [Float] Requests per second
26
+ # @return [Hash] The API response
27
+ def create_shipment(body, rate_limit: 5.0)
28
+ path = "/shipping/v1/shipments"
29
+
30
+ meter(rate_limit).post(path, body:)
31
+ end
32
+
33
+ # Return the entire shipment object for the shipmentId.
34
+ #
35
+ # @note This operation can make a static sandbox call.
36
+ # @param shipment_id [String]
37
+ # @param rate_limit [Float] Requests per second
38
+ # @return [Hash] The API response
39
+ def get_shipment(shipment_id, rate_limit: 5.0)
40
+ path = "/shipping/v1/shipments/#{shipment_id}"
41
+
42
+ meter(rate_limit).get(path)
43
+ end
44
+
45
+ # Cancel a shipment by the given shipmentId.
46
+ #
47
+ # @note This operation can make a static sandbox call.
48
+ # @param shipment_id [String]
49
+ # @param rate_limit [Float] Requests per second
50
+ # @return [Hash] The API response
51
+ def cancel_shipment(shipment_id, rate_limit: 5.0)
52
+ path = "/shipping/v1/shipments/#{shipment_id}/cancel"
53
+
54
+ meter(rate_limit).post(path)
55
+ end
56
+
57
+ # Purchase shipping labels based on a given rate.
58
+ #
59
+ # @note This operation can make a static sandbox call.
60
+ # @param shipment_id [String]
61
+ # @param body [Hash]
62
+ # @param rate_limit [Float] Requests per second
63
+ # @return [Hash] The API response
64
+ def purchase_labels(shipment_id, body, rate_limit: 5.0)
65
+ path = "/shipping/v1/shipments/#{shipment_id}/purchaseLabels"
66
+
67
+ meter(rate_limit).post(path, body:)
68
+ end
69
+
70
+ # Retrieve shipping label based on the shipment id and tracking id.
71
+ #
72
+ # @note This operation can make a static sandbox call.
73
+ # @param shipment_id [String]
74
+ # @param tracking_id [String]
75
+ # @param body [Hash]
76
+ # @param rate_limit [Float] Requests per second
77
+ # @return [Hash] The API response
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"
80
+
81
+ meter(rate_limit).post(path, body:)
82
+ end
83
+
84
+ # Purchase shipping labels.
85
+ #
86
+ # @note This operation can make a static sandbox call.
87
+ # @param body [Hash]
88
+ # @param rate_limit [Float] Requests per second
89
+ # @return [Hash] The API response
90
+ def purchase_shipment(body, rate_limit: 5.0)
91
+ path = "/shipping/v1/purchaseShipment"
92
+
93
+ meter(rate_limit).post(path, body:)
94
+ end
95
+
96
+ # Get service rates.
97
+ #
98
+ # @note This operation can make a static sandbox call.
99
+ # @param body [Hash]
100
+ # @param rate_limit [Float] Requests per second
101
+ # @return [Hash] The API response
102
+ def get_rates(body, rate_limit: 5.0)
103
+ path = "/shipping/v1/rates"
104
+
105
+ meter(rate_limit).post(path, body:)
106
+ end
107
+
108
+ # Verify if the current account is valid.
109
+ #
110
+ # @note This operation can make a static sandbox call.
111
+ # @param rate_limit [Float] Requests per second
112
+ # @return [Hash] The API response
113
+ def get_account(rate_limit: 5.0)
114
+ path = "/shipping/v1/account"
115
+
116
+ meter(rate_limit).get(path)
117
+ end
118
+
119
+ # Return the tracking information of a shipment.
120
+ #
121
+ # @note This operation can make a static sandbox call.
122
+ # @param tracking_id [String]
123
+ # @param rate_limit [Float] Requests per second
124
+ # @return [Hash] The API response
125
+ def get_tracking_information(tracking_id, rate_limit: 1.0)
126
+ path = "/shipping/v1/tracking/#{tracking_id}"
127
+
128
+ meter(rate_limit).get(path)
129
+ end
130
+ end
131
+ end
132
+ end