Class: Peddler::APIs::ProductPricingV0

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/product_pricing_v0.rb

Overview

Selling Partner API for Pricing

The Selling Partner API for Pricing helps you programmatically retrieve product pricing and offer information for Amazon Marketplace products.

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

#get_competitive_pricing(marketplace_id, item_type, asins: nil, skus: nil, customer_type: nil, rate_limit: 0.5) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns competitive pricing information for a seller’s offer listings based on seller SKU or ASIN.

Note: The parameters associated with this operation may contain special characters that require URL encoding to call the API. To avoid errors with SKUs when encoding URLs, refer to [URL Encoding](developer-docs.amazon.com/sp-api/docs/url-encoding).

Parameters:

  • marketplace_id (String)

    A marketplace identifier. Specifies the marketplace for which prices are returned.

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

    A list of up to twenty Amazon Standard Identification Number (ASIN) values used to identify items in the given marketplace.

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

    A list of up to twenty seller SKU values used to identify items in the given marketplace.

  • item_type (String)

    Indicates whether ASIN values or seller SKU values are used to identify items. If you specify Asin, the information in the response will be dependent on the list of Asins you provide in the Asins parameter. If you specify Sku, the information in the response will be dependent on the list of Skus you provide in the Skus parameter. Possible values: Asin, Sku.

  • customer_type (String) (defaults to: nil)

    Indicates whether to request pricing information from the point of view of Consumer or Business buyers. Default is Consumer.

  • rate_limit (Float) (defaults to: 0.5)

    Requests per second

Returns:



79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/peddler/apis/product_pricing_v0.rb', line 79

def get_competitive_pricing(marketplace_id, item_type, asins: nil, skus: nil, customer_type: nil, rate_limit: 0.5)
  path = "/products/pricing/v0/competitivePrice"
  params = {
    "MarketplaceId" => marketplace_id,
    "Asins" => stringify_array(asins),
    "Skus" => stringify_array(skus),
    "ItemType" => item_type,
    "CustomerType" => customer_type,
  }.compact
  parser = Peddler::Types::ProductPricingV0::GetPricingResponse if typed?
  meter(rate_limit).get(path, params:, parser:)
end

#get_item_offers(marketplace_id, item_condition, asin, customer_type: nil, rate_limit: 0.5) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns the lowest priced offers for a single item based on ASIN.

Parameters:

  • marketplace_id (String)

    A marketplace identifier. Specifies the marketplace for which prices are returned.

  • item_condition (String)

    Filters the offer listings to be considered based on item condition. Possible values: New, Used, Collectible, Refurbished, Club.

  • asin (String)

    The Amazon Standard Identification Number (ASIN) of the item.

  • customer_type (String) (defaults to: nil)

    Indicates whether to request Consumer or Business offers. Default is Consumer.

  • rate_limit (Float) (defaults to: 0.5)

    Requests per second

Returns:



130
131
132
133
134
135
136
137
138
139
# File 'lib/peddler/apis/product_pricing_v0.rb', line 130

def get_item_offers(marketplace_id, item_condition, asin, customer_type: nil, rate_limit: 0.5)
  path = "/products/pricing/v0/items/#{percent_encode(asin)}/offers"
  params = {
    "MarketplaceId" => marketplace_id,
    "ItemCondition" => item_condition,
    "CustomerType" => customer_type,
  }.compact
  parser = Peddler::Types::ProductPricingV0::GetOffersResponse if typed?
  meter(rate_limit).get(path, params:, parser:)
end

#get_item_offers_batch(get_item_offers_batch_request_body, rate_limit: 0.1) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns the lowest priced offers for a batch of items based on ASIN.

