Class: Peddler::APIs::ShippingV1

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/shipping_v1.rb,
lib/peddler/apis/shipping_v1/rate.rb,
lib/peddler/apis/shipping_v1/error.rb,
lib/peddler/apis/shipping_v1/event.rb,
lib/peddler/apis/shipping_v1/label.rb,
lib/peddler/apis/shipping_v1/party.rb,
lib/peddler/apis/shipping_v1/weight.rb,
lib/peddler/apis/shipping_v1/account.rb,
lib/peddler/apis/shipping_v1/address.rb,
lib/peddler/apis/shipping_v1/location.rb,
lib/peddler/apis/shipping_v1/shipment.rb,
lib/peddler/apis/shipping_v1/container.rb,
lib/peddler/apis/shipping_v1/rate_list.rb,
lib/peddler/apis/shipping_v1/dimensions.rb,
lib/peddler/apis/shipping_v1/error_list.rb,
lib/peddler/apis/shipping_v1/event_list.rb,
lib/peddler/apis/shipping_v1/time_range.rb,
lib/peddler/apis/shipping_v1/label_result.rb,
lib/peddler/apis/shipping_v1/service_rate.rb,
lib/peddler/apis/shipping_v1/accepted_rate.rb,
lib/peddler/apis/shipping_v1/container_item.rb,
lib/peddler/apis/shipping_v1/container_list.rb,
lib/peddler/apis/shipping_v1/get_rates_result.rb,
lib/peddler/apis/shipping_v1/tracking_summary.rb,
lib/peddler/apis/shipping_v1/get_rates_request.rb,
lib/peddler/apis/shipping_v1/label_result_list.rb,
lib/peddler/apis/shipping_v1/service_rate_list.rb,
lib/peddler/apis/shipping_v1/service_type_list.rb,
lib/peddler/apis/shipping_v1/get_rates_response.rb,
lib/peddler/apis/shipping_v1/label_specification.rb,
lib/peddler/apis/shipping_v1/get_account_response.rb,
lib/peddler/apis/shipping_v1/shipping_promise_set.rb,
lib/peddler/apis/shipping_v1/tracking_information.rb,
lib/peddler/apis/shipping_v1/get_shipment_response.rb,
lib/peddler/apis/shipping_v1/create_shipment_result.rb,
lib/peddler/apis/shipping_v1/purchase_labels_result.rb,
lib/peddler/apis/shipping_v1/container_specification.rb,
lib/peddler/apis/shipping_v1/create_shipment_request.rb,
lib/peddler/apis/shipping_v1/purchase_labels_request.rb,
lib/peddler/apis/shipping_v1/cancel_shipment_response.rb,
lib/peddler/apis/shipping_v1/create_shipment_response.rb,
lib/peddler/apis/shipping_v1/purchase_labels_response.rb,
lib/peddler/apis/shipping_v1/purchase_shipment_result.rb,
lib/peddler/apis/shipping_v1/purchase_shipment_request.rb,
lib/peddler/apis/shipping_v1/purchase_shipment_response.rb,
lib/peddler/apis/shipping_v1/container_specification_list.rb,
lib/peddler/apis/shipping_v1/retrieve_shipping_label_result.rb,
lib/peddler/apis/shipping_v1/retrieve_shipping_label_request.rb,
lib/peddler/apis/shipping_v1/retrieve_shipping_label_response.rb,
lib/peddler/apis/shipping_v1/get_tracking_information_response.rb,
sig/peddler/apis/shipping_v1.rbs

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.

Defined Under Namespace

Classes: AcceptedRate, Account, Address, CancelShipmentResponse, Container, ContainerItem, ContainerList, ContainerSpecification, ContainerSpecificationList, CreateShipmentRequest, CreateShipmentResponse, CreateShipmentResult, Dimensions, Error, ErrorList, Event, EventList, GetAccountResponse, GetRatesRequest, GetRatesResponse, GetRatesResult, GetShipmentResponse, GetTrackingInformationResponse, Label, LabelResult, LabelResultList, LabelSpecification, Location, Party, PurchaseLabelsRequest, PurchaseLabelsResponse, PurchaseLabelsResult, PurchaseShipmentRequest, PurchaseShipmentResponse, PurchaseShipmentResult, Rate, RateList, RetrieveShippingLabelRequest, RetrieveShippingLabelResponse, RetrieveShippingLabelResult, ServiceRate, ServiceRateList, ServiceTypeList, Shipment, ShippingPromiseSet, TimeRange, TrackingInformation, TrackingSummary, Weight

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint, #retries

Instance Method Summary collapse

Methods inherited from Peddler::API

#cannot_sandbox!, #delete, #endpoint_uri, #get, #http, #initialize, #must_sandbox!, #patch, #percent_encode, #post, #put, #request, #sandbox, #sandbox?, #stringify_array, #timestamp, #user_agent

Constructor Details

This class inherits a constructor from Peddler::API

Instance Method Details

#cancel_shipment(shipment_id, rate_limit: 5.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Cancel a shipment by the given shipmentId.

Parameters:

  • shipment_id (String)

    Shipment Id to cancel a shipment

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

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

