Class: AmznSpApi::FbaInventoryApiModel::FbaInventoryApi

Inherits:
Object
  • Object
show all
Defined in:
lib/fba_inventory_api_model/api/fba_inventory_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FbaInventoryApi

Returns a new instance of FbaInventoryApi.



14
15
16
# File 'lib/fba_inventory_api_model/api/fba_inventory_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/fba_inventory_api_model/api/fba_inventory_api.rb', line 12

def api_client
  @api_client
end

Instance Method Details

#get_inventory_summaries(granularity_type, granularity_id, marketplace_ids, opts = {}) ⇒ GetInventorySummariesResponse

Returns a list of inventory summaries. The summaries returned depend on the presence or absence of the ‘startDateTime`, `sellerSkus` and `sellerSku` parameters: - All inventory summaries with available details are returned when the `startDateTime`, `sellerSkus` and `sellerSku` parameters are omitted. - When `startDateTime` is provided, the operation returns inventory summaries that have had changes after the date and time specified. The `sellerSkus` and `sellerSku` parameters are ignored. Important: To avoid errors, use both `startDateTime` and `nextToken` to get the next page of inventory summaries that have changed after the date and time specified. - When the `sellerSkus` parameter is provided, the operation returns inventory summaries for only the specified `sellerSkus`. The `sellerSku` parameter is ignored. - When the `sellerSku` parameter is provided, the operation returns inventory summaries for only the specified `sellerSku`. **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 see higher rate and burst values than 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:

  • granularity_type

    The granularity type for the inventory aggregation level.

  • granularity_id

    The granularity ID for the inventory aggregation level.

  • marketplace_ids

    The marketplace ID for the marketplace for which to return inventory summaries.

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

    the optional parameters

Options Hash (opts):

  • :details (BOOLEAN)

    true to return inventory summaries with additional summarized inventory details and quantities. Otherwise, returns inventory summaries only (default value). (default to false)

  • :start_date_time (DateTime)

    A start date and time in ISO8601 format. If specified, all inventory summaries that have changed since then are returned. You must specify a date and time that is no earlier than 18 months prior to the date and time when you call the API. Note: Changes in inboundWorkingQuantity, inboundShippedQuantity and inboundReceivingQuantity are not detected.

  • :seller_skus (Array<String>)

    A list of seller SKUs for which to return inventory summaries. You may specify up to 50 SKUs.

  • :seller_sku (String)

    A single seller SKU used for querying the specified seller SKU inventory summaries.

  • :next_token (String)

    String token returned in the response of your previous request. The string token will expire 30 seconds after being created.

Returns:



29
30
31
32
# File 'lib/fba_inventory_api_model/api/fba_inventory_api.rb', line 29

def get_inventory_summaries(granularity_type, granularity_id, marketplace_ids, opts = {})
  data, _status_code, _headers = get_inventory_summaries_with_http_info(granularity_type, granularity_id, marketplace_ids, opts)
  data
end

#get_inventory_summaries_with_http_info(granularity_type, granularity_id, marketplace_ids, opts = {}) ⇒ Array<(GetInventorySummariesResponse, Integer, Hash)>

Returns a list of inventory summaries. The summaries returned depend on the presence or absence of the &#x60;startDateTime&#x60;, &#x60;sellerSkus&#x60; and &#x60;sellerSku&#x60; parameters: - All inventory summaries with available details are returned when the &#x60;startDateTime&#x60;, &#x60;sellerSkus&#x60; and &#x60;sellerSku&#x60; parameters are omitted. - When &#x60;startDateTime&#x60; is provided, the operation returns inventory summaries that have had changes after the date and time specified. The &#x60;sellerSkus&#x60; and &#x60;sellerSku&#x60; parameters are ignored. Important: To avoid errors, use both &#x60;startDateTime&#x60; and &#x60;nextToken&#x60; to get the next page of inventory summaries that have changed after the date and time specified. - When the &#x60;sellerSkus&#x60; parameter is provided, the operation returns inventory summaries for only the specified &#x60;sellerSkus&#x60;. The &#x60;sellerSku&#x60; parameter is ignored. - When the &#x60;sellerSku&#x60; parameter is provided, the operation returns inventory summaries for only the specified &#x60;sellerSku&#x60;. **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 see higher rate and burst values than 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:

  • granularity_type

    The granularity type for the inventory aggregation level.

  • granularity_id

    The granularity ID for the inventory aggregation level.

  • marketplace_ids

    The marketplace ID for the marketplace for which to return inventory summaries.

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

    the optional parameters

Options Hash (opts):

  • :details (BOOLEAN)

    true to return inventory summaries with additional summarized inventory details and quantities. Otherwise, returns inventory summaries only (default value).

  • :start_date_time (DateTime)

    A start date and time in ISO8601 format. If specified, all inventory summaries that have changed since then are returned. You must specify a date and time that is no earlier than 18 months prior to the date and time when you call the API. Note: Changes in inboundWorkingQuantity, inboundShippedQuantity and inboundReceivingQuantity are not detected.

  • :seller_skus (Array<String>)

    A list of seller SKUs for which to return inventory summaries. You may specify up to 50 SKUs.

  • :seller_sku (String)

    A single seller SKU used for querying the specified seller SKU inventory summaries.

  • :next_token (String)

    String token returned in the response of your previous request. The string token will expire 30 seconds after being created.

Returns:

Raises:

  • (ArgumentError)


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
89
90
91
92
93
94
# File 'lib/fba_inventory_api_model/api/fba_inventory_api.rb', line 45

def get_inventory_summaries_with_http_info(granularity_type, granularity_id, marketplace_ids, opts = {})
  @api_client.config.logger.debug 'Calling API: FbaInventoryApi.get_inventory_summaries ...' if @api_client.config.debugging
  # verify the required parameter 'granularity_type' is set
  raise ArgumentError, "Missing the required parameter 'granularity_type' when calling FbaInventoryApi.get_inventory_summaries" if @api_client.config.client_side_validation && granularity_type.nil?
  # verify enum value
  raise ArgumentError, "invalid value for 'granularity_type', must be one of Marketplace" if @api_client.config.client_side_validation && !['Marketplace'].include?(granularity_type)
  # verify the required parameter 'granularity_id' is set
  raise ArgumentError, "Missing the required parameter 'granularity_id' when calling FbaInventoryApi.get_inventory_summaries" if @api_client.config.client_side_validation && granularity_id.nil?
  # verify the required parameter 'marketplace_ids' is set
  raise ArgumentError, "Missing the required parameter 'marketplace_ids' when calling FbaInventoryApi.get_inventory_summaries" if @api_client.config.client_side_validation && marketplace_ids.nil?

  # resource path
  local_var_path = '/fba/inventory/v1/summaries'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:granularityType] = granularity_type
  query_params[:granularityId] = granularity_id
  query_params[:marketplaceIds] = @api_client.build_collection_param(marketplace_ids, :csv)
  query_params[:details] = opts[:details] unless opts[:details].nil?
  query_params[:startDateTime] = opts[:start_date_time] unless opts[:start_date_time].nil?
  query_params[:sellerSkus] = @api_client.build_collection_param(opts[:seller_skus], :csv) unless opts[:seller_skus].nil?
  query_params[:sellerSku] = opts[:seller_sku] unless opts[:seller_sku].nil?
  query_params[:nextToken] = opts[:next_token] unless opts[:next_token].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] || 'GetInventorySummariesResponse'

  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: FbaInventoryApi#get_inventory_summaries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" if @api_client.config.debugging
  [data, status_code, headers]
end