Class: AmznSpApi::CatalogItemsApiModel::CatalogApi
- Inherits:
-
Object
- Object
- AmznSpApi::CatalogItemsApiModel::CatalogApi
- Defined in:
- lib/catalog_items_api_model/api/catalog_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#get_catalog_item(asin, marketplace_ids, opts = {}) ⇒ Item
Retrieves details for an item in the Amazon catalog.
-
#get_catalog_item_with_http_info(asin, marketplace_ids, opts = {}) ⇒ Array<(Item, Integer, Hash)>
Retrieves details for an item in the Amazon catalog.
-
#initialize(api_client = ApiClient.default) ⇒ CatalogApi
constructor
A new instance of CatalogApi.
-
#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.
-
#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.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ CatalogApi
Returns a new instance of CatalogApi.
14 15 16 |
# File 'lib/catalog_items_api_model/api/catalog_api.rb', line 14 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
12 13 14 |
# File 'lib/catalog_items_api_model/api/catalog_api.rb', line 12 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).
25 26 27 28 |
# File 'lib/catalog_items_api_model/api/catalog_api.rb', line 25 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 `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).
37 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 |
# File 'lib/catalog_items_api_model/api/catalog_api.rb', line 37 def get_catalog_item_with_http_info(asin, marketplace_ids, opts = {}) @api_client.config.logger.debug 'Calling API: CatalogApi.get_catalog_item ...' if @api_client.config.debugging # verify the required parameter 'asin' is set raise ArgumentError, "Missing the required parameter 'asin' when calling CatalogApi.get_catalog_item" if @api_client.config.client_side_validation && asin.nil? # verify the required parameter 'marketplace_ids' is set raise ArgumentError, "Missing the required parameter 'marketplace_ids' when calling CatalogApi.get_catalog_item" if @api_client.config.client_side_validation && marketplace_ids.nil? raise ArgumentError, 'invalid value for "included_data", must include one of attributes, dimensions, identifiers, images, productTypes, relationships, salesRanks, summaries, vendorDetails' if @api_client.config.client_side_validation && opts[:included_data] && !opts[:included_data].all? { |item| %w[attributes dimensions identifiers images productTypes relationships salesRanks summaries vendorDetails].include?(item) } # 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) unless opts[:included_data].nil? query_params[:locale] = opts[:locale] unless 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) @api_client.config.logger.debug "API called: CatalogApi#get_catalog_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" if @api_client.config.debugging [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).
95 96 97 98 |
# File 'lib/catalog_items_api_model/api/catalog_api.rb', line 95 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 `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).
115 116 117 118 119 120 121 122 123 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 |
# File 'lib/catalog_items_api_model/api/catalog_api.rb', line 115 def search_catalog_items_with_http_info(marketplace_ids, opts = {}) @api_client.config.logger.debug 'Calling API: CatalogApi.search_catalog_items ...' if @api_client.config.debugging # verify the required parameter 'marketplace_ids' is set raise ArgumentError, "Missing the required parameter 'marketplace_ids' when calling CatalogApi.search_catalog_items" if @api_client.config.client_side_validation && marketplace_ids.nil? raise ArgumentError, 'invalid value for "identifiers_type", must be one of ASIN, EAN, GTIN, ISBN, JAN, MINSAN, SKU, UPC' if @api_client.config.client_side_validation && opts[:identifiers_type] && !%w[ASIN EAN GTIN ISBN JAN MINSAN SKU UPC].include?(opts[:identifiers_type]) raise ArgumentError, 'invalid value for "included_data", must include one of attributes, dimensions, identifiers, images, productTypes, relationships, salesRanks, summaries, vendorDetails' if @api_client.config.client_side_validation && opts[:included_data] && !opts[:included_data].all? { |item| %w[attributes dimensions identifiers images productTypes relationships salesRanks summaries vendorDetails].include?(item) } # 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) unless opts[:identifiers].nil? query_params[:identifiersType] = opts[:identifiers_type] unless opts[:identifiers_type].nil? query_params[:includedData] = @api_client.build_collection_param(opts[:included_data], :csv) unless opts[:included_data].nil? query_params[:locale] = opts[:locale] unless opts[:locale].nil? query_params[:sellerId] = opts[:seller_id] unless opts[:seller_id].nil? query_params[:keywords] = @api_client.build_collection_param(opts[:keywords], :csv) unless opts[:keywords].nil? query_params[:brandNames] = @api_client.build_collection_param(opts[:brand_names], :csv) unless opts[:brand_names].nil? query_params[:classificationIds] = @api_client.build_collection_param(opts[:classification_ids], :csv) unless opts[:classification_ids].nil? query_params[:pageSize] = opts[:page_size] unless opts[:page_size].nil? query_params[:pageToken] = opts[:page_token] unless opts[:page_token].nil? query_params[:keywordsLocale] = opts[:keywords_locale] unless 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) @api_client.config.logger.debug "API called: CatalogApi#search_catalog_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" if @api_client.config.debugging [data, status_code, headers] end |