Class: Peddler::APIs::FBAInventoryV1

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/fba_inventory_v1.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.

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?, #typed, #typed?, #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](developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more information.



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

def add_inventory(x_amzn_idempotency_token, add_inventory_request_body)
  path = "/fba/inventory/v1/items/inventory"
  body = add_inventory_request_body
  parser = Peddler::Types::FBAInventoryV1::AddInventoryResponse if typed?
  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](developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more information.



80
81
82
83
84
85
# File 'lib/peddler/apis/fba_inventory_v1.rb', line 80

def create_inventory_item(create_inventory_item_request_body)
  path = "/fba/inventory/v1/items"
  body = create_inventory_item_request_body
  parser = Peddler::Types::FBAInventoryV1::CreateInventoryItemResponse if typed?
  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](developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more information.



95
96
97
98
99
100
101
102
# File 'lib/peddler/apis/fba_inventory_v1.rb', line 95

def delete_inventory_item(seller_sku, marketplace_id)
  path = "/fba/inventory/v1/items/#{percent_encode(seller_sku)}"
  params = {
    "marketplaceId" => marketplace_id,
  }.compact
  parser = Peddler::Types::FBAInventoryV1::DeleteInventoryItemResponse if typed?
  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](developer-docs.amazon.com/sp-api/docs/url-encoding).



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/peddler/apis/fba_inventory_v1.rb', line 56

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 = Peddler::Types::FBAInventoryV1::GetInventorySummariesResponse if typed?
  meter(rate_limit).get(path, params:, parser:)
end