Class: AmzSpApi::SalesApiModel::SalesApi
- Inherits:
-
Object
- Object
- AmzSpApi::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.
14 15 16 |
# File 'lib/sales-api-model/api/sales_api.rb', line 14 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).
31 32 33 34 |
# File 'lib/sales-api-model/api/sales_api.rb', line 31 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).
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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/sales-api-model/api/sales_api.rb', line 48 def get_order_metrics_with_http_info(marketplace_ids, interval, granularity, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SalesApi.get_order_metrics ...' 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 SalesApi.get_order_metrics" end # verify the required parameter 'interval' is set if @api_client.config.client_side_validation && interval.nil? fail ArgumentError, "Missing the required parameter 'interval' when calling SalesApi.get_order_metrics" end # verify the required parameter 'granularity' is set if @api_client.config.client_side_validation && granularity.nil? fail ArgumentError, "Missing the required parameter 'granularity' when calling SalesApi.get_order_metrics" end # verify enum value if @api_client.config.client_side_validation && !['Hour', 'Day', 'Week', 'Month', 'Year', 'Total'].include?(granularity) fail ArgumentError, "invalid value for 'granularity', must be one of Hour, Day, Week, Month, Year, Total" end if @api_client.config.client_side_validation && opts[:'buyer_type'] && !['B2B', 'B2C', 'All'].include?(opts[:'buyer_type']) fail ArgumentError, 'invalid value for "buyer_type", must be one of B2B, B2C, All' end if @api_client.config.client_side_validation && opts[:'first_day_of_week'] && !['Monday', 'Sunday'].include?(opts[:'first_day_of_week']) fail ArgumentError, 'invalid value for "first_day_of_week", must be one of Monday, Sunday' end # 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'] if !opts[:'granularity_time_zone'].nil? query_params[:'buyerType'] = opts[:'buyer_type'] if !opts[:'buyer_type'].nil? query_params[:'fulfillmentNetwork'] = opts[:'fulfillment_network'] if !opts[:'fulfillment_network'].nil? query_params[:'firstDayOfWeek'] = opts[:'first_day_of_week'] if !opts[:'first_day_of_week'].nil? query_params[:'asin'] = opts[:'asin'] if !opts[:'asin'].nil? query_params[:'sku'] = opts[:'sku'] if !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) if @api_client.config.debugging @api_client.config.logger.debug "API called: SalesApi#get_order_metrics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |