Class: AmzSpApi::CatalogItemsApiModel::CatalogApi

Inherits:
Object
  • Object
show all
Defined in:
lib/catalog-items-api-model/api/catalog_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CatalogApi

Returns a new instance of CatalogApi.



16
17
18
# File 'lib/catalog-items-api-model/api/catalog_api.rb', line 16

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/catalog-items-api-model/api/catalog_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#get_catalog_item(asin, marketplace_ids, opts = {}) ⇒ Item

Retrieves details for an item in the Amazon catalog. **Usage Plan:** | Rate (requests per second) | Burst | | —- | —- | | 2 | 2 | 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 observe higher rate and burst values than those shown here. For more information, refer to the [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.

  • marketplace_ids

    A comma-delimited list of Amazon marketplace identifiers. Data sets in the response contain data only for the specified marketplaces.

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

    the optional parameters

Options Hash (opts):

  • :included_data (Array<String>)

    A comma-delimited list of data sets to include in the response. Default: &#x60;summaries&#x60;.

  • :locale (String)

    Locale for retrieving localized summaries. Defaults to the primary locale of the marketplace.

Returns:



26
27
28
29
# File 'lib/catalog-items-api-model/api/catalog_api.rb', line 26

def get_catalog_item(asin, marketplace_ids, opts = {})
  data, _status_code, _headers = get_catalog_item_with_http_info(asin, marketplace_ids, opts)
  data
end

#get_catalog_item_with_http_info(asin, marketplace_ids, opts = {}) ⇒ Array<(Item, Integer, Hash)>

Retrieves details for an item in the Amazon catalog. **Usage Plan:** | Rate (requests per second) | Burst | | —- | —- | | 2 | 2 | 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 observe higher rate and burst values than those shown here. For more information, refer to the [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.

  • marketplace_ids

    A comma-delimited list of Amazon marketplace identifiers. Data sets in the response contain data only for the specified marketplaces.

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

    the optional parameters

Options Hash (opts):

  • :included_data (Array<String>)

    A comma-delimited list of data sets to include in the response. Default: &#x60;summaries&#x60;.

  • :locale (String)

    Locale for retrieving localized summaries. Defaults to the primary locale of the marketplace.

Returns:

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

    Item data, response status code and response headers



38
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
85
86
87
88
# File 'lib/catalog-items-api-model/api/catalog_api.rb', line 38

def get_catalog_item_with_http_info(asin, marketplace_ids, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CatalogApi.get_catalog_item ...'
  end
  # verify the required parameter 'asin' is set
  if @api_client.config.client_side_validation && asin.nil?
    fail ArgumentError, "Missing the required parameter 'asin' when calling CatalogApi.get_catalog_item"
  end
  # verify the required parameter 'marketplace_ids' is set
  if @api_client.config.client_side_validation && marketplace_ids.nil?
    fail ArgumentError, "Missing the required parameter 'marketplace_ids' when calling CatalogApi.get_catalog_item"
  end
  if @api_client.config.client_side_validation && opts[:'included_data'] && !opts[:'included_data'].all? { |item| ['attributes', 'dimensions', 'identifiers', 'images', 'productTypes', 'relationships', 'salesRanks', 'summaries', 'vendorDetails'].include?(item) }
    fail ArgumentError, 'invalid value for "included_data", must include one of attributes, dimensions, identifiers, images, productTypes, relationships, salesRanks, summaries, vendorDetails'
  end
  # resource path
  local_var_path = '/catalog/2022-04-01/items/{asin}'.sub('{' + 'asin' + '}', asin.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'marketplaceIds'] = @api_client.build_collection_param(marketplace_ids, :csv)
  query_params[:'includedData'] = @api_client.build_collection_param(opts[:'included_data'], :csv) if !opts[:'included_data'].nil?
  query_params[:'locale'] = opts[:'locale'] if !opts[:'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] || 'Item' 

  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)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CatalogApi#get_catalog_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_catalog_items(marketplace_ids, opts = {}) ⇒ ItemSearchResults

Search for and return a list of Amazon catalog items and associated information either by identifier or by keywords. **Usage Plans:** | Rate (requests per second) | Burst | | —- | —- | | 2 | 2 | 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 observe higher rate and burst values than those shown here. For more information, refer to the [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).

Parameters:

  • marketplace_ids

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

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

    the optional parameters

Options Hash (opts):

  • :identifiers (Array<String>)

    A comma-delimited list of product identifiers to search the Amazon catalog for. Note: Cannot be used with &#x60;keywords&#x60;.

  • :identifiers_type (String)

    Type of product identifiers to search the Amazon catalog for. Note: Required when &#x60;identifiers&#x60; are provided.

  • :included_data (Array<String>)

    A comma-delimited list of data sets to include in the response. Default: &#x60;summaries&#x60;.

  • :locale (String)

    Locale for retrieving localized summaries. Defaults to the primary locale of the marketplace.

  • :seller_id (String)

    A selling partner identifier, such as a seller account or vendor code. Note: Required when &#x60;identifiersType&#x60; is &#x60;SKU&#x60;.

  • :keywords (Array<String>)

    A comma-delimited list of words to search the Amazon catalog for. Note: Cannot be used with &#x60;identifiers&#x60;.

  • :brand_names (Array<String>)

    A comma-delimited list of brand names to limit the search for &#x60;keywords&#x60;-based queries. Note: Cannot be used with &#x60;identifiers&#x60;.

  • :classification_ids (Array<String>)

    A comma-delimited list of classification identifiers to limit the search for &#x60;keywords&#x60;-based queries. Note: Cannot be used with &#x60;identifiers&#x60;.

  • :page_size (Integer)

    Number of results to be returned per page. (default to 10)

  • :page_token (String)

    A token to fetch a certain page when there are multiple pages worth of results.

  • :keywords_locale (String)

    The language of the keywords provided for &#x60;keywords&#x60;-based queries. Defaults to the primary locale of the marketplace. Note: Cannot be used with &#x60;identifiers&#x60;.

Returns:



104
105
106
107
# File 'lib/catalog-items-api-model/api/catalog_api.rb', line 104

def search_catalog_items(marketplace_ids, opts = {})
  data, _status_code, _headers = search_catalog_items_with_http_info(marketplace_ids, opts)
  data
end

#search_catalog_items_with_http_info(marketplace_ids, opts = {}) ⇒ Array<(ItemSearchResults, Integer, Hash)>

Search for and return a list of Amazon catalog items and associated information either by identifier or by keywords. **Usage Plans:** | Rate (requests per second) | Burst | | —- | —- | | 2 | 2 | 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 observe higher rate and burst values than those shown here. For more information, refer to the [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).

Parameters:

  • marketplace_ids

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

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

    the optional parameters

Options Hash (opts):

  • :identifiers (Array<String>)

    A comma-delimited list of product identifiers to search the Amazon catalog for. Note: Cannot be used with &#x60;keywords&#x60;.

  • :identifiers_type (String)

    Type of product identifiers to search the Amazon catalog for. Note: Required when &#x60;identifiers&#x60; are provided.

  • :included_data (Array<String>)

    A comma-delimited list of data sets to include in the response. Default: &#x60;summaries&#x60;.

  • :locale (String)

    Locale for retrieving localized summaries. Defaults to the primary locale of the marketplace.

  • :seller_id (String)

    A selling partner identifier, such as a seller account or vendor code. Note: Required when &#x60;identifiersType&#x60; is &#x60;SKU&#x60;.

  • :keywords (Array<String>)

    A comma-delimited list of words to search the Amazon catalog for. Note: Cannot be used with &#x60;identifiers&#x60;.

  • :brand_names (Array<String>)

    A comma-delimited list of brand names to limit the search for &#x60;keywords&#x60;-based queries. Note: Cannot be used with &#x60;identifiers&#x60;.

  • :classification_ids (Array<String>)

    A comma-delimited list of classification identifiers to limit the search for &#x60;keywords&#x60;-based queries. Note: Cannot be used with &#x60;identifiers&#x60;.

  • :page_size (Integer)

    Number of results to be returned per page.

  • :page_token (String)

    A token to fetch a certain page when there are multiple pages worth of results.

  • :keywords_locale (String)

    The language of the keywords provided for &#x60;keywords&#x60;-based queries. Defaults to the primary locale of the marketplace. Note: Cannot be used with &#x60;identifiers&#x60;.

Returns:

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

    ItemSearchResults data, response status code and response headers



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/catalog-items-api-model/api/catalog_api.rb', line 124

def search_catalog_items_with_http_info(marketplace_ids, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CatalogApi.search_catalog_items ...'
  end
  # verify the required parameter 'marketplace_ids' is set
  if @api_client.config.client_side_validation && marketplace_ids.nil?
    fail ArgumentError, "Missing the required parameter 'marketplace_ids' when calling CatalogApi.search_catalog_items"
  end
  if @api_client.config.client_side_validation && opts[:'identifiers_type'] && !['ASIN', 'EAN', 'GTIN', 'ISBN', 'JAN', 'MINSAN', 'SKU', 'UPC'].include?(opts[:'identifiers_type'])
    fail ArgumentError, 'invalid value for "identifiers_type", must be one of ASIN, EAN, GTIN, ISBN, JAN, MINSAN, SKU, UPC'
  end
  if @api_client.config.client_side_validation && opts[:'included_data'] && !opts[:'included_data'].all? { |item| ['attributes', 'dimensions', 'identifiers', 'images', 'productTypes', 'relationships', 'salesRanks', 'summaries', 'vendorDetails'].include?(item) }
    fail ArgumentError, 'invalid value for "included_data", must include one of attributes, dimensions, identifiers, images, productTypes, relationships, salesRanks, summaries, vendorDetails'
  end
  # resource path
  local_var_path = '/catalog/2022-04-01/items'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'marketplaceIds'] = @api_client.build_collection_param(marketplace_ids, :csv)
  query_params[:'identifiers'] = @api_client.build_collection_param(opts[:'identifiers'], :csv) if !opts[:'identifiers'].nil?
  query_params[:'identifiersType'] = opts[:'identifiers_type'] if !opts[:'identifiers_type'].nil?
  query_params[:'includedData'] = @api_client.build_collection_param(opts[:'included_data'], :csv) if !opts[:'included_data'].nil?
  query_params[:'locale'] = opts[:'locale'] if !opts[:'locale'].nil?
  query_params[:'sellerId'] = opts[:'seller_id'] if !opts[:'seller_id'].nil?
  query_params[:'keywords'] = @api_client.build_collection_param(opts[:'keywords'], :csv) if !opts[:'keywords'].nil?
  query_params[:'brandNames'] = @api_client.build_collection_param(opts[:'brand_names'], :csv) if !opts[:'brand_names'].nil?
  query_params[:'classificationIds'] = @api_client.build_collection_param(opts[:'classification_ids'], :csv) if !opts[:'classification_ids'].nil?
  query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'pageToken'] = opts[:'page_token'] if !opts[:'page_token'].nil?
  query_params[:'keywordsLocale'] = opts[:'keywords_locale'] if !opts[:'keywords_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] || 'ItemSearchResults' 

  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)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CatalogApi#search_catalog_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end