peddler 4.1.1 → 4.2.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.
@@ -10,7 +10,7 @@ module Peddler
10
10
  end
11
11
 
12
12
  module APIs
13
- # Selling Partner API for Sellers
13
+ # The Selling Partner API for Sellers
14
14
  #
15
15
  # The [Selling Partner API for Sellers](https://developer-docs.amazon.com/sp-api/docs/sellers-api-v1-reference)
16
16
  # (Sellers API) provides essential information about seller accounts, such as: - The marketplaces a seller can list
@@ -21,7 +21,7 @@ module Peddler
21
21
  # Create a new shipment.
22
22
  #
23
23
  # @note This operation can make a static sandbox call.
24
- # @param body [Hash]
24
+ # @param body [Hash] CreateShipmentRequest Body
25
25
  # @param rate_limit [Float] Requests per second
26
26
  # @return [Peddler::Response] The API response
27
27
  def create_shipment(body, rate_limit: 5.0)
@@ -33,7 +33,7 @@ module Peddler
33
33
  # Return the entire shipment object for the shipmentId.
34
34
  #
35
35
  # @note This operation can make a static sandbox call.
36
- # @param shipment_id [String]
36
+ # @param shipment_id [String] Shipment id to return the entire shipment object
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)
@@ -45,7 +45,7 @@ module Peddler
45
45
  # Cancel a shipment by the given shipmentId.
46
46
  #
47
47
  # @note This operation can make a static sandbox call.
48
- # @param shipment_id [String]
48
+ # @param shipment_id [String] Shipment Id to cancel a shipment
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)
@@ -57,8 +57,8 @@ module Peddler
57
57
  # Purchase shipping labels based on a given rate.
58
58
  #
59
59
  # @note This operation can make a static sandbox call.
60
- # @param shipment_id [String]
61
- # @param body [Hash]
60
+ # @param shipment_id [String] Shipment id for purchase shipping label
61
+ # @param body [Hash] PurchaseShippingLabelRequest body
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)
@@ -70,9 +70,9 @@ module Peddler
70
70
  # Retrieve shipping label based on the shipment id and tracking id.
71
71
  #
72
72
  # @note This operation can make a static sandbox call.
73
- # @param shipment_id [String]
74
- # @param tracking_id [String]
75
- # @param body [Hash]
73
+ # @param shipment_id [String] Shipment Id to retreive label
74
+ # @param tracking_id [String] Tracking Id
75
+ # @param body [Hash] RetrieveShippingLabelRequest body
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)
@@ -84,7 +84,7 @@ module Peddler
84
84
  # Purchase shipping labels.
85
85
  #
86
86
  # @note This operation can make a static sandbox call.
87
- # @param body [Hash]
87
+ # @param body [Hash] PurchaseShipmentRequest body
88
88
  # @param rate_limit [Float] Requests per second
89
89
  # @return [Peddler::Response] The API response
90
90
  def purchase_shipment(body, rate_limit: 5.0)
@@ -95,8 +95,8 @@ module Peddler
95
95
 
96
96
  # Get service rates.
97
97
  #
98
- # @note This operation can make a static sandbox call.
99
- # @param body [Hash]
98
+ # @note This operation can make a dynamic sandbox call.
99
+ # @param body [Hash] GetRatesRequest body
100
100
  # @param rate_limit [Float] Requests per second
101
101
  # @return [Peddler::Response] The API response
102
102
  def get_rates(body, rate_limit: 5.0)
@@ -119,7 +119,7 @@ module Peddler
119
119
  # Return the tracking information of a shipment.
120
120
  #
121
121
  # @note This operation can make a static sandbox call.
122
- # @param tracking_id [String]
122
+ # @param tracking_id [String] Tracking Id
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)
@@ -19,7 +19,7 @@ module Peddler
19
19
  # Returns the available shipping service offerings.
20
20
  #
21
21
  # @note This operation can make a dynamic sandbox call.
22
- # @param body [Hash]
22
+ # @param body [Hash] GetRatesRequest body
23
23
  # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
24
24
  # AmazonShipping_UK.
25
25
  # @param rate_limit [Float] Requests per second
@@ -33,7 +33,8 @@ module Peddler
33
33
  # Purchases the shipping service for a shipment using the best fit service offering. Returns purchase related
