Class: Peddler::APIs::FBAInventoryV1

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/fba_inventory_v1.rb,
lib/peddler/apis/fba_inventory_v1/error.rb,
lib/peddler/apis/fba_inventory_v1/error_list.rb,
lib/peddler/apis/fba_inventory_v1/pagination.rb,
lib/peddler/apis/fba_inventory_v1/granularity.rb,
lib/peddler/apis/fba_inventory_v1/inventory_item.rb,
lib/peddler/apis/fba_inventory_v1/inventory_items.rb,
lib/peddler/apis/fba_inventory_v1/inventory_details.rb,
lib/peddler/apis/fba_inventory_v1/inventory_summary.rb,
lib/peddler/apis/fba_inventory_v1/reserved_quantity.rb,
lib/peddler/apis/fba_inventory_v1/inventory_summaries.rb,
lib/peddler/apis/fba_inventory_v1/researching_quantity.rb,
lib/peddler/apis/fba_inventory_v1/add_inventory_request.rb,
lib/peddler/apis/fba_inventory_v1/add_inventory_response.rb,
lib/peddler/apis/fba_inventory_v1/unfulfillable_quantity.rb,
lib/peddler/apis/fba_inventory_v1/researching_quantity_entry.rb,
lib/peddler/apis/fba_inventory_v1/create_inventory_item_request.rb,
lib/peddler/apis/fba_inventory_v1/create_inventory_item_response.rb,
lib/peddler/apis/fba_inventory_v1/delete_inventory_item_response.rb,
lib/peddler/apis/fba_inventory_v1/get_inventory_summaries_result.rb,
lib/peddler/apis/fba_inventory_v1/get_inventory_summaries_response.rb

Overview

Selling Partner API for FBA Inventory

The Selling Partner API for FBA Inventory lets you programmatically retrieve information about inventory in Amazon's fulfillment network.

Defined Under Namespace

Classes: ErrorList, InventoryItems, InventorySummaries

Constant Summary collapse

Error =

An 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] Additional information that can help the caller understand or fix the issue.
  attribute?(:details, String)

  # @return [String] A message that describes the error condition in a human-readable form.
  attribute?(:message, String)
end
Pagination =

The process of returning the results to a request in batches of a defined size called pages. This is done to exercise some control over result size and overall throughput. It's a form of traffic management.

Structure.new do
  # @return [String] A generated string used to retrieve the next page of the result. If nextToken is returned,
  # pass the value of nextToken to the next request. If nextToken is not returned, there are no more items to
  # return.
  attribute?(:next_token, String, from: "nextToken")
end
Granularity =

Describes a granularity at which inventory data can be aggregated. For example, if you use Marketplace granularity, the fulfillable quantity will reflect inventory that could be fulfilled in the given marketplace.

Structure.new do
  # @return [String] The granularity ID for the specified granularity type. When granularityType is Marketplace,
  # specify the marketplaceId.
  attribute?(:granularity_id, String, from: "granularityId")

  # @return [String] The granularity type for the inventory aggregation level.
  attribute?(:granularity_type, String, from: "granularityType")
end
InventoryItem =

An item in the list of inventory to be added.

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

  # @return [Integer] The quantity of item to add.
  attribute(:quantity, Integer)

  # @return [String] The seller SKU of the item.
  attribute(:seller_sku, String, from: "sellerSku")
end
InventoryDetails =

Summarized inventory details. This object will not appear if the details parameter in the request is false.

Structure.new do
  # @return [Integer] The item quantity that can be picked, packed, and shipped.
  attribute?(:fulfillable_quantity, Integer, from: "fulfillableQuantity")

  # @return [Integer] The number of units that have not yet been received at an Amazon fulfillment center for
  # processing, but are part of an inbound shipment with some units that have already been received and processed.
  attribute?(:inbound_receiving_quantity, Integer, from: "inboundReceivingQuantity")

  # @return [Integer] The number of units in an inbound shipment that you have notified Amazon about and have
  # provided a tracking number.
  attribute?(:inbound_shipped_quantity, Integer, from: "inboundShippedQuantity")

  # @return [Integer] The number of units in an inbound shipment for which you have notified Amazon.
  attribute?(:inbound_working_quantity, Integer, from: "inboundWorkingQuantity")

  # @return [ResearchingQuantity]
  attribute?(:researching_quantity, ResearchingQuantity, from: "researchingQuantity")

  # @return [ReservedQuantity]
  attribute?(:reserved_quantity, ReservedQuantity, from: "reservedQuantity")

  # @return [UnfulfillableQuantity]
  attribute?(:unfulfillable_quantity, UnfulfillableQuantity, from: "unfulfillableQuantity")
