Class: Peddler::APIs::EasyShip20220323

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/easy_ship_2022_03_23.rb,
lib/peddler/apis/easy_ship_2022_03_23/item.rb,
lib/peddler/apis/easy_ship_2022_03_23/error.rb,
lib/peddler/apis/easy_ship_2022_03_23/items.rb,
lib/peddler/apis/easy_ship_2022_03_23/weight.rb,
lib/peddler/apis/easy_ship_2022_03_23/package.rb,
lib/peddler/apis/easy_ship_2022_03_23/packages.rb,
lib/peddler/apis/easy_ship_2022_03_23/time_slot.rb,
lib/peddler/apis/easy_ship_2022_03_23/dimensions.rb,
lib/peddler/apis/easy_ship_2022_03_23/error_list.rb,
lib/peddler/apis/easy_ship_2022_03_23/time_slots.rb,
lib/peddler/apis/easy_ship_2022_03_23/invoice_data.rb,
lib/peddler/apis/easy_ship_2022_03_23/rejected_order.rb,
lib/peddler/apis/easy_ship_2022_03_23/package_details.rb,
lib/peddler/apis/easy_ship_2022_03_23/tracking_details.rb,
lib/peddler/apis/easy_ship_2022_03_23/scheduled_package_id.rb,
lib/peddler/apis/easy_ship_2022_03_23/order_schedule_details.rb,
lib/peddler/apis/easy_ship_2022_03_23/update_package_details.rb,
lib/peddler/apis/easy_ship_2022_03_23/order_item_serial_numbers.rb,
lib/peddler/apis/easy_ship_2022_03_23/list_handover_slots_request.rb,
lib/peddler/apis/easy_ship_2022_03_23/update_package_details_list.rb,
lib/peddler/apis/easy_ship_2022_03_23/list_handover_slots_response.rb,
lib/peddler/apis/easy_ship_2022_03_23/create_scheduled_package_request.rb,
lib/peddler/apis/easy_ship_2022_03_23/create_scheduled_packages_request.rb,
lib/peddler/apis/easy_ship_2022_03_23/update_scheduled_packages_request.rb,
lib/peddler/apis/easy_ship_2022_03_23/create_scheduled_packages_response.rb

Overview

Selling Partner API for Easy Ship

Use the Selling Partner API for Easy Ship to build applications for sellers to manage and ship Amazon Easy Ship orders. With this API, you can get available time slots, schedule and reschedule Easy Ship orders, and print shipping labels, invoices, and warranties. To review the differences in Easy Ship operations by marketplace, refer to Marketplace support.

Defined Under Namespace

Classes: Items, OrderItemSerialNumbers, TimeSlots, UpdatePackageDetailsList

Constant Summary collapse

Item =

Item identifier and serial number information.

Structure.new do
  # @return [String]
  attribute?(:order_item_id, String, from: "orderItemId")

  # @return [Array<OrderItemSerialNumber>]
  attribute?(:order_item_serial_numbers, Array, from: "orderItemSerialNumbers")
end
Error =

Error response returned when the request is unsuccessful.

Structure.new do
  # @return [String] An error code that identifies the type of error that occurred.
  attribute(:code, String)

  # @return [String] A message that describes the error condition.
  attribute(:message, String)

  # @return [String] Additional details that can help the caller understand or fix the issue.
  attribute?(:details, String)
end
Weight =

The weight of the scheduled package

Structure.new do
  # @return [String]
  attribute?(:unit, String)

  # @return [Float]
  attribute?(:value, Float)
end
Package =

This object contains all the details of the scheduled Easy Ship package.

Structure.new do
  # @return [Dimensions]
  attribute(:package_dimensions, Dimensions, from: "packageDimensions")

  # @return [TimeSlot]
  attribute(:package_time_slot, TimeSlot, from: "packageTimeSlot")

  # @return [Weight]
  attribute(:package_weight, Weight, from: "packageWeight")

  # @return [ScheduledPackageId]
  attribute(:scheduled_package_id, ScheduledPackageId, from: "scheduledPackageId")

  # @return [InvoiceData]
  attribute?(:invoice, InvoiceData)

  # @return [String]
  attribute?(:package_identifier, String, from: "packageIdentifier")

  # @return [Array<Item>]
  attribute?(:package_items, [Item], from: "packageItems")

  # @return [String]
  attribute?(:package_status, String, from: "packageStatus")

  # @return [TrackingDetails]
  attribute?(:tracking_details, TrackingDetails, from: "trackingDetails")
