Class: Peddler::APIs::ProductPricing20220501

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/product_pricing_2022_05_01.rb,
lib/peddler/apis/product_pricing_2022_05_01/error.rb,
lib/peddler/apis/product_pricing_2022_05_01/offer.rb,
lib/peddler/apis/product_pricing_2022_05_01/price.rb,
lib/peddler/apis/product_pricing_2022_05_01/errors.rb,
lib/peddler/apis/product_pricing_2022_05_01/points.rb,
lib/peddler/apis/product_pricing_2022_05_01/segment.rb,
lib/peddler/apis/product_pricing_2022_05_01/error_list.rb,
lib/peddler/apis/product_pricing_2022_05_01/postal_code.rb,
lib/peddler/apis/product_pricing_2022_05_01/batch_request.rb,
lib/peddler/apis/product_pricing_2022_05_01/prime_details.rb,
lib/peddler/apis/product_pricing_2022_05_01/batch_response.rb,
lib/peddler/apis/product_pricing_2022_05_01/featured_offer.rb,
lib/peddler/apis/product_pricing_2022_05_01/reference_price.rb,
lib/peddler/apis/product_pricing_2022_05_01/sample_location.rb,
lib/peddler/apis/product_pricing_2022_05_01/segment_details.rb,
lib/peddler/apis/product_pricing_2022_05_01/shipping_option.rb,
lib/peddler/apis/product_pricing_2022_05_01/http_status_line.rb,
lib/peddler/apis/product_pricing_2022_05_01/offer_identifier.rb,
lib/peddler/apis/product_pricing_2022_05_01/lowest_priced_offer.rb,
lib/peddler/apis/product_pricing_2022_05_01/featured_buying_option.rb,
lib/peddler/apis/product_pricing_2022_05_01/featured_offer_segment.rb,
lib/peddler/apis/product_pricing_2022_05_01/segmented_featured_offer.rb,
lib/peddler/apis/product_pricing_2022_05_01/lowest_priced_offers_input.rb,
lib/peddler/apis/product_pricing_2022_05_01/competitive_summary_request.rb,
lib/peddler/apis/product_pricing_2022_05_01/competitive_summary_response.rb,
lib/peddler/apis/product_pricing_2022_05_01/featured_offer_expected_price.rb,
lib/peddler/apis/product_pricing_2022_05_01/competitive_summary_request_list.rb,
lib/peddler/apis/product_pricing_2022_05_01/competitive_summary_batch_request.rb,
lib/peddler/apis/product_pricing_2022_05_01/competitive_summary_response_body.rb,
lib/peddler/apis/product_pricing_2022_05_01/competitive_summary_response_list.rb,
lib/peddler/apis/product_pricing_2022_05_01/competitive_summary_batch_response.rb,
lib/peddler/apis/product_pricing_2022_05_01/featured_offer_expected_price_result.rb,
lib/peddler/apis/product_pricing_2022_05_01/featured_offer_expected_price_request.rb,
lib/peddler/apis/product_pricing_2022_05_01/featured_offer_expected_price_response.rb,
lib/peddler/apis/product_pricing_2022_05_01/featured_offer_expected_price_result_list.rb,
lib/peddler/apis/product_pricing_2022_05_01/featured_offer_expected_price_request_list.rb,
lib/peddler/apis/product_pricing_2022_05_01/featured_offer_expected_price_response_body.rb,
lib/peddler/apis/product_pricing_2022_05_01/featured_offer_expected_price_response_list.rb,
lib/peddler/apis/product_pricing_2022_05_01/featured_offer_expected_price_request_params.rb,
lib/peddler/apis/product_pricing_2022_05_01/get_featured_offer_expected_price_batch_request.rb,
lib/peddler/apis/product_pricing_2022_05_01/get_featured_offer_expected_price_batch_response.rb

Overview

Selling Partner API for Pricing

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

For more information, refer to the Product Pricing v2022-05-01 Use Case Guide.

Defined Under Namespace