Returns:



47
48
49
50
51
# File 'lib/peddler/apis/shipping_v1.rb', line 47

def cancel_shipment(shipment_id, rate_limit: 5.0)
  path = "/shipping/v1/shipments/#{percent_encode(shipment_id)}/cancel"
  parser = -> { CancelShipmentResponse }
  post(path, rate_limit:, parser:)
end

#create_shipment(body, rate_limit: 5.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Create a new shipment.

Parameters:

  • body (Hash)

    CreateShipmentRequest Body

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

  • (Hash[untyped, untyped])
  • rate_limit: (Float) (defaults to: 5.0)

Returns:



23
24
25
26
27
# File 'lib/peddler/apis/shipping_v1.rb', line 23

def create_shipment(body, rate_limit: 5.0)
  path = "/shipping/v1/shipments"
  parser = -> { CreateShipmentResponse }
  post(path, body:, rate_limit:, parser:)
end

#get_account(rate_limit: 5.0) ⇒ Peddler::Response

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

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

Returns:



109
110
111
112
113
# File 'lib/peddler/apis/shipping_v1.rb', line 109

def (rate_limit: 5.0)
  path = "/shipping/v1/account"
  parser = -> { GetAccountResponse }
  get(path, rate_limit:, parser:)
end

#get_rates(body, rate_limit: 5.0) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Get service rates.

Parameters:

  • body (Hash)

    GetRatesRequest body

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

  • (Hash[untyped, untyped])
  • rate_limit: (Float) (defaults to: 5.0)

Returns:



98
99
100
101
102
# File 'lib/peddler/apis/shipping_v1.rb', line 98

def get_rates(body, rate_limit: 5.0)
  path = "/shipping/v1/rates"
  parser = -> { GetRatesResponse }
  post(path, body:, rate_limit:, parser:)
end

#get_shipment(shipment_id, rate_limit: 5.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Return the entire shipment object for the shipmentId.

Parameters:

  • shipment_id (String)

    Shipment id to return the entire shipment object

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

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

Returns:



35
36
37
38
39
# File 'lib/peddler/apis/shipping_v1.rb', line 35

def get_shipment(shipment_id, rate_limit: 5.0)
  path = "/shipping/v1/shipments/#{percent_encode(shipment_id)}"
  parser = -> { GetShipmentResponse }
  get(path, rate_limit:, parser:)
end

#get_tracking_information(tracking_id, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Return the tracking information of a shipment.

Parameters:

  • tracking_id (String)

    Tracking Id

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

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

Returns:



121
122
123
124
125
# File 'lib/peddler/apis/shipping_v1.rb', line 121

def get_tracking_information(tracking_id, rate_limit: 1.0)
  path = "/shipping/v1/tracking/#{percent_encode(tracking_id)}"
  parser = -> { GetTrackingInformationResponse }
  get(path, rate_limit:, parser:)
end

#purchase_labels(shipment_id, body, rate_limit: 5.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Purchase shipping labels based on a given rate.

Parameters:

  • shipment_id (String)

    Shipment id for purchase shipping label

  • body (Hash)

    PurchaseShippingLabelRequest body

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

  • (String)
  • (Hash[untyped, untyped])
  • rate_limit: (Float) (defaults to: 5.0)

Returns:



60
61
62
63
64
# File 'lib/peddler/apis/shipping_v1.rb', line 60

def purchase_labels(shipment_id, body, rate_limit: 5.0)
  path = "/shipping/v1/shipments/#{percent_encode(shipment_id)}/purchaseLabels"
  parser = -> { PurchaseLabelsResponse }
  post(path, body:, rate_limit:, parser:)
end

#purchase_shipment(body, rate_limit: 5.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Purchase shipping labels.

Parameters:

  • body (Hash)

    PurchaseShipmentRequest body

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

  • (Hash[untyped, untyped])
  • rate_limit: (Float) (defaults to: 5.0)

Returns:



86
87
88
89
90
# File 'lib/peddler/apis/shipping_v1.rb', line 86

def purchase_shipment(body, rate_limit: 5.0)
  path = "/shipping/v1/purchaseShipment"
  parser = -> { PurchaseShipmentResponse }
  post(path, body:, rate_limit:, parser:)
end

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

Note:

This operation can make a static sandbox call.

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

Parameters:

  • shipment_id (String)

    Shipment Id to retreive label

  • tracking_id (String)

    Tracking Id

  • body (Hash)

    RetrieveShippingLabelRequest body

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

  • (String)
  • (String)
  • (Hash[untyped, untyped])
  • rate_limit: (Float) (defaults to: 5.0)

Returns:



74
75
76
77
78
# File 'lib/peddler/apis/shipping_v1.rb', line 74

def retrieve_shipping_label(shipment_id, tracking_id, body, rate_limit: 5.0)
  path = "/shipping/v1/shipments/#{percent_encode(shipment_id)}/containers/#{percent_encode(tracking_id)}/label"
  parser = -> { RetrieveShippingLabelResponse }
  post(path, body:, rate_limit:, parser:)
end