peddler 3.0.0.beta1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +96 -106
  3. data/lib/peddler/api/amazon_warehousing_and_distribution_2024_05_09.rb +34 -22
  4. data/lib/peddler/api/aplus_content_2020_11_01.rb +86 -48
  5. data/lib/peddler/api/application_integrations_2024_04_01.rb +56 -0
  6. data/lib/peddler/api/application_management_2023_11_30.rb +12 -2
  7. data/lib/peddler/api/catalog_items_2020_12_01.rb +31 -20
  8. data/lib/peddler/api/catalog_items_2022_04_01.rb +35 -25
  9. data/lib/peddler/api/catalog_items_v0.rb +39 -26
  10. data/lib/peddler/api/data_kiosk_2023_11_15.rb +41 -25
  11. data/lib/peddler/api/easy_ship_2022_03_23.rb +62 -43
  12. data/lib/peddler/api/fba_inbound_eligibility_v1.rb +13 -5
  13. data/lib/peddler/api/fba_inventory_v1.rb +40 -24
  14. data/lib/peddler/api/feeds_2021_06_30.rb +43 -25
  15. data/lib/peddler/api/finances_2024_06_19.rb +50 -0
  16. data/lib/peddler/api/finances_v0.rb +86 -59
  17. data/lib/peddler/api/fulfillment_inbound_2024_03_20.rb +304 -205
  18. data/lib/peddler/api/fulfillment_inbound_v0.rb +112 -74
  19. data/lib/peddler/api/fulfillment_outbound_2020_07_01.rb +90 -53
  20. data/lib/peddler/api/invoices_2024_06_19.rb +180 -0
  21. data/lib/peddler/api/listings_items_2020_09_01.rb +44 -33
  22. data/lib/peddler/api/listings_items_2021_08_01.rb +76 -60
  23. data/lib/peddler/api/listings_restrictions_2021_08_01.rb +19 -9
  24. data/lib/peddler/api/merchant_fulfillment_v0.rb +31 -15
  25. data/lib/peddler/api/messaging_v1.rb +93 -61
  26. data/lib/peddler/api/notifications_v1.rb +54 -23
  27. data/lib/peddler/api/orders_v0.rb +87 -72
  28. data/lib/peddler/api/product_fees_v0.rb +39 -31
  29. data/lib/peddler/api/product_pricing_2022_05_01.rb +17 -6
  30. data/lib/peddler/api/product_pricing_v0.rb +63 -45
  31. data/lib/peddler/api/product_type_definitions_2020_09_01.rb +29 -18
  32. data/lib/peddler/api/replenishment_2022_11_07.rb +21 -9
  33. data/lib/peddler/api/reports_2021_06_30.rb +60 -36
  34. data/lib/peddler/api/sales_v1.rb +20 -12
  35. data/lib/peddler/api/sellers_v1.rb +16 -4
  36. data/lib/peddler/api/services_v1.rb +138 -98
  37. data/lib/peddler/api/shipment_invoicing_v0.rb +25 -12
  38. data/lib/peddler/api/shipping_v1.rb +54 -29
  39. data/lib/peddler/api/shipping_v2.rb +132 -80
  40. data/lib/peddler/api/solicitations_v1.rb +18 -8
  41. data/lib/peddler/api/supply_sources_2020_07_01.rb +33 -15
  42. data/lib/peddler/api/tokens_2021_03_01.rb +13 -5
  43. data/lib/peddler/api/uploads_2020_11_01.rb +16 -6
  44. data/lib/peddler/api/vendor_direct_fulfillment_inventory_v1.rb +12 -4
  45. data/lib/peddler/api/vendor_direct_fulfillment_orders_2021_12_28.rb +29 -17
  46. data/lib/peddler/api/vendor_direct_fulfillment_orders_v1.rb +29 -17
  47. data/lib/peddler/api/vendor_direct_fulfillment_payments_v1.rb +11 -3
  48. data/lib/peddler/api/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.rb +14 -4
  49. data/lib/peddler/api/vendor_direct_fulfillment_shipping_2021_12_28.rb +74 -48
  50. data/lib/peddler/api/vendor_direct_fulfillment_shipping_v1.rb +74 -50
  51. data/lib/peddler/api/vendor_direct_fulfillment_transactions_2021_12_28.rb +11 -3
  52. data/lib/peddler/api/vendor_direct_fulfillment_transactions_v1.rb +11 -3
  53. data/lib/peddler/api/vendor_invoices_v1.rb +11 -3
  54. data/lib/peddler/api/vendor_orders_v1.rb +54 -43
  55. data/lib/peddler/api/vendor_shipments_v1.rb +63 -51
  56. data/lib/peddler/api/vendor_transaction_status_v1.rb +12 -3
  57. data/lib/peddler/api.rb +41 -18
  58. data/lib/peddler/endpoint.rb +51 -0
  59. data/lib/peddler/error.rb +1 -0
  60. data/lib/peddler/marketplace.rb +49 -0
  61. data/lib/peddler/token.rb +70 -0
  62. data/lib/peddler/version.rb +1 -1
  63. data/lib/peddler.rb +56 -52
  64. metadata +10 -6
  65. data/lib/peddler/access_token.rb +0 -76
  66. data/lib/peddler/region.rb +0 -30