Classes: CompetitiveSummaryRequestList, CompetitiveSummaryResponseList, ErrorList, FeaturedOfferExpectedPriceRequestList, FeaturedOfferExpectedPriceResponseList, FeaturedOfferExpectedPriceResultList

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

The offer data of a product.

Structure.new do
  # @return [String] Item Condition.
  attribute(:condition, String)

  # @return [String] The fulfillment type for the offer. Possible values are `AFN` (Amazon Fulfillment Network)
  # and `MFN` (Merchant Fulfillment Network).
  attribute(:fulfillment_type, String, from: "fulfillmentType")

  # @return [Money] The offer buying price. This doesn't include shipping, points, or applicable promotions.
  attribute(:listing_price, Money, from: "listingPrice")

  # @return [String] The seller identifier for the offer.
  attribute(:seller_id, String, from: "sellerId")

  # @return [Points] The number of Amazon Points that are offered with the purchase of an item and the monetary
  # value of these points. Note that the Points element is only returned in Japan (JP).
  attribute?(:points, Points)

  # @return [PrimeDetails] Amazon Prime details.
  attribute?(:prime_details, PrimeDetails, from: "primeDetails")

  # @return [Array<ShippingOption>] A list of shipping options associated with this offer
  attribute?(:shipping_options, [ShippingOption], from: "shippingOptions")

  # @return [String] The item subcondition of the offer.
  attribute?(:sub_condition, String, from: "subCondition")
end
Price =

The schema for item's price information, including listing price, shipping price, and Amazon Points.

Structure.new do
  # @return [Money] The listing price for the item, excluding any promotions.
  attribute(:listing_price, Money, from: "listingPrice")

  # @return [Points] The number of Amazon Points that are offered with the purchase of an item and the monetary
  # value of these points.
  attribute?(:points, Points)

  # @return [Money] The shipping cost of the product. Note that the shipping cost is not always available.
  attribute?(:shipping_price, Money, from: "shippingPrice")
end
Errors =

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

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

The number of Amazon Points that are offered with the purchase of an item and the monetary value of these points.

Structure.new do
  # @return [Money] The monetary value of the Amazon Points.
  attribute?(:points_monetary_value, Money, from: "pointsMonetaryValue")

  # @return [Integer] The number of Amazon Points.
  attribute?(:points_number, Integer, from: "pointsNumber")
end
Segment =

Input segment for featured offer expected price. The segment contains the location information for which featured offer expected price is requested.

Structure.new do
  # @return [SegmentDetails] Segment details
  attribute?(:segment_details, SegmentDetails, from: "segmentDetails")
end
PostalCode =

Postal code value with country code

Structure.new do
  # @return [String] Country code value
  attribute?(:country_code, String, from: "countryCode")

  # @return [String] Postal code value
  attribute?(:value, String)
end
BatchRequest =

The common properties for individual requests within a batch.

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

  # @return [String] The URI associated with an individual request within a batch. For
  # `FeaturedOfferExpectedPrice`, this is `/products/pricing/2022-05-01/offer/featuredOfferExpectedPrice`.
  attribute(:uri, String)

  # @return [Hash]
  attribute?(:body, Hash)

  # @return [Hash]
  attribute?(:headers, Hash)
end
PrimeDetails =

Amazon Prime details.

Structure.new do
  # @return [String] Indicates whether the offer is an Amazon Prime offer.
  attribute(:eligibility, String)
end
BatchResponse =

The common properties for responses to individual requests within a batch.

Structure.new do
  # @return [Hash]
  attribute(:headers, Hash)

  # @return [HttpStatusLine]
  attribute(:status, HttpStatusLine)
end
FeaturedOffer =

Schema for currentFeaturedOffer or competingFeaturedOffer.

Structure.new do
  # @return [OfferIdentifier] An offer identifier used to identify the merchant of the featured offer. Since this
  # may not belong to the requester, the SKU field is omitted.
  attribute(:offer_identifier, OfferIdentifier, from: "offerIdentifier")

  # @return [String] The item condition.
  attribute?(:condition, String)

  # @return [Price] The current active price of the offer.
  attribute?(:price, Price)
