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 services_v1(...)
8
+ APIs::ServicesV1.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
7
13
  # Selling Partner API for Services
8
14
  #
9
15
  # With the Services API, you can build applications that help service providers get and modify their service orders
@@ -11,78 +17,84 @@ module Peddler
11
17
  class ServicesV1 < API
12
18
  # Gets details of service job indicated by the provided `serviceJobID`.
13
19
  #
14
- # @param [String] service_job_id A service job identifier.
15
- # @return [Hash] The API response
16
- def get_service_job_by_service_job_id(service_job_id)
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 [Peddler::Response] The API response
24
+ def get_service_job_by_service_job_id(service_job_id, rate_limit: 20.0)
17
25
  path = "/service/v1/serviceJobs/#{service_job_id}"
18
26
 
19
- rate_limit(20.0).get(path)
27
+ meter(rate_limit).get(path)
20
28
  end
21
29
 
22
30
  # Cancels the service job indicated by the service job identifier specified.
23
31
  #
24
- # @param [String] service_job_id An Amazon defined service job identifier.
25
- # @param [String] cancellation_reason_code A cancel reason code that specifies the reason for cancelling a service
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
26
35
  # job.
27
- # @return [Hash] The API response
28
- def cancel_service_job_by_service_job_id(service_job_id, cancellation_reason_code)
36
+ # @param rate_limit [Float] Requests per second
37
+ # @return [Peddler::Response] The API response
38
+ def cancel_service_job_by_service_job_id(service_job_id, cancellation_reason_code, rate_limit: 5.0)
29
39
  path = "/service/v1/serviceJobs/#{service_job_id}/cancellations"
30
40
  params = {
31
41
  "cancellationReasonCode" => cancellation_reason_code,
32
42
  }.compact
33
43
 
34
- rate_limit(5.0).put(path, params:)
44
+ meter(rate_limit).put(path, params:)
35
45
  end
36
46
 
37
47
  # Completes the service job indicated by the service job identifier specified.
38
48
  #
39
- # @param [String] service_job_id An Amazon defined service job identifier.
40
- # @return [Hash] The API response
41
- def complete_service_job_by_service_job_id(service_job_id)
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 [Peddler::Response] The API response
53
+ def complete_service_job_by_service_job_id(service_job_id, rate_limit: 5.0)
42
54
  path = "/service/v1/serviceJobs/#{service_job_id}/completions"
43
55
 
44
- rate_limit(5.0).put(path)
56
+ meter(rate_limit).put(path)
45
57
  end
46
58
 
47
59
  # Gets service job details for the specified filter query.
48
60
  #
49
- # @param [Array<String>] service_order_ids List of service order ids for the query you want to perform.Max values
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
50
63
  # supported 20.
51
- # @param [Array<String>] service_job_status A list of one or more job status by which to filter the list of jobs.
52
- # @param [String] page_token String returned in the response of your previous request.
53
- # @param [Integer] page_size A non-negative integer that indicates the maximum number of jobs to return in the
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
54
67
  # list, Value must be 1 - 20. Default 20.
55
- # @param [String] sort_field Sort fields on which you want to sort the output.
56
- # @param [String] sort_order Sort order for the query you want to perform.
57
- # @param [String] created_after A date used for selecting jobs created at or after a specified time. Must be in
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
58
71
  # ISO 8601 format. Required if `LastUpdatedAfter` is not specified. Specifying both `CreatedAfter` and
59
72
  # `LastUpdatedAfter` returns an error.
60
- # @param [String] created_before A date used for selecting jobs created at or before a specified time. Must be in
73
+ # @param created_before [String] A date used for selecting jobs created at or before a specified time. Must be in
61
74
  # ISO 8601 format.
62
- # @param [String] last_updated_after A date used for selecting jobs updated at or after a specified time. Must be
75
+ # @param last_updated_after [String] A date used for selecting jobs updated at or after a specified time. Must be
63
76
  # in ISO 8601 format. Required if `createdAfter` is not specified. Specifying both `CreatedAfter` and