34
34
  # details and documents.
35
35
  #
36
- # @param body [Hash]
36
+ # @note This operation can make a dynamic sandbox call.
37
+ # @param body [Hash] DirectPurchaseRequest body
37
38
  # @param x_amzn_idempotency_key [String] A unique value which the server uses to recognize subsequent retries of
38
39
  # the same request.
39
40
  # @param locale [String] The IETF Language Tag. Note that this only supports the primary language subtag with one
@@ -45,8 +46,6 @@ module Peddler
45
46
  # @return [Peddler::Response] The API response
46
47
  def direct_purchase_shipment(body, x_amzn_idempotency_key: nil, locale: nil, x_amzn_shipping_business_id: nil,
47
48
  rate_limit: 80.0)
48
- cannot_sandbox!
49
-
50
49
  path = "/shipping/v2/shipments/directPurchase"
51
50
 
52
51
  meter(rate_limit).post(path, body:)
@@ -58,7 +57,7 @@ module Peddler
58
57
  # receive this error response, you must get the rates for the shipment again.
59
58
  #
60
59
  # @note This operation can make a dynamic sandbox call.
61
- # @param body [Hash]
60
+ # @param body [Hash] PurchaseShipmentRequest body
62
61
  # @param x_amzn_idempotency_key [String] A unique value which the server uses to recognize subsequent retries of
63
62
  # the same request.
64
63
  # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
@@ -74,7 +73,7 @@ module Peddler
74
73
  # Purchases a shipping service identifier and returns purchase-related details and documents.
75
74
  #
76
75
  # @note This operation can make a dynamic sandbox call.
77
- # @param body [Hash]
76
+ # @param body [Hash] OneClickShipmentRequest body
78
77
  # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
79
78
  # AmazonShipping_UK.
80
79
  # @param rate_limit [Float] Requests per second
@@ -184,7 +183,7 @@ module Peddler
184
183
 
185
184
  # This API will return Get all carrier accounts for a merchant.
186
185
  #
187
- # @param body [Hash]
186
+ # @param body [Hash] GetCarrierAccountsRequest body
188
187
  # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
189
188
  # AmazonShipping_UK.
190
189
  # @param rate_limit [Float] Requests per second
@@ -199,24 +198,23 @@ module Peddler
199
198
 
200
199
  # This API associates/links the specified carrier account with the merchant.
201
200
  #
202
- # @param carrier_id [String] The unique identifier associated with the carrier account.
203
- # @param body [Hash]
201
+ # @note This operation can make a dynamic sandbox call.
202
+ # @param carrier_id [String] An identifier for the carrier with which the seller's account is being linked.
203
+ # @param body [Hash] LinkCarrierAccountRequest body
204
204
  # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
205
205
  # AmazonShipping_UK.
206
206
  # @param rate_limit [Float] Requests per second
207
207
  # @return [Peddler::Response] The API response
208
- def link_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
209
- cannot_sandbox!
210
-
208
+ def link_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil, rate_limit: 5.0)
211
209
  path = "/shipping/v2/carrierAccounts/#{carrier_id}"
212
210
 
213
- meter(rate_limit).put(path, body:)
211
+ meter(rate_limit).post(path, body:)
214
212
  end
215
213
 
216
214
  # This API Unlink the specified carrier account with the merchant.
217
215
  #
218
216
  # @param carrier_id [String] carrier Id to unlink with merchant.
219
- # @param body [Hash]
217
+ # @param body [Hash] UnlinkCarrierAccountRequest body
220
218
  # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
221
219
  # AmazonShipping_UK.
222
220
  # @param rate_limit [Float] Requests per second
@@ -231,7 +229,7 @@ module Peddler
231
229
 
232
230
  # This API Call to generate the collection form.
233
231
  #
234
- # @param body [Hash]
232
+ # @param body [Hash] GenerateCollectionFormRequest body
235
233
  # @param x_amzn_idempotency_key [String] A unique value which the server uses to recognize subsequent retries of
236
234
  # the same request.
237
235
  # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
@@ -249,7 +247,7 @@ module Peddler
249
247
 
250
248
  # This API Call to get the history of the previously generated collection forms.
251
249
  #