end
ReferencePrice =

The reference price for the specified ASIN marketplaceId combination.

Structure.new do
  # @return [String] Reference price type (e.g., `CompetitivePriceThreshold`, `WasPrice`, `CompetitivePrice`). For
  # definitions, see the [Product Pricing API Use Case
  # Guide](https://developer-docs.amazon.com/sp-api/docs/product-pricing-api-v2022-05-01-use-case-guide).
  attribute(:name, String)

  # @return [Money] The reference price for the ASIN `marketplaceId` combination.
  attribute(:price, Money)
end
SampleLocation =

Information about a location. It uses a postal code to identify the location.

Structure.new do
  # @return [PostalCode]
  attribute?(:postal_code, PostalCode, from: "postalCode")
end
SegmentDetails =

The details about the segment. The FeaturedOfferExpectedPrice API uses only the sampleLocation portion as input.

Structure.new do
  # @return [Float] The glance view weighted percentage for this segment, which is the glance views for this
  # segment as a percentage of total glance views across all segments for the ASIN. A higher percentage indicates
  # that more Amazon customers receive this offer as the Featured Offer.
  attribute?(:glance_view_weight_percentage, Float, from: "glanceViewWeightPercentage")

  # @return [SampleLocation] The representative location that features the offer for the segment.
  attribute?(:sample_location, SampleLocation, from: "sampleLocation")
end
ShippingOption =

The shipping option available for the offer.

Structure.new do
  # @return [Money] Shipping price for the offer.
  attribute(:price, Money)

  # @return [String] The type of shipping option.
  attribute(:shipping_option_type, String, from: "shippingOptionType")
end
HttpStatusLine =

The HTTP status line associated with the response for an individual request within a batch. For more information, refer to RFC 2616.

Structure.new do
  # @return [String] The HTTP response reason phrase.
  attribute?(:reason_phrase, String, from: "reasonPhrase")

  # @return [Integer] The HTTP response status code.
  attribute?(:status_code, Integer, from: "statusCode")
end
OfferIdentifier =

Identifies an offer from a particular seller for a specified ASIN.

Structure.new do
  # @return [String] The Amazon identifier for the item.
  attribute(:asin, String)

  # @return [String] A marketplace identifier.
  attribute(:marketplace_id, String, from: "marketplaceId")

  # @return [String] The fulfillment type for the offer.
  attribute?(:fulfillment_type, String, from: "fulfillmentType")

  # @return [String] The seller identifier for the offer.
  attribute?(:seller_id, String, from: "sellerId")

  # @return [String] The seller SKU of the item. This will only be present for the target offer, which belongs to
  # the requesting seller.
  attribute?(:sku, String)
end
LowestPricedOffer =

Describes the lowest priced offers for the specified item condition and offer type.

Structure.new do
  # @return [LowestPricedOffersInput] The filtering criteria that are used to retrieve the lowest priced offers
  # that correspond to the `lowestPricedOffersInputs` request.
  attribute(:lowest_priced_offers_input, LowestPricedOffersInput, from: "lowestPricedOffersInput")

  # @return [Array<Offer>] A list of up to 20 lowest priced offers that match the criteria specified in
  # `lowestPricedOffersInput`.
  attribute(:offers, [Offer])
end
FeaturedBuyingOption =

Describes a featured buying option, which includes a list of segmented featured offers for a particular item condition.

Structure.new do
  # @return [String] The buying option type for the featured offer. `buyingOptionType` represents the buying
  # options that a customer receives on the detail page, such as `B2B`, `Fresh`, and `Subscribe n Save`.
  # `buyingOptionType` currently supports `NEW` as a value.
  attribute(:buying_option_type, String, from: "buyingOptionType")

  # @return [Array<SegmentedFeaturedOffer>] A list of segmented featured offers for the current buying option
  # type. A segment can be considered as a group of regional contexts that all have the same featured offer. A
  # regional context is a combination of factors such as customer type, region, or postal code and buying option.
  attribute(:segmented_featured_offers, [SegmentedFeaturedOffer], from: "segmentedFeaturedOffers")
