Class: Peddler::APIs::ShippingV2
- Inherits:
-
Peddler::API
- Object
- Peddler::API
- Peddler::APIs::ShippingV2
- Defined in:
- lib/peddler/apis/shipping_v2.rb
Overview
Amazon Shipping API
The Amazon Shipping API is designed to support outbound shipping use cases both for orders originating on Amazon-owned marketplaces as well as external channels/marketplaces. With these APIs, you can request shipping rates, create shipments, cancel shipments, and track shipments.
Instance Attribute Summary
Attributes inherited from Peddler::API
#access_token, #endpoint, #parser
Instance Method Summary collapse
-
#cancel_shipment(shipment_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
Cancels a purchased shipment.
-
#direct_purchase_shipment(body, x_amzn_idempotency_key: nil, locale: nil, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
Purchases the shipping service for a shipment using the best fit service offering.
-
#generate_collection_form(body, x_amzn_idempotency_key: nil, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This API Call to generate the collection form.
-
#get_access_points(access_point_types, country_code, postal_code, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
Returns a list of access points in proximity of input postal code.
-
#get_additional_inputs(request_token, rate_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
Returns the JSON schema to use for providing additional inputs when needed to purchase a shipping offering.
-
#get_carrier_account_form_inputs(x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This API will return a list of input schema required to register a shipper account with the carrier.
-
#get_carrier_accounts(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This API will return Get all carrier accounts for a merchant.
-
#get_collection_form(collection_form_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This API reprint a collection form.
-
#get_collection_form_history(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This API Call to get the history of the previously generated collection forms.
-
#get_rates(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
Returns the available shipping service offerings.
-
#get_shipment_documents(shipment_id, package_client_reference_id, format: nil, dpi: nil, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
Returns the shipping documents associated with a package in a shipment.
-
#get_tracking(tracking_id, carrier_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
Returns tracking information for a purchased shipment.
-
#get_unmanifested_shipments(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This API Get all unmanifested carriers with shipment locations.
-
#link_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This API associates/links the specified carrier account with the merchant.
-
#one_click_shipment(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
Purchases a shipping service identifier and returns purchase-related details and documents.
-
#purchase_shipment(body, x_amzn_idempotency_key: nil, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
Purchases a shipping service and returns purchase related details and documents.
-
#unlink_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This API Unlink the specified carrier account with the merchant.
Methods inherited from Peddler::API
#endpoint_uri, #http, #initialize, #meter, #retriable, #sandbox, #sandbox?, #use, #via
Constructor Details
This class inherits a constructor from Peddler::API
Instance Method Details
#cancel_shipment(shipment_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This operation can make a dynamic sandbox call.
Cancels a purchased shipment. Returns an empty object if the shipment is successfully cancelled.
143 144 145 146 147 |
# File 'lib/peddler/apis/shipping_v2.rb', line 143 def cancel_shipment(shipment_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0) path = "/shipping/v2/shipments/#{shipment_id}/cancel" meter(rate_limit).put(path) end |
#direct_purchase_shipment(body, x_amzn_idempotency_key: nil, locale: nil, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
Purchases the shipping service for a shipment using the best fit service offering. Returns purchase related details and documents.
46 47 48 49 50 51 52 53 |
# File 'lib/peddler/apis/shipping_v2.rb', line 46 def direct_purchase_shipment(body, x_amzn_idempotency_key: nil, locale: nil, x_amzn_shipping_business_id: nil, rate_limit: 80.0) cannot_sandbox! path = "/shipping/v2/shipments/directPurchase" meter(rate_limit).post(path, body:) end |
#generate_collection_form(body, x_amzn_idempotency_key: nil, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This API Call to generate the collection form.
241 242 243 244 245 246 247 248 |
# File 'lib/peddler/apis/shipping_v2.rb', line 241 def generate_collection_form(body, x_amzn_idempotency_key: nil, x_amzn_shipping_business_id: nil, rate_limit: 80.0) cannot_sandbox! path = "/shipping/v2/collectionForms" meter(rate_limit).post(path, body:) end |
#get_access_points(access_point_types, country_code, postal_code, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This operation can make a dynamic sandbox call.
Returns a list of access points in proximity of input postal code.
306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/peddler/apis/shipping_v2.rb', line 306 def get_access_points(access_point_types, country_code, postal_code, x_amzn_shipping_business_id: nil, rate_limit: 80.0) path = "/shipping/v2/accessPoints" params = { "accessPointTypes" => access_point_types, "countryCode" => country_code, "postalCode" => postal_code, }.compact meter(rate_limit).get(path, params:) end |
#get_additional_inputs(request_token, rate_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This operation can make a static sandbox call.
Returns the JSON schema to use for providing additional inputs when needed to purchase a shipping offering. Call the getAdditionalInputs operation when the response to a previous call to the getRates operation indicates that additional inputs are required for the rate (shipping offering) that you want to purchase.
161 162 163 164 165 166 167 168 169 |
# File 'lib/peddler/apis/shipping_v2.rb', line 161 def get_additional_inputs(request_token, rate_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0) path = "/shipping/v2/shipments/additionalInputs/schema" params = { "requestToken" => request_token, "rateId" => rate_id, }.compact meter(rate_limit).get(path, params:) end |
#get_carrier_account_form_inputs(x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This API will return a list of input schema required to register a shipper account with the carrier.
177 178 179 180 181 182 183 |
# File 'lib/peddler/apis/shipping_v2.rb', line 177 def get_carrier_account_form_inputs(x_amzn_shipping_business_id: nil, rate_limit: 80.0) cannot_sandbox! path = "/shipping/v2/carrierAccountFormInputs" meter(rate_limit).get(path) end |
#get_carrier_accounts(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This API will return Get all carrier accounts for a merchant.
192 193 194 195 196 197 198 |
# File 'lib/peddler/apis/shipping_v2.rb', line 192 def get_carrier_accounts(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) cannot_sandbox! path = "/shipping/v2/carrierAccounts" meter(rate_limit).put(path, body:) end |
#get_collection_form(collection_form_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This API reprint a collection form.
288 289 290 291 292 293 294 |
# File 'lib/peddler/apis/shipping_v2.rb', line 288 def get_collection_form(collection_form_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0) cannot_sandbox! path = "/shipping/v2/collectionForms/#{collection_form_id}" meter(rate_limit).get(path) end |
#get_collection_form_history(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This API Call to get the history of the previously generated collection forms.
257 258 259 260 261 262 263 |
# File 'lib/peddler/apis/shipping_v2.rb', line 257 def get_collection_form_history(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) cannot_sandbox! path = "/shipping/v2/collectionForms/history" meter(rate_limit).put(path, body:) end |
#get_rates(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This operation can make a dynamic sandbox call.
Returns the available shipping service offerings.
27 28 29 30 31 |
# File 'lib/peddler/apis/shipping_v2.rb', line 27 def get_rates(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) path = "/shipping/v2/shipments/rates" meter(rate_limit).post(path, body:) end |
#get_shipment_documents(shipment_id, package_client_reference_id, format: nil, dpi: nil, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This operation can make a dynamic sandbox call.
Returns the shipping documents associated with a package in a shipment.
123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/peddler/apis/shipping_v2.rb', line 123 def get_shipment_documents(shipment_id, package_client_reference_id, format: nil, dpi: nil, x_amzn_shipping_business_id: nil, rate_limit: 80.0) path = "/shipping/v2/shipments/#{shipment_id}/documents" params = { "packageClientReferenceId" => package_client_reference_id, "format" => format, "dpi" => dpi, }.compact meter(rate_limit).get(path, params:) end |
#get_tracking(tracking_id, carrier_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This operation can make a dynamic sandbox call.
Returns tracking information for a purchased shipment.
99 100 101 102 103 104 105 106 107 |
# File 'lib/peddler/apis/shipping_v2.rb', line 99 def get_tracking(tracking_id, carrier_id, x_amzn_shipping_business_id: nil, rate_limit: 80.0) path = "/shipping/v2/tracking" params = { "trackingId" => tracking_id, "carrierId" => carrier_id, }.compact meter(rate_limit).get(path, params:) end |
#get_unmanifested_shipments(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This API Get all unmanifested carriers with shipment locations. Any locations which has unmanifested shipments with an eligible carrier for manifesting shall be returned.
273 274 275 276 277 278 279 |
# File 'lib/peddler/apis/shipping_v2.rb', line 273 def get_unmanifested_shipments(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) cannot_sandbox! path = "/shipping/v2/unmanifestedShipments" meter(rate_limit).put(path, body:) end |
#link_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This API associates/links the specified carrier account with the merchant.
208 209 210 211 212 213 214 |
# File 'lib/peddler/apis/shipping_v2.rb', line 208 def link_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) cannot_sandbox! path = "/shipping/v2/carrierAccounts/#{carrier_id}" meter(rate_limit).put(path, body:) end |
#one_click_shipment(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This operation can make a dynamic sandbox call.
Purchases a shipping service identifier and returns purchase-related details and documents.
82 83 84 85 86 |
# File 'lib/peddler/apis/shipping_v2.rb', line 82 def one_click_shipment(body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) path = "/shipping/v2/oneClickShipment" meter(rate_limit).post(path, body:) end |
#purchase_shipment(body, x_amzn_idempotency_key: nil, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This operation can make a dynamic sandbox call.
Purchases a shipping service and returns purchase related details and documents. Note: You must complete the purchase within 10 minutes of rate creation by the shipping service provider. If you make the request after the 10 minutes have expired, you will receive an error response with the error code equal to "TOKEN_EXPIRED". If you receive this error response, you must get the rates for the shipment again.
68 69 70 71 72 |
# File 'lib/peddler/apis/shipping_v2.rb', line 68 def purchase_shipment(body, x_amzn_idempotency_key: nil, x_amzn_shipping_business_id: nil, rate_limit: 80.0) path = "/shipping/v2/shipments" meter(rate_limit).post(path, body:) end |
#unlink_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) ⇒ Peddler::Response
This API Unlink the specified carrier account with the merchant.
224 225 226 227 228 229 230 |
# File 'lib/peddler/apis/shipping_v2.rb', line 224 def unlink_carrier_account(carrier_id, body, x_amzn_shipping_business_id: nil, rate_limit: 80.0) cannot_sandbox! path = "/shipping/v2/carrierAccounts/#{carrier_id}/unlink" meter(rate_limit).put(path, body:) end |