@@ -3,6 +3,12 @@
3
3
  require "peddler/api"
4
4
 
5
5
  module Peddler
6
+ class << self
7
+ def shipping_v1(...)
8
+ API::ShippingV1.new(...)
9
+ end
10
+ end
11
+
6
12
  class API
7
13
  # Selling Partner API for Shipping
8
14
  #
@@ -14,93 +20,112 @@ module Peddler
14
20
  class ShippingV1 < API
15
21
  # Create a new shipment.
16
22
  #
17
- # @param [Hash] body
23
+ # @note This operation can make a static sandbox call.
24
+ # @param body [Hash]
25
+ # @param rate_limit [Float] Requests per second
18
26
  # @return [Hash] The API response
19
- def create_shipment(body)
27
+ def create_shipment(body, rate_limit: 5.0)
20
28
  path = "/shipping/v1/shipments"
21
29
 
22
- rate_limit(5.0).post(path, body:)
30
+ meter(rate_limit).post(path, body:)
23
31
  end
24
32
 
25
33
  # Return the entire shipment object for the shipmentId.
26
34
  #
27
- # @param [String] shipment_id
35
+ # @note This operation can make a static sandbox call.
36
+ # @param shipment_id [String]
37
+ # @param rate_limit [Float] Requests per second
28
38
  # @return [Hash] The API response
29
- def get_shipment(shipment_id)
39
+ def get_shipment(shipment_id, rate_limit: 5.0)
30
40
  path = "/shipping/v1/shipments/#{shipment_id}"
31
41
 
32
- rate_limit(5.0).get(path)
42
+ meter(rate_limit).get(path)
33
43
  end
34
44
 
35
45
  # Cancel a shipment by the given shipmentId.
36
46
  #
37
- # @param [String] shipment_id
47
+ # @note This operation can make a static sandbox call.
48
+ # @param shipment_id [String]
49
+ # @param rate_limit [Float] Requests per second
38
50
  # @return [Hash] The API response
39
- def cancel_shipment(shipment_id)
51
+ def cancel_shipment(shipment_id, rate_limit: 5.0)
40
52
  path = "/shipping/v1/shipments/#{shipment_id}/cancel"
41
53
 
42
- rate_limit(5.0).post(path)
54
+ meter(rate_limit).post(path)
43
55
  end
44
56
 
45
57
  # Purchase shipping labels based on a given rate.
46
58
  #
47
- # @param [String] shipment_id
48
- # @param [Hash] body
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
49
63
  # @return [Hash] The API response
50
- def purchase_labels(shipment_id, body)
64
+ def purchase_labels(shipment_id, body, rate_limit: 5.0)
51
65
  path = "/shipping/v1/shipments/#{shipment_id}/purchaseLabels"
52
66
 
53
- rate_limit(5.0).post(path, body:)
67
+ meter(rate_limit).post(path, body:)
54
68
  end