end
Packages =

A list of packages.

Structure.new do
  # @return [Array<Package>] A list of packages.
  attribute(:packages, [Package])
end
TimeSlot =

A time window to hand over an Easy Ship package to Amazon Logistics.

Structure.new do
  # @return [String] An Amazon-defined identifier for a time slot.
  attribute(:slot_id, String, from: "slotId")

  # @return [String] The end date and time of the time slot.
  attribute?(:end_time, String, from: "endTime")

  # @return [String] The method by which a seller will hand a package over to Amazon Logistics.
  attribute?(:handover_method, String, from: "handoverMethod")

  # @return [String] The start date and time of the time slot.
  attribute?(:start_time, String, from: "startTime")
end
Dimensions =

The dimensions of the scheduled package.

Structure.new do
  # @return [Float] The height dimension.
  attribute?(:height, Float)

  # @return [String] Identifier for custom package dimensions.
  attribute?(:identifier, String)

  # @return [Float] The length dimension.
  attribute?(:length, Float)

  # @return [String]
  attribute?(:unit, String)

  # @return [Float] The width dimension.
  attribute?(:width, Float)
end
ErrorList =

A list of error responses returned when a request is unsuccessful.

Structure.new do
  # @return [Array<Error>] A list of error responses returned when a request is unsuccessful.
  attribute(:errors, [Error])
end
InvoiceData =

Invoice number and date.

Structure.new do
  # @return [String] The invoice number.
  attribute(:invoice_number, String, from: "invoiceNumber")

  # @return [String] The date that the invoice was generated.
  attribute?(:invoice_date, String, from: "invoiceDate")
end
RejectedOrder =

A order which we couldn't schedule on your behalf. It contains its id, and information on the error.

Structure.new do
  # @return [String]
  attribute(:amazon_order_id, String, from: "amazonOrderId")

  # @return [Error]
  attribute?(:error, Error)
end
PackageDetails =

Package details. Includes packageItems, packageTimeSlot, and packageIdentifier.

Structure.new do
  # @return [TimeSlot]
  attribute(:package_time_slot, TimeSlot, from: "packageTimeSlot")

  # @return [String]
  attribute?(:package_identifier, String, from: "packageIdentifier")

  # @return [Array<Item>]
  attribute?(:package_items, [Item], from: "packageItems")
end
TrackingDetails =

Representation of tracking metadata.

Structure.new do
  # @return [String] The tracking identifier for the scheduled package.
  attribute?(:tracking_id, String, from: "trackingId")
end
ScheduledPackageId =

Identifies the scheduled package to be updated.

Structure.new do
  # @return [String]
  attribute(:amazon_order_id, String, from: "amazonOrderId")

  # @return [String]
  attribute?(:package_id, String, from: "packageId")
end
OrderScheduleDetails =

This object allows users to specify an order to be scheduled. Only the amazonOrderId is required.

Structure.new do
  # @return [String]
  attribute(:amazon_order_id, String, from: "amazonOrderId")

  # @return [PackageDetails]
  attribute?(:package_details, PackageDetails, from: "packageDetails")
end
UpdatePackageDetails =

Request to update the time slot of a package.

Structure.new do
  # @return [TimeSlot]
  attribute(:package_time_slot, TimeSlot, from: "packageTimeSlot")

  # @return [ScheduledPackageId]
  attribute(:scheduled_package_id, ScheduledPackageId, from: "scheduledPackageId")
end
ListHandoverSlotsRequest =

The request schema for the listHandoverSlots operation.