end
InventorySummary =

Inventory summary for a specific item.

Structure.new do
  # @return [String] The Amazon Standard Identification Number (ASIN) of an item.
  attribute?(:asin, String)

  # @return [String] The condition of the item as described by the seller (for example, New Item).
  attribute?(:condition, String)

  # @return [String] Amazon's fulfillment network SKU identifier.
  attribute?(:fn_sku, String, from: "fnSku")

  # @return [InventoryDetails]
  attribute?(:inventory_details, InventoryDetails, from: "inventoryDetails")

  # @return [Time] The date and time that any quantity was last updated.
  attribute?(:last_updated_time, Time, from: "lastUpdatedTime")

  # @return [String] The localized language product title of the item within the specific marketplace.
  attribute?(:product_name, String, from: "productName")

  # @return [String] The seller SKU of the item.
  attribute?(:seller_sku, String, from: "sellerSku")

  # @return [Array<String>] A list of seller-enrolled stores that apply to this seller SKU.
  attribute?(:stores, [String])

  # @return [Integer] The total number of units in an inbound shipment or in Amazon fulfillment centers.
  attribute?(:total_quantity, Integer, from: "totalQuantity")
end
ReservedQuantity =

The quantity of reserved inventory.

Structure.new do
  # @return [Integer] The number of units that have been sidelined at the fulfillment center for additional
  # processing.
  attribute?(:fc_processing_quantity, Integer, from: "fcProcessingQuantity")

  # @return [Integer] The number of units reserved for customer orders.
  attribute?(:pending_customer_order_quantity, Integer, from: "pendingCustomerOrderQuantity")

  # @return [Integer] The number of units being transferred from one fulfillment center to another.
  attribute?(:pending_transshipment_quantity, Integer, from: "pendingTransshipmentQuantity")

  # @return [Integer] The total number of units in Amazon's fulfillment network that are currently being picked,
  # packed, and shipped; or are sidelined for measurement, sampling, or other internal processes.
  attribute?(:total_reserved_quantity, Integer, from: "totalReservedQuantity")
end
ResearchingQuantity =

The number of misplaced or warehouse damaged units that are actively being confirmed at our fulfillment centers.

Structure.new do
  # @return [Array<ResearchingQuantityEntry>] A list of quantity details for items currently being researched.
  attribute?(:researching_quantity_breakdown, [ResearchingQuantityEntry], from: "researchingQuantityBreakdown")

  # @return [Integer] The total number of units currently being researched in Amazon's fulfillment network.
  attribute?(:total_researching_quantity, Integer, from: "totalResearchingQuantity")
end
AddInventoryRequest =

The object with the list of Inventory to be added

Structure.new do
  # @return [Array<InventoryItem>]
  attribute?(:inventory_items, [InventoryItem], from: "inventoryItems")
end
AddInventoryResponse =

The response schema for the AddInventory operation.

Structure.new do
  # @return [Array<Error>] One or more unexpected errors occurred during the AddInventory operation.
  attribute?(:errors, [Error])
end
UnfulfillableQuantity =

The quantity of unfulfillable inventory.