64
77
  # `LastUpdatedAfter` returns an error.
65
- # @param [String] last_updated_before A date used for selecting jobs updated at or before a specified time. Must
78
+ # @param last_updated_before [String] A date used for selecting jobs updated at or before a specified time. Must
66
79
  # be in ISO 8601 format.
67
- # @param [String] schedule_start_date A date used for filtering jobs schedules at or after a specified time. Must
80
+ # @param schedule_start_date [String] A date used for filtering jobs schedules at or after a specified time. Must
68
81
  # be in ISO 8601 format. Schedule end date should not be earlier than schedule start date.
69
- # @param [String] schedule_end_date A date used for filtering jobs schedules at or before a specified time. Must
82
+ # @param schedule_end_date [String] A date used for filtering jobs schedules at or before a specified time. Must
70
83
  # be in ISO 8601 format. Schedule end date should not be earlier than schedule start date.
71
- # @param [Array<String>] marketplace_ids Used to select jobs that were placed in the specified marketplaces.
72
- # @param [Array<String>] asins List of Amazon Standard Identification Numbers (ASIN) of the items. Max values
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
73
86
  # supported is 20.
74
- # @param [Array<String>] required_skills A defined set of related knowledge, skills, experience, tools, materials,
87
+ # @param required_skills [Array<String>] A defined set of related knowledge, skills, experience, tools, materials,
75
88
  # and work processes common to service delivery for a set of products and/or service scenarios. Max values
76
89
  # supported is 20.
77
- # @param [Array<String>] store_ids List of Amazon-defined identifiers for the region scope. Max values supported
90
+ # @param store_ids [Array<String>] List of Amazon-defined identifiers for the region scope. Max values supported
78
91
  # is 50.
79
- # @return [Hash] The API response
80
- def get_service_jobs(
81
- marketplace_ids, service_order_ids: nil, service_job_status: nil, page_token: nil, page_size: nil,
82
- sort_field: nil, sort_order: nil, created_after: nil, created_before: nil, last_updated_after: nil,
83
- last_updated_before: nil, schedule_start_date: nil, schedule_end_date: nil, asins: nil, required_skills: nil,
84
- store_ids: nil
85
- )
92
+ # @param rate_limit [Float] Requests per second
93
+ # @return [Peddler::Response] 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)
86
98
  path = "/service/v1/serviceJobs"
87
99
  params = {
88
100
  "serviceOrderIds" => service_order_ids,
@@ -103,162 +115,186 @@ module Peddler
103
115
  "storeIds" => store_ids,
104
116
  }.compact
105
117
 
106
- rate_limit(10.0).get(path, params:)
118
+ meter(rate_limit).get(path, params:)
107
119
  end
108
120
 
109
121
  # Adds an appointment to the service job indicated by the service job identifier specified.
110
122
  #
111
- # @param [String] service_job_id An Amazon defined service job identifier.
112
- # @param [Hash] body Add appointment operation input details.
113
- # @return [Hash] The API response
114
- def add_appointment_for_service_job_by_service_job_id(service_job_id, body)
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 [Peddler::Response] The API response
128
+ def add_appointment_for_service_job_by_service_job_id(service_job_id, body, rate_limit: 5.0)
115
129
  path = "/service/v1/serviceJobs/#{service_job_id}/appointments"
116
130
 
117
- rate_limit(5.0).post(path, body:)
131
+ meter(rate_limit).post(path, body:)
118
132
  end
119
133
 
120
134
  # Reschedules an appointment for the service job indicated by the service job identifier specified.
121
135
  #
122
- # @param [String] service_job_id An Amazon defined service job identifier.
123
- # @param [String] appointment_id An existing appointment identifier for the Service Job.
124
- # @param [Hash] body Reschedule appointment operation input details.
125
- # @return [Hash] The API response
126
- def reschedule_appointment_for_service_job_by_service_job_id(service_job_id, appointment_id, body)
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 [Peddler::Response] 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)
127
144
  path = "/service/v1/serviceJobs/#{service_job_id}/appointments/#{appointment_id}"