Structure.new do
  # @return [String]
  attribute(:amazon_order_id, String, from: "amazonOrderId")

  # @return [String]
  attribute(:marketplace_id, String, from: "marketplaceId")

  # @return [Dimensions]
  attribute(:package_dimensions, Dimensions, from: "packageDimensions")

  # @return [Weight]
  attribute(:package_weight, Weight, from: "packageWeight")
end
ListHandoverSlotsResponse =

The response schema for the listHandoverSlots operation.

Structure.new do
  # @return [String]
  attribute(:amazon_order_id, String, from: "amazonOrderId")

  # @return [Array<TimeSlot>]
  attribute(:time_slots, [TimeSlot], from: "timeSlots")
end
CreateScheduledPackageRequest =

The request schema for the createScheduledPackage operation.

Structure.new do
  # @return [String]
  attribute(:amazon_order_id, String, from: "amazonOrderId")

  # @return [String]
  attribute(:marketplace_id, String, from: "marketplaceId")

  # @return [PackageDetails]
  attribute(:package_details, PackageDetails, from: "packageDetails")
end
CreateScheduledPackagesRequest =

The request body for the POST /easyShip/2022-03-23/packages/bulk API.

Structure.new do
  # @return [String]
  attribute(:label_format, String, from: "labelFormat")

  # @return [String]
  attribute(:marketplace_id, String, from: "marketplaceId")

  # @return [Array<OrderScheduleDetails>] An array allowing users to specify orders to be scheduled.
  attribute(:order_schedule_details_list, [OrderScheduleDetails], from: "orderScheduleDetailsList")
end
UpdateScheduledPackagesRequest =

The request schema for the updateScheduledPackages operation.

Structure.new do
  # @return [String]
  attribute(:marketplace_id, String, from: "marketplaceId")

  # @return [Array<UpdatePackageDetails>]
  attribute(:update_package_details_list, [UpdatePackageDetails], from: "updatePackageDetailsList")
end
CreateScheduledPackagesResponse =

The response schema for the bulk scheduling API. It returns by the bulk scheduling API containing an array of the scheduled packtages, an optional list of orders we couldn't schedule with the reason, and a pre-signed URL for a ZIP file containing the associated shipping labels plus the documents enabled for your marketplace.

Structure.new do
  # @return [String]
  attribute?(:printable_documents_url, String, from: "printableDocumentsUrl")

  # @return [Array<RejectedOrder>] A list of orders we couldn't scheduled on your behalf. Each element contains
  # the reason and details on the error.
  attribute?(:rejected_orders, [RejectedOrder], from: "rejectedOrders")

  # @return [Array<Package>] A list of packages. Refer to the `Package` object.
  attribute?(:scheduled_packages, [Package], from: "scheduledPackages")
end

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint, #retries

Instance Method Summary collapse

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

#create_scheduled_package(create_scheduled_package_request, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Schedules an Easy Ship order and returns the scheduled package information.

This operation does the following:

  • Specifies the time slot and handover method for the order to be scheduled for delivery.

  • Updates the Easy Ship order status.

  • Generates a shipping label and an invoice. Calling createScheduledPackage also generates a warranty document if you specify a SerialNumber value. To get these documents, see href="https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide">https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide How to get invoice, shipping label, and warranty documents.

  • Shows the status of Easy Ship orders when you call the getOrders operation of the Selling Partner API for Orders and examine the EasyShipShipmentStatus property in the response body.

See the Shipping Label, Invoice, and Warranty columns in the Marketplace Support Table to see which documents are supported in each marketplace.

Parameters:

  • create_scheduled_package_request (Hash)

    The request schema for the createScheduledPackage operation.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

Returns:



84
85
86
87
88
89
# File 'lib/peddler/apis/easy_ship_2022_03_23.rb', line 84

def create_scheduled_package(create_scheduled_package_request, rate_limit: 1.0)
  path = "/easyShip/2022-03-23/package"
  body = create_scheduled_package_request
  parser = -> { Package }
  meter(rate_limit).post(path, body:, parser:)
end

#create_scheduled_package_bulk(create_scheduled_packages_request, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