Structure.new do
  # @return [Integer] The number of units in carrier damaged disposition.
  attribute?(:carrier_damaged_quantity, Integer, from: "carrierDamagedQuantity")

  # @return [Integer] The number of units in customer damaged disposition.
  attribute?(:customer_damaged_quantity, Integer, from: "customerDamagedQuantity")

  # @return [Integer] The number of units in defective disposition.
  attribute?(:defective_quantity, Integer, from: "defectiveQuantity")

  # @return [Integer] The number of units in distributor damaged disposition.
  attribute?(:distributor_damaged_quantity, Integer, from: "distributorDamagedQuantity")

  # @return [Integer] The number of units in expired disposition.
  attribute?(:expired_quantity, Integer, from: "expiredQuantity")

  # @return [Integer] The total number of units in Amazon's fulfillment network in unsellable condition.
  attribute?(:total_unfulfillable_quantity, Integer, from: "totalUnfulfillableQuantity")

  # @return [Integer] The number of units in warehouse damaged disposition.
  attribute?(:warehouse_damaged_quantity, Integer, from: "warehouseDamagedQuantity")
end
ResearchingQuantityEntry =

The misplaced or warehouse damaged inventory that is actively being confirmed at our fulfillment centers.

Structure.new do
  # @return [String] The duration of the research.
  attribute(:name, String)

  # @return [Integer] The number of units.
  attribute(:quantity, Integer)
end
CreateInventoryItemRequest =

An item to be created in the inventory.

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

  # @return [String] The name of the item.
  attribute(:product_name, String, from: "productName")

  # @return [String] The seller SKU of the item.
  attribute(:seller_sku, String, from: "sellerSku")
end
CreateInventoryItemResponse =

The response schema for the CreateInventoryItem operation.

Structure.new do
  # @return [Array<Error>] One or more unexpected errors occurred during the CreateInventoryItem operation.
  attribute?(:errors, [Error])
end
DeleteInventoryItemResponse =

The response schema for the DeleteInventoryItem operation.

Structure.new do
  # @return [Array<Error>] One or more unexpected errors occurred during the DeleteInventoryItem operation.
  attribute?(:errors, [Error])
end
GetInventorySummariesResult =

The payload schema for the getInventorySummaries operation.

Structure.new do
  # @return [Granularity]
  attribute(:granularity, Granularity)

  # @return [Array<InventorySummary>]
  attribute(:inventory_summaries, [InventorySummary], from: "inventorySummaries")
end
GetInventorySummariesResponse =

The Response schema.

Structure.new do
  # @return [Array<Error>] One or more unexpected errors occurred during the getInventorySummaries operation.
  attribute?(:errors, [Error])

  # @return [Pagination]
  attribute?(:pagination, Pagination)

  # @return [GetInventorySummariesResult] The payload for the getInventorySummaries operation.
  attribute?(:payload, GetInventorySummariesResult)
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

#add_inventory(x_amzn_idempotency_token, add_inventory_request_body) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Requests that Amazon add items to the Sandbox Inventory with desired amount of quantity in the sandbox environment. This is a sandbox-only operation and must be directed to a sandbox endpoint. Refer to Selling Partner API sandbox for more information.

Parameters:

  • x_amzn_idempotency_token (String)

    A unique token/requestId provided with each call to ensure idempotency.

  • add_inventory_request_body (Hash)

    List of items to add to Sandbox inventory.

Returns:



111
112
113
114
115
116
117
118
# File 'lib/peddler/apis/fba_inventory_v1.rb', line 111

def add_inventory(x_amzn_idempotency_token, add_inventory_request_body)
  must_sandbox!

  path = "/fba/inventory/v1/items/inventory"
  body = add_inventory_request_body
  parser = -> { AddInventoryResponse }
  post(path, body:, parser:)
end

#create_inventory_item(create_inventory_item_request_body) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Requests that Amazon create product-details in the Sandbox Inventory in the sandbox environment. This is a sandbox-only operation and must be directed to a sandbox endpoint. Refer to Selling Partner API sandbox for more information.

Parameters:

  • create_inventory_item_request_body (Hash)

    CreateInventoryItem Request Body Parameter.

Returns:



74
75
76
77
78
79
80
81
# File 'lib/peddler/apis/fba_inventory_v1.rb', line 74

def create_inventory_item(create_inventory_item_request_body)
  must_sandbox!

  path = "/fba/inventory/v1/items"
  body = create_inventory_item_request_body
  parser = -> { CreateInventoryItemResponse }
  post(path, body:, parser:)
end