128
145
 
129
- rate_limit(5.0).post(path, body:)
146
+ meter(rate_limit).post(path, body:)
130
147
  end
131
148
 
132
149
  # Assigns new resource(s) or overwrite/update the existing one(s) to a service job appointment.
133
150
  #
134
- # @param [String] service_job_id An Amazon-defined service job identifier. Get this value by calling the
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
135
153
  # `getServiceJobs` operation of the Services API.
136
- # @param [String] appointment_id An Amazon-defined identifier of active service job appointment.
137
- # @param [Hash] body
138
- # @return [Hash] The API response
139
- def assign_appointment_resources(service_job_id, appointment_id, body)
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 [Peddler::Response] The API response
158
+ def assign_appointment_resources(service_job_id, appointment_id, body, rate_limit: 1.0)
140
159
  path = "/service/v1/serviceJobs/#{service_job_id}/appointments/#{appointment_id}/resources"
141
160
 
142
- rate_limit(1.0).put(path, body:)
161
+ meter(rate_limit).put(path, body:)
143
162
  end
144
163
 
145
164
  # Updates the appointment fulfillment data related to a given `jobID` and `appointmentID`.
146
165
  #
147
- # @param [String] service_job_id An Amazon-defined service job identifier. Get this value by calling the
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
148
168
  # `getServiceJobs` operation of the Services API.
149
- # @param [String] appointment_id An Amazon-defined identifier of active service job appointment.
150
- # @param [Hash] body Appointment fulfillment data collection details.
151
- # @return [Hash] The API response
152
- def set_appointment_fulfillment_data(service_job_id, appointment_id, body)
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 [Peddler::Response] The API response
173
+ def set_appointment_fulfillment_data(service_job_id, appointment_id, body, rate_limit: 5.0)
153
174
  path = "/service/v1/serviceJobs/#{service_job_id}/appointments/#{appointment_id}/fulfillment"
154
175
 
155
- rate_limit(5.0).put(path, body:)
176
+ meter(rate_limit).put(path, body:)
156
177
  end
157
178
 
158
179
  # Provides capacity slots in a format similar to availability records.
159
180
  #
160
- # @param [String] resource_id Resource Identifier.
161
- # @param [Hash] body Request body.
162
- # @param [Array<String>] marketplace_ids An identifier for the marketplace in which the resource operates.
163
- # @param [String] next_page_token Next page token returned in the response of your previous request.
164
- # @return [Hash] The API response
165
- def get_range_slot_capacity(resource_id, body, marketplace_ids, next_page_token: nil)
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 [Peddler::Response] The API response
188
+ def get_range_slot_capacity(resource_id, body, marketplace_ids, next_page_token: nil, rate_limit: 5.0)
166
189
  path = "/service/v1/serviceResources/#{resource_id}/capacity/range"
167
190
  params = {
168
191
  "marketplaceIds" => marketplace_ids,
169
192
  "nextPageToken" => next_page_token,
170
193
  }.compact
171
194
 
172
- rate_limit(5.0).post(path, body:, params:)
195
+ meter(rate_limit).post(path, body:, params:)
173
196
  end
174
197
 
175
198
  # Provides capacity in fixed-size slots.
176
199
  #
177
- # @param [String] resource_id Resource Identifier.
178
- # @param [Hash] body Request body.
179
- # @param [Array<String>] marketplace_ids An identifier for the marketplace in which the resource operates.
180
- # @param [String] next_page_token Next page token returned in the response of your previous request.
181
- # @return [Hash] The API response
182
- def get_fixed_slot_capacity(resource_id, body, marketplace_ids, next_page_token: nil)
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 [Peddler::Response] The API response
207
+ def get_fixed_slot_capacity(resource_id, body, marketplace_ids, next_page_token: nil, rate_limit: 5.0)
183
208
  path = "/service/v1/serviceResources/#{resource_id}/capacity/fixed"