end
FeaturedOfferSegment =

Describes the segment in which the offer is featured.

Structure.new do
  # @return [String] The customer membership type that makes up this segment
  attribute(:customer_membership, String, from: "customerMembership")

  # @return [SegmentDetails] The details about the segment.
  attribute(:segment_details, SegmentDetails, from: "segmentDetails")
end
SegmentedFeaturedOffer =

A product offer with segment information indicating where it's featured.

Structure.new do
  # @return [String] Item Condition.
  attribute(:condition, String)

  # @return [Array<FeaturedOfferSegment>] The list of segment information in which the offer is featured.
  attribute(:featured_offer_segments, [FeaturedOfferSegment], from: "featuredOfferSegments")

  # @return [String] The fulfillment type for the offer. Possible values are `AFN` (Amazon Fulfillment Network)
  # and `MFN` (Merchant Fulfillment Network).
  attribute(:fulfillment_type, String, from: "fulfillmentType")

  # @return [Money] The offer buying price. This doesn't include shipping, points, or applicable promotions.
  attribute(:listing_price, Money, from: "listingPrice")

  # @return [String] The seller identifier for the offer.
  attribute(:seller_id, String, from: "sellerId")

  # @return [Points] The number of Amazon Points that are offered with the purchase of an item and the monetary
  # value of these points. Note that the Points element is only returned in Japan (JP).
  attribute?(:points, Points)

  # @return [PrimeDetails] Amazon Prime details.
  attribute?(:prime_details, PrimeDetails, from: "primeDetails")

  # @return [Array<ShippingOption>] A list of shipping options associated with this offer
  attribute?(:shipping_options, [ShippingOption], from: "shippingOptions")

  # @return [String] The item subcondition of the offer.
  attribute?(:sub_condition, String, from: "subCondition")
end
LowestPricedOffersInput =

The input required for building LowestPricedOffers data in the response.

Structure.new do
  # @return [String] The input parameter specifies the `itemCondition` of the offer that is requested for
  # `LowestPricedOffers`. `New` is the default value for `itemCondition`.
  attribute(:item_condition, String, from: "itemCondition")

  # @return [String] The input parameter specifies the type of offers requested for `LowestPricedOffers`. This
  # applies to `Consumer` and `Business` offers. `Consumer` is the default `offerType`.
  attribute(:offer_type, String, from: "offerType")
end
CompetitiveSummaryRequest =

An individual competitiveSummary request for an ASIN and marketplaceId.

Structure.new do
  # @return [String] The Amazon Standard Identification Number for the item.
  attribute(:asin, String)

  # @return [Array<CompetitiveSummaryIncludedData>] The list of requested competitive pricing data for the
  # product.
  attribute(:included_data, Array, from: "includedData")

  # @return [String] A marketplace identifier.
  attribute(:marketplace_id, String, from: "marketplaceId")

  # @return [String] HTTP method type
  attribute(:method, String)

  # @return [String] The URI associated with the individual APIs that are called as part of the batch request. For
  # `getCompetitiveSummary`, this is `/products/pricing/2022-05-01/items/competitiveSummary`.
  attribute(:uri, String)

  # @return [Array<LowestPricedOffersInput>] The list of `lowestPricedOffersInput` parameters that are used to
  # build `lowestPricedOffers` in the response. This attribute is only valid if `lowestPricedOffers` is requested
  # in `includedData`
  attribute?(:lowest_priced_offers_inputs, [LowestPricedOffersInput], from: "lowestPricedOffersInputs")
end
CompetitiveSummaryResponse =

The response for the individual competitiveSummary request in the batch operation.

Structure.new do
  # @return [CompetitiveSummaryResponseBody] The `competitiveSummaryResponse` body for a requested ASIN and
  # `marketplaceId`.
  attribute(:body, CompetitiveSummaryResponseBody)

  # @return [HttpStatusLine] The HTTP status line associated with the response. For more information, refer to
  # [RFC 2616](https://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html).
  attribute(:status, HttpStatusLine)
