Class: AmznSpApi::SalesApiModel::SalesApi
- Inherits:
-
Object
- Object
- AmznSpApi::SalesApiModel::SalesApi
- Defined in:
- lib/sales_api_model/api/sales_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#get_order_metrics(marketplace_ids, interval, granularity, opts = {}) ⇒ GetOrderMetricsResponse
Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type.
-
#get_order_metrics_with_http_info(marketplace_ids, interval, granularity, opts = {}) ⇒ Array<(GetOrderMetricsResponse, Integer, Hash)>
Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type.
-
#initialize(api_client = ApiClient.default) ⇒ SalesApi
constructor
A new instance of SalesApi.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
12 13 14 |
# File 'lib/sales_api_model/api/sales_api.rb', line 12 def api_client @api_client end |
Instance Method Details
#get_order_metrics(marketplace_ids, interval, granularity, opts = {}) ⇒ GetOrderMetricsResponse
Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type. **Usage Plan:** | Rate (requests per second) | Burst | | —- | —- | | .5 | 15 | 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).
30 31 32 33 |
# File 'lib/sales_api_model/api/sales_api.rb', line 30 def get_order_metrics(marketplace_ids, interval, granularity, opts = {}) data, _status_code, _headers = get_order_metrics_with_http_info(marketplace_ids, interval, granularity, opts) data end |
#get_order_metrics_with_http_info(marketplace_ids, interval, granularity, opts = {}) ⇒ Array<(GetOrderMetricsResponse, Integer, Hash)>
Returns aggregated order metrics for given interval, broken down by granularity, for given buyer type. **Usage Plan:** | Rate (requests per second) | Burst | | —- | —- | | .5 | 15 | 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).
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 95 96 97 98 99 |
# File 'lib/sales_api_model/api/sales_api.rb', line 47 def get_order_metrics_with_http_info(marketplace_ids, interval, granularity, opts = {}) @api_client.config.logger.debug 'Calling API: SalesApi.get_order_metrics ...' if @api_client.config.debugging # verify the required parameter 'marketplace_ids' is set raise ArgumentError, "Missing the required parameter 'marketplace_ids' when calling SalesApi.get_order_metrics" if @api_client.config.client_side_validation && marketplace_ids.nil? # verify the required parameter 'interval' is set raise ArgumentError, "Missing the required parameter 'interval' when calling SalesApi.get_order_metrics" if @api_client.config.client_side_validation && interval.nil? # verify the required parameter 'granularity' is set raise ArgumentError, "Missing the required parameter 'granularity' when calling SalesApi.get_order_metrics" if @api_client.config.client_side_validation && granularity.nil? # verify enum value raise ArgumentError, "invalid value for 'granularity', must be one of Hour, Day, Week, Month, Year, Total" if @api_client.config.client_side_validation && !%w[Hour Day Week Month Year Total].include?(granularity) raise ArgumentError, 'invalid value for "buyer_type", must be one of B2B, B2C, All' if @api_client.config.client_side_validation && opts[:buyer_type] && !%w[B2B B2C All].include?(opts[:buyer_type]) raise ArgumentError, 'invalid value for "first_day_of_week", must be one of Monday, Sunday' if @api_client.config.client_side_validation && opts[:first_day_of_week] && !%w[Monday Sunday].include?(opts[:first_day_of_week]) # resource path local_var_path = '/sales/v1/orderMetrics' # query parameters query_params = opts[:query_params] || {} query_params[:marketplaceIds] = @api_client.build_collection_param(marketplace_ids, :csv) query_params[:interval] = interval query_params[:granularity] = granularity query_params[:granularityTimeZone] = opts[:granularity_time_zone] unless opts[:granularity_time_zone].nil? query_params[:buyerType] = opts[:buyer_type] unless opts[:buyer_type].nil? query_params[:fulfillmentNetwork] = opts[:fulfillment_network] unless opts[:fulfillment_network].nil? query_params[:firstDayOfWeek] = opts[:first_day_of_week] unless opts[:first_day_of_week].nil? query_params[:asin] = opts[:asin] unless opts[:asin].nil? query_params[:sku] = opts[:sku] unless opts[:sku].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'payload']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] return_type = opts[:return_type] || 'GetOrderMetricsResponse' 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: SalesApi#get_order_metrics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" if @api_client.config.debugging [data, status_code, headers] end |