184
209
  params = {
185
210
  "marketplaceIds" => marketplace_ids,
186
211
  "nextPageToken" => next_page_token,
187
212
  }.compact
188
213
 
189
- rate_limit(5.0).post(path, body:, params:)
214
+ meter(rate_limit).post(path, body:, params:)
190
215
  end
191
216
 
192
217
  # Update the schedule of the given resource.
193
218
  #
194
- # @param [String] resource_id Resource (store) Identifier
195
- # @param [Hash] body Schedule details
196
- # @param [Array<String>] marketplace_ids An identifier for the marketplace in which the resource operates.
197
- # @return [Hash] The API response
198
- def update_schedule(resource_id, body, marketplace_ids)
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 [Peddler::Response] The API response
225
+ def update_schedule(resource_id, body, marketplace_ids, rate_limit: 5.0)
199
226
  path = "/service/v1/serviceResources/#{resource_id}/schedules"
200
227
  params = {
201
228
  "marketplaceIds" => marketplace_ids,
202
229
  }.compact
203
230
 
204
- rate_limit(5.0).put(path, body:, params:)
231
+ meter(rate_limit).put(path, body:, params:)
205
232
  end
206
233
 
207
234
  # Create a reservation.
208
235
  #
209
- # @param [Hash] body Reservation details
210
- # @param [Array<String>] marketplace_ids An identifier for the marketplace in which the resource operates.
211
- # @return [Hash] The API response
212
- def create_reservation(body, marketplace_ids)
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 [Peddler::Response] The API response
241
+ def create_reservation(body, marketplace_ids, rate_limit: 5.0)
213
242
  path = "/service/v1/reservation"
214
243
  params = {
215
244
  "marketplaceIds" => marketplace_ids,
216
245
  }.compact
217
246
 
218
- rate_limit(5.0).post(path, body:, params:)
247
+ meter(rate_limit).post(path, body:, params:)
219
248
  end
220
249
 
221
250
  # Update a reservation.
222
251
  #
223
- # @param [String] reservation_id Reservation Identifier
224
- # @param [Hash] body Reservation details
225
- # @param [Array<String>] marketplace_ids An identifier for the marketplace in which the resource operates.
226
- # @return [Hash] The API response
227
- def update_reservation(reservation_id, body, marketplace_ids)
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 [Peddler::Response] The API response
258
+ def update_reservation(reservation_id, body, marketplace_ids, rate_limit: 5.0)
228
259
  path = "/service/v1/reservation/#{reservation_id}"
229
260
  params = {
230
261
  "marketplaceIds" => marketplace_ids,
231
262
  }.compact
232
263
 
233
- rate_limit(5.0).put(path, body:, params:)
264
+ meter(rate_limit).put(path, body:, params:)
234
265
  end
235
266
 
236
267
  # Cancel a reservation.
237
268
  #
238
- # @param [String] reservation_id Reservation Identifier
239
- # @param [Array<String>] marketplace_ids An identifier for the marketplace in which the resource operates.
240
- # @return [Hash] The API response
241
- def cancel_reservation(reservation_id, marketplace_ids)
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 [Peddler::Response] The API response
274
+ def cancel_reservation(reservation_id, marketplace_ids, rate_limit: 5.0)
242
275
  path = "/service/v1/reservation/#{reservation_id}"
243
276
  params = {
244
277
  "marketplaceIds" => marketplace_ids,
245
278
  }.compact
246
279
 
247
- rate_limit(5.0).delete(path, params:)
280
+ meter(rate_limit).delete(path, params:)
248
281
  end
249
282
 
250
283
  # Gets appointment slots for the service associated with the service job id specified.
251
284
  #
252
- # @param [String] service_job_id A service job identifier to retrive appointment slots for associated service.
253
- # @param [Array<String>] marketplace_ids An identifier for the marketplace in which the resource operates.
254
- # @param [String] start_time A time from which the appointment slots will be retrieved. The specified time must be
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
255
289
  # in ISO 8601 format. If `startTime` is provided, `endTime` should also be provided. Default value is as per