end
FeaturedOfferExpectedPrice =

The item price at or below which the target offer may be featured.

Structure.new do
  # @return [Money] A computed listing price at or below which a seller can expect to become the featured offer
  # (before applicable promotions).
  attribute(:listing_price, Money, from: "listingPrice")

  # @return [Points] The number of Amazon Points that are offered with the purchase of an item and the monetary
  # value of these points.
  attribute?(:points, Points)
end
CompetitiveSummaryBatchRequest =

The competitiveSummary batch request data.

Structure.new do
  # @return [Array<CompetitiveSummaryRequest>] A batched list of `competitiveSummary` requests.
  attribute(:requests, [CompetitiveSummaryRequest])
end
CompetitiveSummaryResponseBody =

The competitiveSummaryResponse body for a requested ASIN and marketplaceId.

Structure.new do
  # @return [String] The Amazon identifier for the item.
  attribute(:asin, String)

  # @return [String] A marketplace identifier.
  attribute(:marketplace_id, String, from: "marketplaceId")

  # @return [Array<Error>] A list of errors
  attribute?(:errors, [Error])

  # @return [Array<FeaturedBuyingOption>] A list of featured buying options for the specified ASIN `marketplaceId`
  # combination.
  attribute?(:featured_buying_options, [FeaturedBuyingOption], from: "featuredBuyingOptions")

  # @return [Array<LowestPricedOffer>] A list of lowest priced offers for the specified ASIN `marketplaceId`
  # combination.
  attribute?(:lowest_priced_offers, [LowestPricedOffer], from: "lowestPricedOffers")

  # @return [Array<ReferencePrice>] A list of reference prices for the specified ASIN `marketplaceId` combination.
  attribute?(:reference_prices, [ReferencePrice], from: "referencePrices")
end
CompetitiveSummaryBatchResponse =

The response schema for the competitiveSummaryBatch operation.

Structure.new do
  # @return [Array<CompetitiveSummaryResponse>] The response list for the `competitiveSummaryBatch` operation.
  attribute(:responses, [CompetitiveSummaryResponse])
end
FeaturedOfferExpectedPriceResult =

The FOEP result data for the requested offer.

Structure.new do
  # @return [String] The status of the FOEP computation. Possible values include `VALID_FOEP`,
  # `NO_COMPETING_OFFER`, `OFFER_NOT_ELIGIBLE`, `OFFER_NOT_FOUND`, and `ASIN_NOT_ELIGIBLE`. Additional values
  # might be added in the future.
  attribute(:result_status, String, from: "resultStatus")

  # @return [FeaturedOffer] The offer that will likely be the featured offer if the target offer is priced above
  # its FOEP. If the target offer is currently the featured offer, this property will be different than
  # `currentFeaturedOffer`.
  attribute?(:competing_featured_offer, FeaturedOffer, from: "competingFeaturedOffer")

  # @return [FeaturedOffer] The offer that is currently the featured offer. If the target offer is not currently
  # featured, then this property will be equal to `competingFeaturedOffer`.
  attribute?(:current_featured_offer, FeaturedOffer, from: "currentFeaturedOffer")

  # @return [FeaturedOfferExpectedPrice]
  attribute?(:featured_offer_expected_price, FeaturedOfferExpectedPrice, from: "featuredOfferExpectedPrice")
end
FeaturedOfferExpectedPriceRequest =

An individual FOEP request for a particular SKU.

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

  # @return [String]
  attribute(:method, String)

  # @return [String]
  attribute(:sku, String)

  # @return [String] The URI associated with an individual request within a batch. For
  # `FeaturedOfferExpectedPrice`, this is `/products/pricing/2022-05-01/offer/featuredOfferExpectedPrice`.
  attribute(:uri, String)

  # @return [Hash]
  attribute?(:body, Hash)

  # @return [Hash]
  attribute?(:headers, Hash)

  # @return [Segment]
  attribute?(:segment, Segment)
end
FeaturedOfferExpectedPriceResponse =

Schema for an individual FOEP response.