252
- # @param body [Hash]
250
+ # @param body [Hash] GetCollectionFormHistoryRequest body
253
251
  # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
254
252
  # AmazonShipping_UK.
255
253
  # @param rate_limit [Float] Requests per second
@@ -265,7 +263,7 @@ module Peddler
265
263
  # This API Get all unmanifested carriers with shipment locations. Any locations which has unmanifested shipments
266
264
  # with an eligible carrier for manifesting shall be returned.
267
265
  #
268
- # @param body [Hash]
266
+ # @param body [Hash] GetUmanifestedShipmentsRequest body
269
267
  # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
270
268
  # AmazonShipping_UK.
271
269
  # @param rate_limit [Float] Requests per second
@@ -296,9 +294,9 @@ module Peddler
296
294
  # Returns a list of access points in proximity of input postal code.
297
295
  #
298
296
  # @note This operation can make a dynamic sandbox call.
299
- # @param access_point_types [Array<String>]
300
- # @param country_code [String]
301
- # @param postal_code [String]
297
+ # @param access_point_types [Array<String>] Access point types
298
+ # @param country_code [String] Country code for access point
299
+ # @param postal_code [String] postal code for access point
302
300
  # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
303
301
  # AmazonShipping_UK.
304
302
  # @param rate_limit [Float] Requests per second
@@ -314,6 +312,34 @@ module Peddler
314
312
 
315
313
  meter(rate_limit).get(path, params:)
316
314
  end