Parameters:

  • get_item_offers_batch_request_body (Hash)

    The request associated with the ‘getItemOffersBatch` API call.

  • rate_limit (Float) (defaults to: 0.1)

    Requests per second

Returns:



147
148
149
150
151
152
# File 'lib/peddler/apis/product_pricing_v0.rb', line 147

def get_item_offers_batch(get_item_offers_batch_request_body, rate_limit: 0.1)
  path = "/batches/products/pricing/v0/itemOffers"
  body = get_item_offers_batch_request_body
  parser = Peddler::Types::ProductPricingV0::GetItemOffersBatchResponse if typed?
  meter(rate_limit).post(path, body:, parser:)
end

#get_listing_offers(marketplace_id, item_condition, seller_sku, customer_type: nil, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns the lowest priced offers for a single SKU listing.

Note: The parameters associated with this operation may contain special characters that require URL encoding to call the API. To avoid errors with SKUs when encoding URLs, refer to [URL Encoding](developer-docs.amazon.com/sp-api/docs/url-encoding).

Parameters:

  • marketplace_id (String)

    A marketplace identifier. Specifies the marketplace for which prices are returned.

  • item_condition (String)

    Filters the offer listings based on item condition. Possible values: New, Used, Collectible, Refurbished, Club.

  • seller_sku (String)

    Identifies an item in the given marketplace. SellerSKU is qualified by the seller’s SellerId, which is included with every operation that you submit.

  • customer_type (String) (defaults to: nil)

    Indicates whether to request Consumer or Business offers. Default is Consumer.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

Returns:



108
109
110
111
112
113
114
115
116
117
# File 'lib/peddler/apis/product_pricing_v0.rb', line 108

def get_listing_offers(marketplace_id, item_condition, seller_sku, customer_type: nil, rate_limit: 1.0)
  path = "/products/pricing/v0/listings/#{percent_encode(seller_sku)}/offers"
  params = {
    "MarketplaceId" => marketplace_id,
    "ItemCondition" => item_condition,
    "CustomerType" => customer_type,
  }.compact
  parser = Peddler::Types::ProductPricingV0::GetOffersResponse if typed?
  meter(rate_limit).get(path, params:, parser:)
end

#get_listing_offers_batch(get_listing_offers_batch_request_body, rate_limit: 0.5) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns the lowest priced offers for a batch of listings by SKU.

Parameters:

  • get_listing_offers_batch_request_body (Hash)

    The request associated with the ‘getListingOffersBatch` API call.

  • rate_limit (Float) (defaults to: 0.5)

    Requests per second

Returns:



161
162
163
164
165
166
# File 'lib/peddler/apis/product_pricing_v0.rb', line 161

def get_listing_offers_batch(get_listing_offers_batch_request_body, rate_limit: 0.5)
  path = "/batches/products/pricing/v0/listingOffers"
  body = get_listing_offers_batch_request_body
  parser = Peddler::Types::ProductPricingV0::GetListingOffersBatchResponse if typed?
  meter(rate_limit).post(path, body:, parser:)
end

#get_pricing(marketplace_id, item_type, asins: nil, skus: nil, item_condition: nil, offer_type: nil, rate_limit: 0.5) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns pricing information for a seller’s offer listings based on seller SKU or ASIN.

Note: The parameters associated with this operation may contain special characters that require URL encoding to call the API. To avoid errors with SKUs when encoding URLs, refer to [URL Encoding](developer-docs.amazon.com/sp-api/docs/url-encoding).

Parameters:

  • marketplace_id (String)

    A marketplace identifier. Specifies the marketplace for which prices are returned.

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

    A list of up to twenty Amazon Standard Identification Number (ASIN) values used to identify items in the given marketplace.

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

    A list of up to twenty seller SKU values used to identify items in the given marketplace.

  • item_type (String)

    Indicates whether ASIN values or seller SKU values are used to identify items. If you specify Asin, the information in the response will be dependent on the list of Asins you provide in the Asins parameter. If you specify Sku, the information in the response will be dependent on the list of Skus you provide in the Skus parameter.

  • item_condition (String) (defaults to: nil)

    Filters the offer listings based on item condition. Possible values: New, Used, Collectible, Refurbished, Club.

  • offer_type (String) (defaults to: nil)

    Indicates whether to request pricing information for the seller’s B2C or B2B offers. Default is B2C.

  • rate_limit (Float) (defaults to: 0.5)

    Requests per second

Returns:



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/peddler/apis/product_pricing_v0.rb', line 43

def get_pricing(marketplace_id, item_type, asins: nil, skus: nil, item_condition: nil, offer_type: nil,
  rate_limit: 0.5)
  path = "/products/pricing/v0/price"
  params = {
    "MarketplaceId" => marketplace_id,
    "Asins" => stringify_array(asins),
    "Skus" => stringify_array(skus),
    "ItemType" => item_type,
    "ItemCondition" => item_condition,
    "OfferType" => offer_type,
  }.compact
  parser = Peddler::Types::ProductPricingV0::GetPricingResponse if typed?
  meter(rate_limit).get(path, params:, parser:)
end