Class: Peddler::APIs::ListingsRestrictions20210801

Inherits:
Peddler::API
  • Object
show all
Defined in:
lib/peddler/apis/listings_restrictions_2021_08_01.rb,
lib/peddler/apis/listings_restrictions_2021_08_01/link.rb,
lib/peddler/apis/listings_restrictions_2021_08_01/error.rb,
lib/peddler/apis/listings_restrictions_2021_08_01/reason.rb,
lib/peddler/apis/listings_restrictions_2021_08_01/error_list.rb,
lib/peddler/apis/listings_restrictions_2021_08_01/restriction.rb,
lib/peddler/apis/listings_restrictions_2021_08_01/restriction_list.rb

Overview

Selling Partner API for Listings Restrictions

The Selling Partner API for Listings Restrictions provides programmatic access to restrictions on Amazon catalog listings.

For more information, see the href="https://developer-docs.amazon.com/sp-api/docs/listings-restrictions-api-v2021-08-01-use-case-guide">https://developer-docs.amazon.com/sp-api/docs/listings-restrictions-api-v2021-08-01-use-case-guide Listings Restrictions API Use Case Guide.

Defined Under Namespace

Classes: ErrorList

Constant Summary collapse

Structure.new do
  # @return [URI] The URI of the related resource.
  attribute(:resource, URI)

  # @return [String] The HTTP verb used to interact with the related resource.
  attribute(:verb, String)

  # @return [String] The title of the related resource.
  attribute?(:title, String)

  # @return [String] The media type of the related resource.
  attribute?(:type, String)
end
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
Reason =

A reason for the restriction, including path forward links that may allow Selling Partners to remove the restriction, if available.

Structure.new do
  # @return [String] A message describing the reason for the restriction.
  attribute(:message, String)

  # @return [Array<Link>] A list of path forward links that may allow Selling Partners to remove the restriction.
  attribute?(:links, [Link])

  # @return [String] A code indicating why the listing is restricted.
  attribute?(:reason_code, String, from: "reasonCode")
end
Restriction =

A listing restriction, optionally qualified by a condition, with a list of reasons for the restriction.

Structure.new do
  # @return [String] A marketplace identifier. Identifies the Amazon marketplace where the restriction is
  # enforced.
  attribute(:marketplace_id, String, from: "marketplaceId")

  # @return [String] The condition that applies to the restriction.
  attribute?(:condition_type, String, from: "conditionType")

  # @return [Array<Reason>] A list of reasons for the restriction.
  attribute?(:reasons, [Reason])
end
RestrictionList =

A list of restrictions for the specified Amazon catalog item.

Structure.new do
  # @return [Array<Restriction>]
  attribute(:restrictions, [Restriction])
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_listings_restrictions(asin, seller_id, marketplace_ids, condition_type: nil, reason_locale: nil, rate_limit: 5.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns listing restrictions for an item in the Amazon Catalog.

code of the first marketplace is used. Examples: "en_US", "fr_CA", "fr_FR". Localized messages default to "en_US" when a localization is not available in the specified locale.

Parameters:

  • asin (String)

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

  • condition_type (String) (defaults to: nil)

    The condition used to filter restrictions.

  • seller_id (String)

    A selling partner identifier, such as a merchant account.

  • marketplace_ids (Array<String>)

    A comma-delimited list of Amazon marketplace identifiers for the request.

  • reason_locale (String) (defaults to: nil)

    A locale for reason text localization. When not provided, the default language

  • rate_limit (Float) (defaults to: 5.0)

    Requests per second

Returns:



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/peddler/apis/listings_restrictions_2021_08_01.rb', line 30

def get_listings_restrictions(asin, seller_id, marketplace_ids, condition_type: nil, reason_locale: nil,
  rate_limit: 5.0)
  path = "/listings/2021-08-01/restrictions"
  params = {
    "asin" => asin,
    "conditionType" => condition_type,
    "sellerId" => seller_id,
    "marketplaceIds" => stringify_array(marketplace_ids),
    "reasonLocale" => reason_locale,
  }.compact
  parser = -> { RestrictionList }
  meter(rate_limit).get(path, params:, parser:)
end