Class: AmznSpApi::ListingsRestrictionsApiModel::ListingsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/listings_restrictions_api_model/api/listings_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ListingsApi

Returns a new instance of ListingsApi.



14
15
16
# File 'lib/listings_restrictions_api_model/api/listings_api.rb', line 14

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



12
13
14
# File 'lib/listings_restrictions_api_model/api/listings_api.rb', line 12

def api_client
  @api_client
end

Instance Method Details

#get_listings_restrictions(asin, seller_id, marketplace_ids, opts = {}) ⇒ RestrictionList

Returns listing restrictions for an item in the Amazon Catalog. **Usage Plan:** | Rate (requests per second) | Burst | | —- | —- | | 5 | 10 | The ‘x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).

Parameters:

  • asin

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

  • seller_id

    A selling partner identifier, such as a merchant account.

  • marketplace_ids

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

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :condition_type (String)

    The condition used to filter restrictions.

  • :reason_locale (String)

    A locale for reason text localization. When not provided, the default language 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.

Returns:



26
27
28
29
# File 'lib/listings_restrictions_api_model/api/listings_api.rb', line 26

def get_listings_restrictions(asin, seller_id, marketplace_ids, opts = {})
  data, _status_code, _headers = get_listings_restrictions_with_http_info(asin, seller_id, marketplace_ids, opts)
  data
end

#get_listings_restrictions_with_http_info(asin, seller_id, marketplace_ids, opts = {}) ⇒ Array<(RestrictionList, Integer, Hash)>

Returns listing restrictions for an item in the Amazon Catalog. **Usage Plan:** | Rate (requests per second) | Burst | | —- | —- | | 5 | 10 | The &#x60;x-amzn-RateLimit-Limit&#x60; response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).

Parameters:

  • asin

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

  • seller_id

    A selling partner identifier, such as a merchant account.

  • marketplace_ids

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

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :condition_type (String)

    The condition used to filter restrictions.

  • :reason_locale (String)

    A locale for reason text localization. When not provided, the default language code of the first marketplace is used. Examples: &quot;en_US&quot;, &quot;fr_CA&quot;, &quot;fr_FR&quot;. Localized messages default to &quot;en_US&quot; when a localization is not available in the specified locale.

Returns:

  • (Array<(RestrictionList, Integer, Hash)>)

    RestrictionList data, response status code and response headers

Raises:

  • (ArgumentError)


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/listings_restrictions_api_model/api/listings_api.rb', line 39

def get_listings_restrictions_with_http_info(asin, seller_id, marketplace_ids, opts = {})
  @api_client.config.logger.debug 'Calling API: ListingsApi.get_listings_restrictions ...' if @api_client.config.debugging
  # verify the required parameter 'asin' is set
  raise ArgumentError, "Missing the required parameter 'asin' when calling ListingsApi.get_listings_restrictions" if @api_client.config.client_side_validation && asin.nil?
  # verify the required parameter 'seller_id' is set
  raise ArgumentError, "Missing the required parameter 'seller_id' when calling ListingsApi.get_listings_restrictions" if @api_client.config.client_side_validation && seller_id.nil?
  # verify the required parameter 'marketplace_ids' is set
  raise ArgumentError, "Missing the required parameter 'marketplace_ids' when calling ListingsApi.get_listings_restrictions" if @api_client.config.client_side_validation && marketplace_ids.nil?
  raise ArgumentError, 'invalid value for "condition_type", must be one of new_new, new_open_box, new_oem, refurbished_refurbished, used_like_new, used_very_good, used_good, used_acceptable, collectible_like_new, collectible_very_good, collectible_good, collectible_acceptable, club_club' if @api_client.config.client_side_validation && opts[:condition_type] && !%w[new_new new_open_box new_oem refurbished_refurbished used_like_new used_very_good used_good used_acceptable collectible_like_new collectible_very_good collectible_good collectible_acceptable club_club].include?(opts[:condition_type])

  # resource path
  local_var_path = '/listings/2021-08-01/restrictions'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:asin] = asin
  query_params[:sellerId] = seller_id
  query_params[:marketplaceIds] = @api_client.build_collection_param(marketplace_ids, :csv)
  query_params[:conditionType] = opts[:condition_type] unless opts[:condition_type].nil?
  query_params[:reasonLocale] = opts[:reason_locale] unless opts[:reason_locale].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body]

  return_type = opts[:return_type] || 'RestrictionList'

  auth_names = opts[:auth_names] || []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
                                                    header_params: header_params,
                                                    query_params: query_params,
                                                    form_params: form_params,
                                                    body: post_body,
                                                    auth_names: auth_names,
                                                    return_type: return_type)

  @api_client.config.logger.debug "API called: ListingsApi#get_listings_restrictions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" if @api_client.config.debugging
  [data, status_code, headers]
end