315
+
316
+ # This API submits the NDR (Non-delivery Report) Feedback for any eligible shipment.
317
+ #
318
+ # @note This operation can make a dynamic sandbox call.
319
+ # @param body [Hash] Request body for ndrFeedback operation
320
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
321
+ # AmazonShipping_UK.
322
+ # @param rate_limit [Float] Requests per second
323
+ # @return [Peddler::Response] The API response
324
+ def submit_ndr_feedback(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
325
+ path = "/shipping/v2/ndrFeedback"
326
+
327
+ meter(rate_limit).post(path, body:)
328
+ end
329
+
330
+ # This API will be used to create claim for single eligible shipment.
331
+ #
332
+ # @note This operation can make a dynamic sandbox call.
333
+ # @param body [Hash] Request body for the createClaim operation
334
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
335
+ # AmazonShipping_UK.
336
+ # @param rate_limit [Float] Requests per second
337
+ # @return [Peddler::Response] The API response
338
+ def create_claim(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
339
+ path = "/shipping/v2/claims"
340
+
341
+ meter(rate_limit).post(path, body:)
342
+ end
317
343
  end
318
344
  end
319
345
  end
@@ -18,18 +18,19 @@ module Peddler
18
18
  # Creates an upload destination, returning the information required to upload a file to the destination and to
19
19
  # programmatically access the file.
20
20
  #
21
- # @param marketplace_ids [Array<String>] A list of marketplace identifiers. This specifies the marketplaces where
22
- # the upload will be available. Only one marketplace can be specified.
21
+ # @param marketplace_ids [Array<String>] The marketplace ID is the globally unique identifier of a marketplace. To
22
+ # find the ID for your marketplace, refer to [Marketplace
23
+ # IDs](https://developer-docs.amazon.com/sp-api/docs/marketplace-ids).
23
24
  # @param content_md5 [String] An MD5 hash of the content to be submitted to the upload destination. This value is
24
25
  # used to determine if the data has been corrupted or tampered with during transit.
25
- # @param resource [String] The resource for the upload destination that you are creating. For example, if you are
26
- # creating an upload destination for the createLegalDisclosure operation of the Messaging API, the `{resource}`
27
- # would be `/messaging/v1/orders/{amazonOrderId}/messages/legalDisclosure`, and the entire path would be
26
+ # @param resource [String] The upload destination for your resource. For example, if you create an upload
27
+ # destination for the `createLegalDisclosure` operation of the Messaging API, the `{resource}` would be
28
+ # `/messaging/v1/orders/{amazonOrderId}/messages/legalDisclosure`, and the entire path would be
28
29
  # `/uploads/2020-11-01/uploadDestinations/messaging/v1/orders/{amazonOrderId}/messages/legalDisclosure`. If you
29
- # are creating an upload destination for an Aplus content document, the `{resource}` would be
30
+ # create an upload destination for an Aplus content document, the `{resource}` would be
30
31
  # `aplus/2020-11-01/contentDocuments` and the path would be
31
- # `/uploads/v1/uploadDestinations/aplus/2020-11-01/contentDocuments`.
32
- # @param content_type [String] The content type of the file to be uploaded.
32
+ # `/uploads/2020-11-01/uploadDestinations/aplus/2020-11-01/contentDocuments`.
33
+ # @param content_type [String] The content type of the file you upload.
33
34
  # @param rate_limit [Float] Requests per second
34
35
  # @return [Peddler::Response] The API response
35
36
  def create_upload_destination_for_resource(marketplace_ids, content_md5, resource, content_type: nil,
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "peddler/api"
4
+
5
+ module Peddler
6
+ class << self
7
+ def vehicles_2024_11_01(...)
8
+ APIs::Vehicles20241101.new(...)
9
+ end
10
+ end
11
+
12
+ module APIs
13
+ # The Selling Partner API for Automotive.
14
+ #
15
+ # The Selling Partner API for Automotive provides programmatic access to information needed by selling partners to
16
+ # provide compatibility information about their listed products.
17
+ class Vehicles20241101 < API
18
+ # Get the latest collection of vehicles
19
+ #
20
+ # @note This operation can make a static sandbox call.
21
+ # @param page_token [String] A token to fetch a certain page when there are multiple pages worth of results.
22
+ # @param marketplace_id [String] An identifier for the marketplace in which the resource operates.
23
+ # @param vehicle_type [String] An identifier for vehicle type.
24
+ # @param updated_after [String] Date in ISO 8601 format, if provided only vehicles which are modified/added to
25
+ # Amazon's catalog after this date will be returned.
26
+ # @return [Peddler::Response] The API response
27
+ def get_vehicles(marketplace_id, vehicle_type, page_token: nil, updated_after: nil)
28
+ path = "/catalog/2024-11-01/automotive/vehicles"
29
+ params = {
30
+ "pageToken" => page_token,
31
+ "marketplaceId" => marketplace_id,
32
+ "vehicleType" => vehicle_type,
33
+ "updatedAfter" => updated_after,
34
+ }.compact
35
+
36
+ get(path, params:)
37
+ end
38
+ end
39
+ end
40
+ end
@@ -12,22 +12,23 @@ module Peddler
12
12
  module APIs
13
13
  # Selling Partner API for Direct Fulfillment Shipping
14
14
  #
15
- # The Selling Partner API for Direct Fulfillment Shipping provides programmatic access to a direct fulfillment
16
- # vendor's shipping data.
15
+ # Use the Selling Partner API for Direct Fulfillment Shipping to access a direct fulfillment vendor's shipping data.
17
16
  class VendorDirectFulfillmentShipping20211228 < API
18
- # Returns a list of shipping labels created during the time frame that you specify. You define that time frame
19
- # using the createdAfter and createdBefore parameters. You must use both of these parameters. The date range to
20
- # search must not be more than 7 days.
17
+ # Returns a list of shipping labels created during the time frame that you specify. Use the `createdAfter` and
18
+ # `createdBefore` parameters to define the time frame. You must use both of these parameters. The date range to
19
+ # search must not be more than seven days.
21
20
  #
22
21
  # @note This operation can make a dynamic sandbox call.
23
- # @param ship_from_party_id [String] The vendor warehouseId for order fulfillment. If not specified, the result
24
- # will contain orders for all warehouses.
22
+ # @param ship_from_party_id [String] The vendor `warehouseId` for order fulfillment. If not specified, the result
23
+ # contains orders for all warehouses.
25
24
  # @param limit [Integer] The limit to the number of records returned.
26
25
  # @param created_after [String] Shipping labels that became available after this date and time will be included in
27
- # the result. Must be in ISO-8601 date/time format.
26
+ # the result. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format.
28
27
  # @param created_before [String] Shipping labels that became available before this date and time will be included
29
- # in the result. Must be in ISO-8601 date/time format.
30
- # @param sort_order [String] Sort ASC or DESC by order creation date.
28
+ # in the result. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time
29
+ # format.
30
+ # @param sort_order [String] The sort order creation date. You can choose between ascending (`ASC`) or descending
31
+ # (`DESC`) sort order.
31
32
  # @param next_token [String] Used for pagination when there are more ship labels than the specified result size
32
33
  # limit. The token value is returned in the previous API call.
33
34
  # @param rate_limit [Float] Requests per second
@@ -47,10 +48,10 @@ module Peddler
47
48
  meter(rate_limit).get(path, params:)
48
49
  end
49
50
 
50
- # Creates a shipping label for a purchase order and returns a transactionId for reference.
51
+ # Creates a shipping label for a purchase order and returns a `transactionId` for reference.
51
52
  #
52
53
  # @note This operation can make a dynamic sandbox call.
53
- # @param body [Hash] Request body containing the shipping labels data.
54
+ # @param body [Hash] The request body that contains the shipping labels data.
54
55
  # @param rate_limit [Float] Requests per second
55
56
  # @return [Peddler::Response] The API response
56
57
  def submit_shipping_label_request(body, rate_limit: 10.0)
@@ -59,11 +60,11 @@ module Peddler
59
60
  meter(rate_limit).post(path, body:)
60
61
  end
61
62
 
62
- # Returns a shipping label for the purchaseOrderNumber that you specify.
63
+ # Returns a shipping label for the `purchaseOrderNumber` that you specify.
63
64
  #
64
65
  # @note This operation can make a dynamic sandbox call.
65
- # @param purchase_order_number [String] The purchase order number for which you want to return the shipping label
66
- # and should be the same purchaseOrderNumber as received in the order.
66
+ # @param purchase_order_number [String] The purchase order number for which you want to return the shipping label.
67
+ # It should be the same `purchaseOrderNumber` that you received in the order.
67
68
  # @param rate_limit [Float] Requests per second
68
69
  # @return [Peddler::Response] The API response
69
70
  def get_shipping_label(purchase_order_number, rate_limit: 10.0)
@@ -76,8 +77,8 @@ module Peddler
76
77
  #
77
78
  # @note This operation can make a dynamic sandbox call.
78
79
  # @param purchase_order_number [String] The purchase order number for which you want to return the shipping
79
- # labels. It should be the same purchaseOrderNumber as received in the order.
80
- # @param body [Hash] The request payload containing parameters for creating shipping labels.
80
+ # labels. It should be the same number as the `purchaseOrderNumber` in the order.
81
+ # @param body [Hash] The request payload that contains the parameters for creating shipping labels.
81
82
  # @param rate_limit [Float] Requests per second
82
83
  # @return [Peddler::Response] The API response
83
84
  def create_shipping_labels(purchase_order_number, body, rate_limit: 10.0)
@@ -121,9 +122,9 @@ module Peddler
121
122
  # will contain orders for all warehouses.
122
123
  # @param limit [Integer] The limit to the number of records returned
123
124
  # @param created_after [String] Orders that became available after this date and time will be included in the
124
- # result. Must be in ISO-8601 date/time format.
125
+ # result. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format.
125
126
  # @param created_before [String] Orders that became available before this date and time will be included in the
126
- # result. Must be in ISO-8601 date/time format.
127
+ # result. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format.
127
128
  # @param sort_order [String] Sort ASC or DESC by order creation date.
128
129
  # @param next_token [String] Used for pagination when there are more orders than the specified result size limit.
129
130
  # The token value is returned in the previous API call.
@@ -160,14 +161,14 @@ module Peddler
160
161
  # must not be more than 7 days.
161
162
  #
162
163
  # @note This operation can make a dynamic sandbox call.
163
- # @param ship_from_party_id [String] The vendor warehouseId for order fulfillment. If not specified the result
164
- # will contain orders for all warehouses.
165
- # @param limit [Integer] The limit to the number of records returned
166
- # @param created_after [String] Packing slips that became available after this date and time will be included in
167
- # the result. Must be in ISO-8601 date/time format.
164
+ # @param ship_from_party_id [String] The vendor `warehouseId` for order fulfillment. If not specified, the result
165
+ # contains orders for all warehouses.
166
+ # @param limit [Integer] The maximum number of records to return.
167
+ # @param created_after [String] Packing slips that become available after this date and time will be included in
168
+ # the result. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format.
168
169
  # @param created_before [String] Packing slips that became available before this date and time will be included in
169
- # the result. Must be in ISO-8601 date/time format.
170
- # @param sort_order [String] Sort ASC or DESC by packing slip creation date.
170
+ # the result. Values are in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date-time format.
171
+ # @param sort_order [String] The packing slip creation dates, which are sorted by ascending or descending order.
171
172
  # @param next_token [String] Used for pagination when there are more packing slips than the specified result size
172
173
  # limit. The token value is returned in the previous API call.
173
174
  # @param rate_limit [Float] Requests per second
@@ -190,7 +191,7 @@ module Peddler
190
191
  # Returns a packing slip based on the purchaseOrderNumber that you specify.
191
192
  #
192
193
  # @note This operation can make a dynamic sandbox call.
193
- # @param purchase_order_number [String] The purchaseOrderNumber for the packing slip you want.
194
+ # @param purchase_order_number [String] The `purchaseOrderNumber` for the packing slip that you want.
194
195
  # @param rate_limit [Float] Requests per second
195
196
  # @return [Peddler::Response] The API response
196
197
  def get_packing_slip(purchase_order_number, rate_limit: 10.0)
@@ -198,6 +199,18 @@ module Peddler
198
199
 
199
200
  meter(rate_limit).get(path)
200
201
  end
202
+
203
+ # Creates a container (pallet) label for the associated shipment package.
204
+ #
205
+ # @note This operation can make a dynamic sandbox call.
206
+ # @param body [Hash] Request body containing the container label data.
207
+ # @param rate_limit [Float] Requests per second
208
+ # @return [Peddler::Response] The API response
209
+ def create_container_label(body, rate_limit: 10.0)
210
+ path = "/vendor/directFulfillment/shipping/2021-12-28/containerLabel"
211
+
212
+ meter(rate_limit).post(path, body:)
213
+ end
201
214
  end
202
215
  end
203
216
  end
@@ -10,7 +10,7 @@ module Peddler
10
10
  end
11
11
 
12
12
  module APIs
13
- # Vendor Invoices v1
13
+ # Selling Partner API for Retail Procurement Payments
14
14
  #
15
15
  # The Selling Partner API for Retail Procurement Payments provides programmatic access to vendors payments data.
16
16
  class VendorInvoicesV1 < API
@@ -10,7 +10,7 @@ module Peddler
10
10
  end
11
11
 
12
12
  module APIs
13
- # Vendor Shipments v1
13
+ # Selling Partner API for Retail Procurement Shipments
14
14
  #
15
15
  # The Selling Partner API for Retail Procurement Shipments provides programmatic access to retail shipping data for
16
16
  # vendors.
@@ -127,6 +127,45 @@ module Peddler
127
127
 
128
128
  meter(rate_limit).get(path, params:)
129
129
  end
130
+
131
+ # Returns small parcel shipment labels based on the filters that you specify.
132
+ #
133
+ # @param limit [Integer] The limit to the number of records returned. Default value is 50 records.
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
136
+ # `nextToken` when the number of results exceeds the specified `pageSize` value. To get the next page of
137
+ # results, call the operation with this token and include the same arguments as the call that produced the
138
+ # token. To get a complete list, call this operation until `nextToken` is null. Note that this operation can
139
+ # return empty pages.
140
+ # @param label_created_after [String] Shipment labels created after this time will be included in the result. This
141
+ # field must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) datetime format.
142
+ # @param label_created_before [String] Shipment labels created before this time will be included in the result.
143
+ # This field must be in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) datetime format.
144
+ # @param buyer_reference_number [String] Get Shipment labels by passing buyer reference number.
145
+ # @param vendor_shipment_identifier [String] Get Shipment labels by passing vendor shipment identifier.
146
+ # @param seller_warehouse_code [String] Get Shipping labels based on vendor warehouse code. This value must be
147
+ # same as the `sellingParty.partyId` in the shipment.
148
+ # @param rate_limit [Float] Requests per second
149
+ # @return [Peddler::Response] The API response
150
+ def get_shipment_labels(limit: nil, sort_order: nil, next_token: nil, label_created_after: nil,
151
+ label_created_before: nil, buyer_reference_number: nil, vendor_shipment_identifier: nil,
152
+ seller_warehouse_code: nil, rate_limit: 10.0)
153
+ cannot_sandbox!
154
+
155
+ path = "/vendor/shipping/v1/transportLabels"
156
+ params = {
157
+ "limit" => limit,
158
+ "sortOrder" => sort_order,
159
+ "nextToken" => next_token,
160
+ "labelCreatedAfter" => label_created_after,
161
+ "labelCreatedBefore" => label_created_before,
162
+ "buyerReferenceNumber" => buyer_reference_number,
163
+ "vendorShipmentIdentifier" => vendor_shipment_identifier,
164
+ "sellerWarehouseCode" => seller_warehouse_code,
165
+ }.compact
166
+
167
+ meter(rate_limit).get(path, params:)
168
+ end
130
169
  end
131
170
  end
132
171
  end
data/lib/peddler/error.rb CHANGED
@@ -8,7 +8,7 @@ module Peddler
8
8
  class << self
9
9
  def build(response)
10
10
  error = JSON.parse(response).dig("errors").first
11
- class_name = error.dig("code")
11
+ class_name = normalize_class_name(error.dig("code"))
12
12
  message = error.dig("message")
13
13
  klass = if Errors.const_defined?(class_name)
14
14
  Errors.const_get(class_name)
@@ -23,6 +23,16 @@ module Peddler
23
23
  rescue NameError
24
24
  # Do nothing if code cannot be converted to a class name
25
25
  end
26
+
27
+ private
28
+
29
+ def normalize_class_name(code)
30
+ if code.match?(/\A[A-Z_]+\z/)
31
+ code.split("_").map(&:capitalize).join
32
+ else
33
+ code
34
+ end
35
+ end
26
36
  end
27
37
 
28
38
  def initialize(msg = nil, response = nil)
data/lib/peddler/token.rb CHANGED
@@ -45,6 +45,18 @@ module Peddler
45
45
  response
46
46
  end
47
47
 
48
+ def grant_type
49
+ if options.key?(:grant_type)
50
+ options[:grant_type]
51
+ elsif options.key?(:refresh_token)
52
+ "refresh_token"
53
+ elsif options.key?(:scope)
54
+ "client_credentials"
55
+ elsif options.key?(:code)
56
+ "authorization_code"
57
+ end
58
+ end
59
+
48
60
  private
49
61
 
50
62
  def params
@@ -54,17 +66,5 @@ module Peddler
54
66
  client_secret: client_secret,
55
67
  }.compact.merge(options)
56
68
  end
57
-
58
- def grant_type
59
- return if options.key?(:grant_type)
60
-
61
- if options.key?(:refresh_token)
62
- "refresh_token"
63
- elsif options.key?(:scope)
64
- "client_credentials"
65
- elsif options.key?(:code)
66
- "authorization_code"
67
- end
68
- end
69
69
  end
70
70
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Peddler
4
- VERSION = "4.1.1"
4
+ VERSION = "4.2.0"
5
5
  end
data/lib/peddler.rb CHANGED
@@ -12,6 +12,7 @@ require "peddler/apis/easy_ship_2022_03_23"
12
12
  require "peddler/apis/fba_inbound_eligibility_v1"
13
13
  require "peddler/apis/fba_inventory_v1"
14
14
  require "peddler/apis/feeds_2021_06_30"
15
+ require "peddler/apis/finances_2024_06_01"
15
16
  require "peddler/apis/finances_2024_06_19"
16
17
  require "peddler/apis/finances_v0"
17
18
  require "peddler/apis/fulfillment_inbound_2024_03_20"
@@ -41,6 +42,7 @@ require "peddler/apis/solicitations_v1"
41
42
  require "peddler/apis/supply_sources_2020_07_01"
42
43
  require "peddler/apis/tokens_2021_03_01"
43
44
  require "peddler/apis/uploads_2020_11_01"
45
+ require "peddler/apis/vehicles_2024_11_01"
44
46
  require "peddler/apis/vendor_direct_fulfillment_inventory_v1"
45
47
  require "peddler/apis/vendor_direct_fulfillment_orders_2021_12_28"
46
48
  require "peddler/apis/vendor_direct_fulfillment_orders_v1"