55
69
 
56
70
  # Retrieve shipping label based on the shipment id and tracking id.
57
71
  #
58
- # @param [String] shipment_id
59
- # @param [String] tracking_id
60
- # @param [Hash] body
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
61
77
  # @return [Hash] The API response
62
- def retrieve_shipping_label(shipment_id, tracking_id, body)
78
+ def retrieve_shipping_label(shipment_id, tracking_id, body, rate_limit: 5.0)
63
79
  path = "/shipping/v1/shipments/#{shipment_id}/containers/#{tracking_id}/label"
64
80
 
65
- rate_limit(5.0).post(path, body:)
81
+ meter(rate_limit).post(path, body:)
66
82
  end
67
83
 
68
84
  # Purchase shipping labels.
69
85
  #
70
- # @param [Hash] body
86
+ # @note This operation can make a static sandbox call.
87
+ # @param body [Hash]
88
+ # @param rate_limit [Float] Requests per second
71
89
  # @return [Hash] The API response
72
- def purchase_shipment(body)
90
+ def purchase_shipment(body, rate_limit: 5.0)
73
91
  path = "/shipping/v1/purchaseShipment"
74
92
 
75
- rate_limit(5.0).post(path, body:)
93
+ meter(rate_limit).post(path, body:)
76
94
  end
77
95
 
78
96
  # Get service rates.
79
97
  #
80
- # @param [Hash] body
98
+ # @note This operation can make a static sandbox call.
99
+ # @param body [Hash]
100
+ # @param rate_limit [Float] Requests per second
81
101
  # @return [Hash] The API response
82
- def get_rates(body)
102
+ def get_rates(body, rate_limit: 5.0)
83
103
  path = "/shipping/v1/rates"
84
104
 
85
- rate_limit(5.0).post(path, body:)
105
+ meter(rate_limit).post(path, body:)
86
106
  end
87
107
 
88
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
89
112
  # @return [Hash] The API response
90
- def get_account
113
+ def get_account(rate_limit: 5.0)
91
114
  path = "/shipping/v1/account"
92
115
 
93
- rate_limit(5.0).get(path)
116
+ meter(rate_limit).get(path)
94
117
  end
95
118
 
96
119
  # Return the tracking information of a shipment.
97
120
  #
98
- # @param [String] tracking_id
121
+ # @note This operation can make a static sandbox call.
122
+ # @param tracking_id [String]
123
+ # @param rate_limit [Float] Requests per second
99
124
  # @return [Hash] The API response
100
- def get_tracking_information(tracking_id)
125
+ def get_tracking_information(tracking_id, rate_limit: 1.0)
101
126
  path = "/shipping/v1/tracking/#{tracking_id}"
102
127
 
103
- rate_limit(1.0).get(path)
128
+ meter(rate_limit).get(path)
104
129
  end
105
130
  end
106
131
  end
@@ -3,6 +3,12 @@
3
3
  require "peddler/api"
4
4
 
5
5
  module Peddler
6
+ class << self
7
+ def shipping_v2(...)
8
+ API::ShippingV2.new(...)
9
+ end
10
+ end
11
+
6
12
  class API
7
13
  # Amazon Shipping API
8
14
  #
@@ -12,32 +18,38 @@ module Peddler
12
18
  class ShippingV2 < API
13
19
  # Returns the available shipping service offerings.
14
20
  #
15
- # @param [Hash] body
16
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
21
+ # @note This operation can make a dynamic sandbox call.
22
+ # @param body [Hash]
23
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
17
24
  # AmazonShipping_UK.
25
+ # @param rate_limit [Float] Requests per second
18
26
  # @return [Hash] The API response