#delete_inventory_item(seller_sku, marketplace_id) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Requests that Amazon Deletes an item from the Sandbox Inventory in the sandbox environment. This is a sandbox-only operation and must be directed to a sandbox endpoint. Refer to Selling Partner API sandbox for more information.

Parameters:

  • seller_sku (String)

    A single seller SKU used for querying the specified seller SKU inventory summaries.

  • marketplace_id (String)

    The marketplace ID for the marketplace for which the sellerSku is to be deleted.

Returns:



91
92
93
94
95
96
97
98
99
100
# File 'lib/peddler/apis/fba_inventory_v1.rb', line 91

def delete_inventory_item(seller_sku, marketplace_id)
  must_sandbox!

  path = "/fba/inventory/v1/items/#{percent_encode(seller_sku)}"
  params = {
    "marketplaceId" => marketplace_id,
  }.compact
  parser = -> { DeleteInventoryItemResponse }
  delete(path, params:, parser:)
end

#get_inventory_summaries(granularity_type, granularity_id, marketplace_ids, details: nil, start_date_time: nil, seller_skus: nil, seller_sku: nil, next_token: nil, rate_limit: 2.0) ⇒ Peddler::Response

Note:

This operation can make a dynamic sandbox call.

Returns a list of inventory summaries. The summaries returned depend on the presence or absence of the startDateTime, sellerSkus and sellerSku parameters:

  • All inventory summaries with available details are returned when the startDateTime, sellerSkus and sellerSku parameters are omitted.
  • When startDateTime is provided, the operation returns inventory summaries that have had changes after the date and time specified. The sellerSkus and sellerSku parameters are ignored. Important: To avoid errors, use both startDateTime and nextToken to get the next page of inventory summaries that have changed after the date and time specified.
  • When the sellerSkus parameter is provided, the operation returns inventory summaries for only the specified sellerSkus. The sellerSku parameter is ignored.
  • When the sellerSku parameter is provided, the operation returns inventory summaries for only the specified sellerSku.

Note: The parameters associated with this operation may contain special characters that must be encoded to successfully call the API. To avoid errors with SKUs when encoding URLs, refer to URL Encoding.

quantities. Otherwise, returns inventory summaries only (default value). that have changed since then are returned. You must specify a date and time that is no earlier than 18 months prior to the date and time when you call the API. Note: Changes in inboundWorkingQuantity, inboundShippedQuantity and inboundReceivingQuantity are not detected. specify up to 50 SKUs. expire 30 seconds after being created. summaries.

Parameters:

  • details (Boolean) (defaults to: nil)

    true to return inventory summaries with additional summarized inventory details and

  • granularity_type (String)

    The granularity type for the inventory aggregation level.

  • granularity_id (String)

    The granularity ID for the inventory aggregation level.

  • start_date_time (String) (defaults to: nil)

    A start date and time in ISO8601 format. If specified, all inventory summaries

  • seller_skus (Array<String>) (defaults to: nil)

    A list of seller SKUs for which to return inventory summaries. You may

  • seller_sku (String) (defaults to: nil)

    A single seller SKU used for querying the specified seller SKU inventory summaries.

  • next_token (String) (defaults to: nil)

    String token returned in the response of your previous request. The string token will

  • marketplace_ids (Array<String>)

    The marketplace ID for the marketplace for which to return inventory

  • rate_limit (Float) (defaults to: 2.0)

    Requests per second

Returns:



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/peddler/apis/fba_inventory_v1.rb', line 50

def get_inventory_summaries(granularity_type, granularity_id, marketplace_ids, details: nil, start_date_time: nil,
  seller_skus: nil, seller_sku: nil, next_token: nil, rate_limit: 2.0)
  path = "/fba/inventory/v1/summaries"
  params = {
    "details" => details,
    "granularityType" => granularity_type,
    "granularityId" => granularity_id,
    "startDateTime" => start_date_time,
    "sellerSkus" => stringify_array(seller_skus),
    "sellerSku" => seller_sku,
    "nextToken" => next_token,
    "marketplaceIds" => stringify_array(marketplace_ids),
  }.compact
  parser = -> { GetInventorySummariesResponse }
  meter(rate_limit).get(path, params:, parser:)
end