256
290
  # business configuration.
257
- # @param [String] end_time A time up to which the appointment slots will be retrieved. The specified time must be
291
+ # @param end_time [String] A time up to which the appointment slots will be retrieved. The specified time must be
258
292
  # in ISO 8601 format. If `endTime` is provided, `startTime` should also be provided. Default value is as per
259
293
  # business configuration. Maximum range of appointment slots can be 90 days.
260
- # @return [Hash] The API response
261
- def get_appointmment_slots_by_job_id(service_job_id, marketplace_ids, start_time: nil, end_time: nil)
294
+ # @param rate_limit [Float] Requests per second
295
+ # @return [Peddler::Response] 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)
262
298
  path = "/service/v1/serviceJobs/#{service_job_id}/appointmentSlots"
263
299
  params = {
264
300
  "marketplaceIds" => marketplace_ids,
@@ -266,22 +302,24 @@ module Peddler
266
302
  "endTime" => end_time,
267
303
  }.compact
268
304
 
269
- rate_limit(5.0).get(path, params:)
305
+ meter(rate_limit).get(path, params:)
270
306
  end
271
307
 
272
308
  # Gets appointment slots as per the service context specified.
273
309
  #
274
- # @param [String] asin ASIN associated with the service.
275
- # @param [String] store_id Store identifier defining the region scope to retrive appointment slots.
276
- # @param [Array<String>] marketplace_ids An identifier for the marketplace for which appointment slots are queried
277
- # @param [String] start_time A time from which the appointment slots will be retrieved. The specified time must be
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
278
315
  # in ISO 8601 format. If `startTime` is provided, `endTime` should also be provided. Default value is as per
279
316
  # business configuration.
280
- # @param [String] end_time A time up to which the appointment slots will be retrieved. The specified time must be
317
+ # @param end_time [String] A time up to which the appointment slots will be retrieved. The specified time must be
281
318
  # in ISO 8601 format. If `endTime` is provided, `startTime` should also be provided. Default value is as per
282
319
  # business configuration. Maximum range of appointment slots can be 90 days.
283
- # @return [Hash] The API response
284
- def get_appointment_slots(asin, store_id, marketplace_ids, start_time: nil, end_time: nil)
320
+ # @param rate_limit [Float] Requests per second
321
+ # @return [Peddler::Response] The API response
322
+ def get_appointment_slots(asin, store_id, marketplace_ids, start_time: nil, end_time: nil, rate_limit: 20.0)
285
323
  path = "/service/v1/appointmentSlots"
286
324
  params = {
287
325
  "asin" => asin,
@@ -291,17 +329,19 @@ module Peddler
291
329
  "endTime" => end_time,
292
330
  }.compact
293
331
 
294
- rate_limit(20.0).get(path, params:)
332
+ meter(rate_limit).get(path, params:)
295
333
  end
296
334
 
297
335
  # Creates an upload destination.
298
336
  #
299
- # @param [Hash] body Upload document operation input details.
300
- # @return [Hash] The API response
301
- def create_service_document_upload_destination(body)
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 [Peddler::Response] The API response
341
+ def create_service_document_upload_destination(body, rate_limit: 5.0)
302
342
  path = "/service/v1/documents"
303
343
 
304
- rate_limit(5.0).post(path, body:)
344
+ meter(rate_limit).post(path, body:)
305
345
  end
306
346
  end
307
347
  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
+ APIs::ShipmentInvoicingV0.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
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 [Peddler::Response] 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 [Peddler::Response] 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 [Peddler::Response] 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
+ APIs::ShippingV1.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
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 [Peddler::Response] 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 [Peddler::Response] 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 [Peddler::Response] 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 [Peddler::Response] 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 [Peddler::Response] 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 [Peddler::Response] 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 [Peddler::Response] 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 [Peddler::Response] 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 [Peddler::Response] 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