19
- def get_rates(body, x_amzn_shipping_business_id: nil)
27
+ def get_rates(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
20
28
  path = "/shipping/v2/shipments/rates"
21
29
 
22
- rate_limit(80.0).post(path, body:)
30
+ meter(rate_limit).post(path, body:)
23
31
  end
24
32
 
25
33
  # Purchases the shipping service for a shipment using the best fit service offering. Returns purchase related
26
34
  # details and documents.
27
35
  #
28
- # @param [Hash] body
29
- # @param [String] x_amzn_idempotency_key A unique value which the server uses to recognize subsequent retries of
36
+ # @param body [Hash]
37
+ # @param x_amzn_idempotency_key [String] A unique value which the server uses to recognize subsequent retries of
30
38
  # the same request.
31
- # @param [String] locale The IETF Language Tag. Note that this only supports the primary language subtag with one
39
+ # @param locale [String] The IETF Language Tag. Note that this only supports the primary language subtag with one
32
40
  # secondary language subtag (i.e. en-US, fr-CA). The secondary language subtag is almost always a regional
33
41
  # designation. This does not support additional subtags beyond the primary and secondary language subtags.
34
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
42
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
35
43
  # AmazonShipping_UK.
44
+ # @param rate_limit [Float] Requests per second
36
45
  # @return [Hash] The API response
37
- def direct_purchase_shipment(body, x_amzn_idempotency_key: nil, locale: nil, x_amzn_shipping_business_id: nil)
46
+ def direct_purchase_shipment(body, x_amzn_idempotency_key: nil, locale: nil, x_amzn_shipping_business_id: nil,
47
+ rate_limit: 80.0)
48
+ cannot_sandbox!
49
+
38
50
  path = "/shipping/v2/shipments/directPurchase"
39
51
 
40
- rate_limit(80.0).post(path, body:)
52
+ meter(rate_limit).post(path, body:)
41
53
  end
42
54
 
43
55
  # Purchases a shipping service and returns purchase related details and documents. Note: You must complete the
@@ -45,63 +57,71 @@ module Peddler
45
57
  # 10 minutes have expired, you will receive an error response with the error code equal to "TOKEN_EXPIRED". If you
46
58
  # receive this error response, you must get the rates for the shipment again.
47
59
  #
48
- # @param [Hash] body
49
- # @param [String] x_amzn_idempotency_key A unique value which the server uses to recognize subsequent retries of
60
+ # @note This operation can make a dynamic sandbox call.
61
+ # @param body [Hash]
62
+ # @param x_amzn_idempotency_key [String] A unique value which the server uses to recognize subsequent retries of
50
63
  # the same request.
51
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
64
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
52
65
  # AmazonShipping_UK.
66
+ # @param rate_limit [Float] Requests per second
53
67
  # @return [Hash] The API response
54
- def purchase_shipment(body, x_amzn_idempotency_key: nil, x_amzn_shipping_business_id: nil)
68
+ def purchase_shipment(body, x_amzn_idempotency_key: nil, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
55
69
  path = "/shipping/v2/shipments"
56
70
 
57
- rate_limit(80.0).post(path, body:)
71
+ meter(rate_limit).post(path, body:)
58
72
  end
59
73
 
60
74
  # Purchases a shipping service identifier and returns purchase-related details and documents.
61
75
  #
62
- # @param [Hash] body
63
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
76
+ # @note This operation can make a dynamic sandbox call.
77
+ # @param body [Hash]
78
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
64
79
  # AmazonShipping_UK.
80
+ # @param rate_limit [Float] Requests per second
65
81
  # @return [Hash] The API response
66
- def one_click_shipment(body, x_amzn_shipping_business_id: nil)
82
+ def one_click_shipment(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
67
83
  path = "/shipping/v2/oneClickShipment"
68
84
 
69
- rate_limit(80.0).post(path, body:)
85
+ meter(rate_limit).post(path, body:)
70
86
  end
71
87
 
72
88
  # Returns tracking information for a purchased shipment.
73
89
  #
74
- # @param [String] tracking_id A carrier-generated tracking identifier originally returned by the purchaseShipment
90
+ # @note This operation can make a dynamic sandbox call.
91
+ # @param tracking_id [String] A carrier-generated tracking identifier originally returned by the purchaseShipment
75
92
  # operation.
76
- # @param [String] carrier_id A carrier identifier originally returned by the getRates operation for the selected
93
+ # @param carrier_id [String] A carrier identifier originally returned by the getRates operation for the selected
77
94
  # rate.
78
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
95
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
79
96
  # AmazonShipping_UK.
97
+ # @param rate_limit [Float] Requests per second
80
98
  # @return [Hash] The API response
81
- def get_tracking(tracking_id, carrier_id, x_amzn_shipping_business_id: nil)
99
+ def get_tracking(tracking_id, carrier_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
82
100
  path = "/shipping/v2/tracking"
83
101
  params = {
84
102
  "trackingId" => tracking_id,
85
103
  "carrierId" => carrier_id,
86
104
  }.compact
87
105
 
88
- rate_limit(80.0).get(path, params:)
106
+ meter(rate_limit).get(path, params:)
89
107
  end
90
108
 
91
109
  # Returns the shipping documents associated with a package in a shipment.
92
110
  #
93
- # @param [String] shipment_id The shipment identifier originally returned by the purchaseShipment operation.
94
- # @param [String] package_client_reference_id The package client reference identifier originally provided in the
111
+ # @note This operation can make a dynamic sandbox call.
112
+ # @param shipment_id [String] The shipment identifier originally returned by the purchaseShipment operation.
113
+ # @param package_client_reference_id [String] The package client reference identifier originally provided in the
95
114
  # request body parameter for the getRates operation.
96
- # @param [String] format The file format of the document. Must be one of the supported formats returned by the
115
+ # @param format [String] The file format of the document. Must be one of the supported formats returned by the
97
116
  # getRates operation.
98
- # @param [Number] dpi The resolution of the document (for example, 300 means 300 dots per inch). Must be one of
117
+ # @param dpi [Number] The resolution of the document (for example, 300 means 300 dots per inch). Must be one of
99
118
  # the supported resolutions returned in the response to the getRates operation.
100
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
119
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
101
120
  # AmazonShipping_UK.
121
+ # @param rate_limit [Float] Requests per second
102
122
  # @return [Hash] The API response
103
123
  def get_shipment_documents(shipment_id, package_client_reference_id, format: nil, dpi: nil,
104
- x_amzn_shipping_business_id: nil)
124
+ x_amzn_shipping_business_id: nil, rate_limit: 80.0)
105
125
  path = "/shipping/v2/shipments/#{shipment_id}/documents"
106
126
  params = {
107
127
  "packageClientReferenceId" => package_client_reference_id,
@@ -109,150 +129,182 @@ module Peddler
109
129
  "dpi" => dpi,
110
130
  }.compact
111
131
 
112
- rate_limit(80.0).get(path, params:)
132
+ meter(rate_limit).get(path, params:)
113
133
  end
114
134
 
115
135
  # Cancels a purchased shipment. Returns an empty object if the shipment is successfully cancelled.
116
136
  #
117
- # @param [String] shipment_id The shipment identifier originally returned by the purchaseShipment operation.
118
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
137
+ # @note This operation can make a dynamic sandbox call.
138
+ # @param shipment_id [String] The shipment identifier originally returned by the purchaseShipment operation.
139
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
119
140
  # AmazonShipping_UK.
141
+ # @param rate_limit [Float] Requests per second
120
142
  # @return [Hash] The API response
121
- def cancel_shipment(shipment_id, x_amzn_shipping_business_id: nil)
143
+ def cancel_shipment(shipment_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
122
144
  path = "/shipping/v2/shipments/#{shipment_id}/cancel"
123
145
 
124
- rate_limit(80.0).put(path)
146
+ meter(rate_limit).put(path)
125
147
  end
126
148
 
127
149
  # Returns the JSON schema to use for providing additional inputs when needed to purchase a shipping offering. Call
128
150
  # the getAdditionalInputs operation when the response to a previous call to the getRates operation indicates that
129
151
  # additional inputs are required for the rate (shipping offering) that you want to purchase.
130
152
  #
131
- # @param [String] request_token The request token returned in the response to the getRates operation.
132
- # @param [String] rate_id The rate identifier for the shipping offering (rate) returned in the response to the
153
+ # @note This operation can make a static sandbox call.
154
+ # @param request_token [String] The request token returned in the response to the getRates operation.
155
+ # @param rate_id [String] The rate identifier for the shipping offering (rate) returned in the response to the
133
156
  # getRates operation.
134
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
157
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
135
158
  # AmazonShipping_UK.
159
+ # @param rate_limit [Float] Requests per second
136
160
  # @return [Hash] The API response
137
- def get_additional_inputs(request_token, rate_id, x_amzn_shipping_business_id: nil)
161
+ def get_additional_inputs(request_token, rate_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
138
162
  path = "/shipping/v2/shipments/additionalInputs/schema"
139
163
  params = {
140
164
  "requestToken" => request_token,
141
165
  "rateId" => rate_id,
142
166
  }.compact
143
167
 
144
- rate_limit(80.0).get(path, params:)
168
+ meter(rate_limit).get(path, params:)
145
169
  end
146
170
 
147
171
  # This API will return a list of input schema required to register a shipper account with the carrier.
148
172
  #
149
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
173
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
150
174
  # AmazonShipping_UK.
175
+ # @param rate_limit [Float] Requests per second
151
176
  # @return [Hash] The API response
152
- def get_carrier_account_form_inputs(x_amzn_shipping_business_id: nil)
177
+ def get_carrier_account_form_inputs(x_amzn_shipping_business_id: nil, rate_limit: 80.0)
178
+ cannot_sandbox!
179
+
153
180
  path = "/shipping/v2/carrierAccountFormInputs"
154
181
 
155
- rate_limit(80.0).get(path)
182
+ meter(rate_limit).get(path)
156
183
  end
157
184
 
158
185
  # This API will return Get all carrier accounts for a merchant.
159
186
  #
160
- # @param [Hash] body
161
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
187
+ # @param body [Hash]
188
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
162
189
  # AmazonShipping_UK.
190
+ # @param rate_limit [Float] Requests per second
163
191
  # @return [Hash] The API response
164
- def get_carrier_accounts(body, x_amzn_shipping_business_id: nil)
192
+ def get_carrier_accounts(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
193
+ cannot_sandbox!
194
+
165
195
  path = "/shipping/v2/carrierAccounts"
166
196
 
167
- rate_limit(80.0).put(path, body:)
197
+ meter(rate_limit).put(path, body:)
168
198
  end
169
199
 
170
200
  # This API associates/links the specified carrier account with the merchant.
171
201
  #
172
- # @param [String] carrier_id The unique identifier associated with the carrier account.
173
- # @param [Hash] body
174
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
202
+ # @param carrier_id [String] The unique identifier associated with the carrier account.
203
+ # @param body [Hash]
204
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
175
205
  # AmazonShipping_UK.
206
+ # @param rate_limit [Float] Requests per second
176
207
  # @return [Hash] The API response
177
- def link_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil)
208
+ def link_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
209
+ cannot_sandbox!
210
+
178
211
  path = "/shipping/v2/carrierAccounts/#{carrier_id}"
179
212
 
180
- rate_limit(80.0).put(path, body:)
213
+ meter(rate_limit).put(path, body:)
181
214
  end
182
215
 
183
216
  # This API Unlink the specified carrier account with the merchant.
184
217
  #
185
- # @param [String] carrier_id carrier Id to unlink with merchant.
186
- # @param [Hash] body
187
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
218
+ # @param carrier_id [String] carrier Id to unlink with merchant.
219
+ # @param body [Hash]
220
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
188
221
  # AmazonShipping_UK.
222
+ # @param rate_limit [Float] Requests per second
189
223
  # @return [Hash] The API response
190
- def unlink_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil)
224
+ def unlink_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
225
+ cannot_sandbox!
226
+
191
227
  path = "/shipping/v2/carrierAccounts/#{carrier_id}/unlink"
192
228
 
193
- rate_limit(80.0).put(path, body:)
229
+ meter(rate_limit).put(path, body:)
194
230
  end
195
231
 
196
232
  # This API Call to generate the collection form.
197
233
  #
198
- # @param [Hash] body
199
- # @param [String] x_amzn_idempotency_key A unique value which the server uses to recognize subsequent retries of
234
+ # @param body [Hash]
235
+ # @param x_amzn_idempotency_key [String] A unique value which the server uses to recognize subsequent retries of
200
236
  # the same request.
201
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
237
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
202
238
  # AmazonShipping_UK.
239
+ # @param rate_limit [Float] Requests per second
203
240
  # @return [Hash] The API response
204
- def generate_collection_form(body, x_amzn_idempotency_key: nil, x_amzn_shipping_business_id: nil)
241
+ def generate_collection_form(body, x_amzn_idempotency_key: nil, x_amzn_shipping_business_id: nil,
242
+ rate_limit: 80.0)
243
+ cannot_sandbox!
244
+
205
245
  path = "/shipping/v2/collectionForms"
206
246
 
207
- rate_limit(80.0).post(path, body:)
247
+ meter(rate_limit).post(path, body:)
208
248
  end
209
249
 
210
250
  # This API Call to get the history of the previously generated collection forms.
211
251
  #
212
- # @param [Hash] body
213
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
252
+ # @param body [Hash]
253
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
214
254
  # AmazonShipping_UK.
255
+ # @param rate_limit [Float] Requests per second
215
256
  # @return [Hash] The API response
216
- def get_collection_form_history(body, x_amzn_shipping_business_id: nil)
257
+ def get_collection_form_history(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
258
+ cannot_sandbox!
259
+
217
260
  path = "/shipping/v2/collectionForms/history"
218
261
 
219
- rate_limit(80.0).put(path, body:)
262
+ meter(rate_limit).put(path, body:)
220
263
  end
221
264
 
222
265
  # This API Get all unmanifested carriers with shipment locations. Any locations which has unmanifested shipments
223
266
  # with an eligible carrier for manifesting shall be returned.
224
267
  #
225
- # @param [Hash] body
226
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
268
+ # @param body [Hash]
269
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
227
270
  # AmazonShipping_UK.
271
+ # @param rate_limit [Float] Requests per second
228
272
  # @return [Hash] The API response
229
- def get_unmanifested_shipments(body, x_amzn_shipping_business_id: nil)
273
+ def get_unmanifested_shipments(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
274
+ cannot_sandbox!
275
+
230
276
  path = "/shipping/v2/unmanifestedShipments"
231
277
 
232
- rate_limit(80.0).put(path, body:)
278
+ meter(rate_limit).put(path, body:)
233
279
  end
234
280
 
235
281
  # This API reprint a collection form.
236
282
  #
237
- # @param [String] collection_form_id collection form Id to reprint a collection.
238
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
283
+ # @param collection_form_id [String] collection form Id to reprint a collection.
284
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
239
285
  # AmazonShipping_UK.
286
+ # @param rate_limit [Float] Requests per second
240
287
  # @return [Hash] The API response
241
- def get_collection_form(collection_form_id, x_amzn_shipping_business_id: nil)
288
+ def get_collection_form(collection_form_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0)
289
+ cannot_sandbox!
290
+
242
291
  path = "/shipping/v2/collectionForms/#{collection_form_id}"
243
292
 
244
- rate_limit(80.0).get(path)
293
+ meter(rate_limit).get(path)
245
294
  end
246
295
 
247
296
  # Returns a list of access points in proximity of input postal code.
248
297
  #
249
- # @param [Array<String>] access_point_types
250
- # @param [String] country_code
251
- # @param [String] postal_code
252
- # @param [String] x_amzn_shipping_business_id Amazon shipping business to assume for this request. The default is
298
+ # @note This operation can make a dynamic sandbox call.
299
+ # @param access_point_types [Array<String>]
300
+ # @param country_code [String]
301
+ # @param postal_code [String]
302
+ # @param x_amzn_shipping_business_id [String] Amazon shipping business to assume for this request. The default is
253
303
  # AmazonShipping_UK.
304
+ # @param rate_limit [Float] Requests per second
254
305
  # @return [Hash] The API response
255
- def get_access_points(access_point_types, country_code, postal_code, x_amzn_shipping_business_id: nil)
306
+ def get_access_points(access_point_types, country_code, postal_code, x_amzn_shipping_business_id: nil,
307
+ rate_limit: 80.0)
256
308
  path = "/shipping/v2/accessPoints"
257
309
  params = {
258
310
  "accessPointTypes" => access_point_types,
@@ -260,7 +312,7 @@ module Peddler
260
312
  "postalCode" => postal_code,
261
313
  }.compact
262
314
 
263
- rate_limit(80.0).get(path, params:)
315
+ meter(rate_limit).get(path, params:)
264
316
  end
265
317
  end
266
318
  end
@@ -3,6 +3,12 @@
3
3
  require "peddler/api"
4
4
 
5
5
  module Peddler
6
+ class << self
7
+ def solicitations_v1(...)
8
+ API::SolicitationsV1.new(...)
9
+ end
10
+ end
11
+
6
12
  class API
7
13
  # Selling Partner API for Solicitations
8
14
  #
@@ -18,35 +24,39 @@ module Peddler
18
24
  # parameter(s) to call an operation that sends a solicitation. Currently only the
19
25
  # productReviewAndSellerFeedbackSolicitation solicitation type is available.
20
26
  #
21
- # @param [String] amazon_order_id An Amazon order identifier. This specifies the order for which you want a list
27
+ # @note This operation can make a static sandbox call.
28
+ # @param amazon_order_id [String] An Amazon order identifier. This specifies the order for which you want a list
22
29
  # of available solicitation types.
23
- # @param [Array<String>] marketplace_ids A marketplace identifier. This specifies the marketplace in which the
30
+ # @param marketplace_ids [Array<String>] A marketplace identifier. This specifies the marketplace in which the
24
31
  # order was placed. Only one marketplace can be specified.
32
+ # @param rate_limit [Float] Requests per second
25
33
  # @return [Hash] The API response
26
- def get_solicitation_actions_for_order(amazon_order_id, marketplace_ids)
34
+ def get_solicitation_actions_for_order(amazon_order_id, marketplace_ids, rate_limit: 1.0)
27
35
  path = "/solicitations/v1/orders/#{amazon_order_id}"
28
36
  params = {
29
37
  "marketplaceIds" => marketplace_ids,
30
38
  }.compact
31
39
 
32
- rate_limit(1.0).get(path, params:)
40
+ meter(rate_limit).get(path, params:)
33
41
  end
34
42
 
35
43
  # Sends a solicitation to a buyer asking for seller feedback and a product review for the specified order. Send
36
44
  # only one productReviewAndSellerFeedback or free form proactive message per order.
37
45
  #
38
- # @param [String] amazon_order_id An Amazon order identifier. This specifies the order for which a solicitation is
46
+ # @note This operation can make a static sandbox call.
47
+ # @param amazon_order_id [String] An Amazon order identifier. This specifies the order for which a solicitation is
39
48
  # sent.
40
- # @param [Array<String>] marketplace_ids A marketplace identifier. This specifies the marketplace in which the
49
+ # @param marketplace_ids [Array<String>] A marketplace identifier. This specifies the marketplace in which the
41
50
  # order was placed. Only one marketplace can be specified.
51
+ # @param rate_limit [Float] Requests per second
42
52
  # @return [Hash] The API response
43
- def create_product_review_and_seller_feedback_solicitation(amazon_order_id, marketplace_ids)
53
+ def create_product_review_and_seller_feedback_solicitation(amazon_order_id, marketplace_ids, rate_limit: 1.0)
44
54
  path = "/solicitations/v1/orders/#{amazon_order_id}/solicitations/productReviewAndSellerFeedback"
45
55
  params = {
46
56
  "marketplaceIds" => marketplace_ids,
47
57
  }.compact
48
58
 
49
- rate_limit(1.0).post(path, params:)
59
+ meter(rate_limit).post(path, params:)
50
60
  end
51
61
  end
52
62
  end