Class: Peddler::APIs::VendorDirectFulfillmentInventoryV1

Inherits:
Peddler::API
  • Object
show all
Defined in:
lib/peddler/apis/vendor_direct_fulfillment_inventory_v1.rb,
lib/peddler/apis/vendor_direct_fulfillment_inventory_v1/error.rb,
lib/peddler/apis/vendor_direct_fulfillment_inventory_v1/error_list.rb,
lib/peddler/apis/vendor_direct_fulfillment_inventory_v1/item_details.rb,
lib/peddler/apis/vendor_direct_fulfillment_inventory_v1/item_quantity.rb,
lib/peddler/apis/vendor_direct_fulfillment_inventory_v1/inventory_update.rb,
lib/peddler/apis/vendor_direct_fulfillment_inventory_v1/party_identification.rb,
lib/peddler/apis/vendor_direct_fulfillment_inventory_v1/transaction_reference.rb,
lib/peddler/apis/vendor_direct_fulfillment_inventory_v1/submit_inventory_update_request.rb,
lib/peddler/apis/vendor_direct_fulfillment_inventory_v1/submit_inventory_update_response.rb

Overview

Selling Partner API for Direct Fulfillment Inventory Updates

The Selling Partner API for Direct Fulfillment Inventory Updates provides programmatic access to a direct fulfillment vendor's inventory updates.

Defined Under Namespace

Classes: ErrorList

Constant Summary collapse

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
ItemDetails =

Updated inventory details for an item.

Structure.new do
  # @return [ItemQuantity] Total item quantity available in the warehouse.
  attribute(:available_quantity, ItemQuantity, from: "availableQuantity")

  # @return [String] The buyer selected product identification of the item. Either buyerProductIdentifier or
  # vendorProductIdentifier should be submitted.
  attribute?(:buyer_product_identifier, String, from: "buyerProductIdentifier")

  # @return [:boolean] When true, the item is permanently unavailable.
  attribute?(:obsolete, :boolean, from: "isObsolete")

  # @return [String] The vendor selected product identification of the item. Either buyerProductIdentifier or
  # vendorProductIdentifier should be submitted.
  attribute?(:vendor_product_identifier, String, from: "vendorProductIdentifier")
end
ItemQuantity =

Details of item quantity.

Structure.new do
  # @return [String] Unit of measure for the available quantity.
  attribute(:unit_of_measure, String, from: "unitOfMeasure")

  # @return [Integer] Quantity of units available for a specific item.
  attribute?(:amount, Integer)
end
InventoryUpdate =

Inventory details required to update some or all items for the requested warehouse.

Structure.new do
  # @return [:boolean] When true, this request contains a full feed. Otherwise, this request contains a partial
  # feed. When sending a full feed, you must send information about all items in the warehouse. Any items not in
  # the full feed are updated as not available. When sending a partial feed, only include the items that need an
  # update to inventory. The status of other items will remain unchanged.
  attribute(:full_update, :boolean, from: "isFullUpdate")

  # @return [Array<ItemDetails>] A list of inventory items with updated details, including quantity available.
  attribute(:items, [ItemDetails])

  # @return [PartyIdentification] ID of the selling party or vendor.
  attribute(:selling_party, PartyIdentification, from: "sellingParty")
end
PartyIdentification =

Name, address and tax details of a party.

Structure.new do
  # @return [String] Assigned identification for the party.
  attribute(:party_id, String, from: "partyId")
end
TransactionReference =

Response containing the transaction ID.

Structure.new do
  # @return [String] GUID to identify this transaction. This value can be used with the Transaction Status API to
  # return the status of this transaction.
  attribute?(:transaction_id, String, from: "transactionId")
end
SubmitInventoryUpdateRequest =

The request body for the submitInventoryUpdate operation.

Structure.new do
  # @return [InventoryUpdate] Inventory details required to update some or all items for the requested warehouse.
  attribute?(:inventory, InventoryUpdate)
end
SubmitInventoryUpdateResponse =

The response schema for the submitInventoryUpdate operation.

Structure.new do
  # @return [Array<Error>]
  attribute?(:errors, [Error])

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

#submit_inventory_update(body, warehouse_id, rate_limit: 10.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Submits inventory updates for the specified warehouse for either a partial or full feed of inventory items.

Parameters:

  • body (Hash)

    The request body containing the inventory update data to submit.

  • warehouse_id (String)

    Identifier for the warehouse for which to update inventory.

  • rate_limit (Float) (defaults to: 10.0)

    Requests per second

Returns:



21
22
23
24
25
# File 'lib/peddler/apis/vendor_direct_fulfillment_inventory_v1.rb', line 21

def submit_inventory_update(body, warehouse_id, rate_limit: 10.0)
  path = "/vendor/directFulfillment/inventory/v1/warehouses/#{percent_encode(warehouse_id)}/items"
  parser = -> { SubmitInventoryUpdateResponse }
  meter(rate_limit).post(path, body:, parser:)
end