Structure.new do
  # @return [Hash]
  attribute(:headers, Hash)

  # @return [FeaturedOfferExpectedPriceRequestParams] Use these request parameters to map the response back to the
  # request.
  attribute(:request, FeaturedOfferExpectedPriceRequestParams)

  # @return [HttpStatusLine]
  attribute(:status, HttpStatusLine)

  # @return [FeaturedOfferExpectedPriceResponseBody]
  attribute?(:body, FeaturedOfferExpectedPriceResponseBody)
end
FeaturedOfferExpectedPriceResponseBody =

The FOEP response data for a requested SKU.

Structure.new do
  # @return [Array<Error>] The errors that occurred if the operation wasn't successful (HTTP status code non-200).
  attribute?(:errors, [Error])

  # @return [Array<FeaturedOfferExpectedPriceResult>] The FOEP results for the requested target offer.
  attribute?(:featured_offer_expected_price_results, [FeaturedOfferExpectedPriceResult], from: "featuredOfferExpectedPriceResults")

  # @return [OfferIdentifier] Metadata that identifies the target offer for which the FOEP result data was
  # computed.
  attribute?(:offer_identifier, OfferIdentifier, from: "offerIdentifier")
end
FeaturedOfferExpectedPriceRequestParams =

The parameters for an individual request.

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

  # @return [String]
  attribute(:sku, String)

  # @return [Segment]
  attribute?(:segment, Segment)
end
GetFeaturedOfferExpectedPriceBatchRequest =

The request body for the getFeaturedOfferExpectedPriceBatch operation.

Structure.new do
  # @return [Array<FeaturedOfferExpectedPriceRequest>]
  attribute?(:requests, [FeaturedOfferExpectedPriceRequest])
end
GetFeaturedOfferExpectedPriceBatchResponse =

The response schema for the getFeaturedOfferExpectedPriceBatch operation.

Structure.new do
  # @return [Array<FeaturedOfferExpectedPriceResponse>]
  attribute?(:responses, [FeaturedOfferExpectedPriceResponse])
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

#get_competitive_summary(requests, rate_limit: 0.033) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns the competitive summary response, including featured buying options for the ASIN and marketplaceId combination.

Parameters:

  • requests (Hash)

    The batch of getCompetitiveSummary requests.

  • rate_limit (Float) (defaults to: 0.033)

    Requests per second

Returns:



44
45
46
47
48
49
# File 'lib/peddler/apis/product_pricing_2022_05_01.rb', line 44

def get_competitive_summary(requests, rate_limit: 0.033)
  path = "/batches/products/pricing/2022-05-01/items/competitiveSummary"
  body = requests
  parser = -> { CompetitiveSummaryBatchResponse }
  meter(rate_limit).post(path, body:, parser:)
end
Note:

This operation can make a static sandbox call.

Returns the set of responses that correspond to the batched list of up to 40 requests defined in the request body. The response for each successful (HTTP status code 200) request in the set includes the computed listing price at or below which a seller can expect to become the featured offer (before applicable promotions). This is called the featured offer expected price (FOEP). Featured offer is not guaranteed because competing offers might change. Other offers might be featured based on factors such as fulfillment capabilities to a specific customer. The response to an unsuccessful request includes the available error text.

requests.

Parameters:

  • get_featured_offer_expected_price_batch_request_body (Hash)

    The batch of getFeaturedOfferExpectedPrice

  • rate_limit (Float) (defaults to: 0.033)

    Requests per second

Returns:



29
30
31
32
33
34
35
# File 'lib/peddler/apis/product_pricing_2022_05_01.rb', line 29

def get_featured_offer_expected_price_batch(get_featured_offer_expected_price_batch_request_body,
  rate_limit: 0.033)
  path = "/batches/products/pricing/2022-05-01/offer/featuredOfferExpectedPrice"
  body = get_featured_offer_expected_price_batch_request_body
  parser = -> { GetFeaturedOfferExpectedPriceBatchResponse }
  meter(rate_limit).post(path, body:, parser:)
end