Class: Peddler::API::ShippingV1

Inherits:
Peddler::API show all
Defined in:
lib/peddler/api/shipping_v1.rb

Overview

Selling Partner API for Shipping

Provides programmatic access to Amazon Shipping APIs. Note: If you are new to the Amazon Shipping API, refer to the latest version of Amazon Shipping API (v2) on the Amazon Shipping Developer Documentation site.

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint

Instance Method Summary collapse

Methods inherited from Peddler::API

#cannot_sandbox!, #endpoint_uri, #http, #initialize, #meter, #must_sandbox!, #retriable, #sandbox, #sandbox?, #use, #via

Constructor Details

This class inherits a constructor from Peddler::API

Instance Method Details

#cancel_shipment(shipment_id, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Cancel a shipment by the given shipmentId.

Parameters:

  • shipment_id (String)
  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



52
53
54
55
56
# File 'lib/peddler/api/shipping_v1.rb', line 52

def cancel_shipment(shipment_id, rate_limit: 5.0)
  path = "/shipping/v1/shipments/#{shipment_id}/cancel"

  meter(rate_limit).post(path)
end

#create_shipment(body, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Create a new shipment.

Parameters:

  • body (Hash)
  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



28
29
30
31
32
# File 'lib/peddler/api/shipping_v1.rb', line 28

def create_shipment(body, rate_limit: 5.0)
  path = "/shipping/v1/shipments"

  meter(rate_limit).post(path, body:)
end

#get_account(rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Verify if the current account is valid.

Parameters:

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



114
115
116
117
118
# File 'lib/peddler/api/shipping_v1.rb', line 114

def (rate_limit: 5.0)
  path = "/shipping/v1/account"

  meter(rate_limit).get(path)
end

#get_rates(body, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Get service rates.

Parameters:

  • body (Hash)
  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



103
104
105
106
107
# File 'lib/peddler/api/shipping_v1.rb', line 103

def get_rates(body, rate_limit: 5.0)
  path = "/shipping/v1/rates"

  meter(rate_limit).post(path, body:)
end

#get_shipment(shipment_id, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Return the entire shipment object for the shipmentId.

Parameters:

  • shipment_id (String)
  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



40
41
42
43
44
# File 'lib/peddler/api/shipping_v1.rb', line 40

def get_shipment(shipment_id, rate_limit: 5.0)
  path = "/shipping/v1/shipments/#{shipment_id}"

  meter(rate_limit).get(path)
end

#get_tracking_information(tracking_id, rate_limit: 1.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Return the tracking information of a shipment.

Parameters:

  • tracking_id (String)
  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

Returns:

  • (Hash)

    The API response



126
127
128
129
130
# File 'lib/peddler/api/shipping_v1.rb', line 126

def get_tracking_information(tracking_id, rate_limit: 1.0)
  path = "/shipping/v1/tracking/#{tracking_id}"

  meter(rate_limit).get(path)
end

#purchase_labels(shipment_id, body, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Purchase shipping labels based on a given rate.

Parameters:

  • shipment_id (String)
  • body (Hash)
  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



65
66
67
68
69
# File 'lib/peddler/api/shipping_v1.rb', line 65

def purchase_labels(shipment_id, body, rate_limit: 5.0)
  path = "/shipping/v1/shipments/#{shipment_id}/purchaseLabels"

  meter(rate_limit).post(path, body:)
end

#purchase_shipment(body, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Purchase shipping labels.

Parameters:

  • body (Hash)
  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



91
92
93
94
95
# File 'lib/peddler/api/shipping_v1.rb', line 91

def purchase_shipment(body, rate_limit: 5.0)
  path = "/shipping/v1/purchaseShipment"

  meter(rate_limit).post(path, body:)
end

#retrieve_shipping_label(shipment_id, tracking_id, body, rate_limit: 5.0) ⇒ Hash

Note:

This operation can make a static sandbox call.

Retrieve shipping label based on the shipment id and tracking id.

Parameters:

  • shipment_id (String)
  • tracking_id (String)
  • body (Hash)
  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:

  • (Hash)

    The API response



79
80
81
82
83
# File 'lib/peddler/api/shipping_v1.rb', line 79

def retrieve_shipping_label(shipment_id, tracking_id, body, rate_limit: 5.0)
  path = "/shipping/v1/shipments/#{shipment_id}/containers/#{tracking_id}/label"

  meter(rate_limit).post(path, body:)
end