This operation automatically schedules a time slot for all the amazonOrderIds given as input, generating the associated shipping labels, along with other compliance documents according to the marketplace (refer to the marketplace document support table).

Developers calling this operation may optionally assign a packageDetails object, allowing them to input a preferred time slot for each order in ther request. In this case, Amazon will try to schedule the respective packages using their optional settings. On the other hand, i.e., if the time slot is not provided, Amazon will then pick the earliest time slot possible.

Regarding the shipping label's file format, external developers are able to choose between PDF or ZPL, and Amazon will create the label accordingly.

This operation returns an array composed of the scheduled packages, and a short-lived URL pointing to a zip file containing the generated shipping labels and the other documents enabled for your marketplace. If at least an order couldn't be scheduled, then Amazon adds the rejectedOrders list into the response, which contains an entry for each order we couldn't process. Each entry is composed of an error message describing the reason of the failure, so that sellers can take action.

The table below displays the supported request and burst maximum rates:

operation.

Parameters:

  • create_scheduled_packages_request (Hash)

    The request schema for the createScheduledPackageBulk

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

Returns:



136
137
138
139
140
141
# File 'lib/peddler/apis/easy_ship_2022_03_23.rb', line 136

def create_scheduled_package_bulk(create_scheduled_packages_request, rate_limit: 1.0)
  path = "/easyShip/2022-03-23/packages/bulk"
  body = create_scheduled_packages_request
  parser = -> { CreateScheduledPackagesResponse }
  meter(rate_limit).post(path, body:, parser:)
end

#get_scheduled_package(amazon_order_id, marketplace_id, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns information about a package, including dimensions, weight, time slot information for handover, invoice and item information, and status.

to deliver using Amazon Easy Ship.

Parameters:

  • amazon_order_id (String)

    An Amazon-defined order identifier. Identifies the order that the seller wants

  • marketplace_id (String)

    An identifier for the marketplace in which the seller is selling.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

Returns:



50
51
52
53
54
55
56
57
58
# File 'lib/peddler/apis/easy_ship_2022_03_23.rb', line 50

def get_scheduled_package(amazon_order_id, marketplace_id, rate_limit: 1.0)
  path = "/easyShip/2022-03-23/package"
  params = {
    "amazonOrderId" => amazon_order_id,
    "marketplaceId" => marketplace_id,
  }.compact
  parser = -> { Package }
  meter(rate_limit).get(path, params:, parser:)
end

#list_handover_slots(list_handover_slots_request: nil, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns time slots available for Easy Ship orders to be scheduled based on the package weight and dimensions that the seller specifies.

This operation is available for scheduled and unscheduled orders based on marketplace support. See Get Time Slots in the Marketplace Support Table.

This operation can return time slots that have either pickup or drop-off handover methods - see Supported Handover Methods in the Marketplace Support Table.

Parameters:

  • list_handover_slots_request (Hash) (defaults to: nil)

    The request schema for the listHandoverSlots operation.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

Returns:



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

def list_handover_slots(list_handover_slots_request: nil, rate_limit: 1.0)
  path = "/easyShip/2022-03-23/timeSlot"
  body = list_handover_slots_request
  parser = -> { ListHandoverSlotsResponse }
  meter(rate_limit).post(path, body:, parser:)
end

#update_scheduled_packages(update_scheduled_packages_request: nil, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Updates the time slot for handing over the package indicated by the specified scheduledPackageId. You can get the new slotId value for the time slot by calling the listHandoverSlots operation before making another patch call.

See the Update Package column in the Marketplace Support Table to see which marketplaces this operation is supported in.

Parameters:

  • update_scheduled_packages_request (Hash) (defaults to: nil)

    The request schema for the updateScheduledPackages operation.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

Returns:



103
104
105
106
107
108
# File 'lib/peddler/apis/easy_ship_2022_03_23.rb', line 103

def update_scheduled_packages(update_scheduled_packages_request: nil, rate_limit: 1.0)
  path = "/easyShip/2022-03-23/package"
  body = update_scheduled_packages_request
  parser = -> { Packages }
  meter(rate_limit).patch(path, body:, parser:)
end