=begin
Marketcheck Cars API
Access the New, Used and Certified cars inventories for all Car Dealers in US.
The data is sourced from online listings by over 40,000 Car dealers in US. At any time, there are about 5.2M searchable listings (about 1.8M unique VINs) for Used & Certified cars and about 5M (about 2.3M unique VINs) New Car listings from all over US. We use this API at the back for our website www.marketcheck.com and our Android and iOS mobile apps too.
Few useful links :
- A quick view of the API and the use cases is depicated here
- The Postman collection with various usages of the API is shared here https://www.getpostman.com/collections/2752684ff636cdd7bac2
- [Coming soon] API Key : Request your API Key here
- [Coming soon] Benchmarks : See the API benchmarks here
OpenAPI spec version: 1.0.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end
require "uri"
module SwaggerClient
class MarketAveragesApi
attr_accessor :api_client
def initialize(api_client = ApiClient.default)
@api_client = api_client
end
# Get Averages for YMM
# [Merged with the /search API - Please check the 'stats' parameter to the Search API above] Get market averages for price / miles / msrp / dom (days on market) fields for active cars matching the given reference VIN's basic specification or Year, Make, Model, Trim (Optional) criteria
# @param api_key The API Authentication Key. Mandatory with all API calls.
# @param [Hash] opts the optional parameters
# @option opts [String] :vin VIN as a reference to the type of car for which averages data is to be returned
# @option opts [String] :year Year of the car
# @option opts [String] :make Make of the car
# @option opts [String] :model Model of the Car
# @option opts [String] :trim Trim of the Car
# @option opts [String] :fields Comma separated list of fields to generate stats for. Allowed fields in the list are - price, miles, msrp, dom (days on market)
# @return [Averages]
def get_averages(api_key, opts = {})
data, status_code, headers = get_averages_with_http_info(api_key, opts)
return data
end
# Get Averages for YMM
# [Merged with the /search API - Please check the 'stats' parameter to the Search API above] Get market averages for price / miles / msrp / dom (days on market) fields for active cars matching the given reference VIN's basic specification or Year, Make, Model, Trim (Optional) criteria
# @param api_key The API Authentication Key. Mandatory with all API calls.
# @param [Hash] opts the optional parameters
# @option opts [String] :vin VIN as a reference to the type of car for which averages data is to be returned
# @option opts [String] :year Year of the car
# @option opts [String] :make Make of the car
# @option opts [String] :model Model of the Car
# @option opts [String] :trim Trim of the Car
# @option opts [String] :fields Comma separated list of fields to generate stats for. Allowed fields in the list are - price, miles, msrp, dom (days on market)
# @return [Array<(Averages, Fixnum, Hash)>] Averages data, response status code and response headers
def get_averages_with_http_info(api_key, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: MarketAveragesApi#get_averages ..."
end
# verify the required parameter 'api_key' is set
fail "Missing the required parameter 'api_key' when calling get_averages" if api_key.nil?
# resource path
local_var_path = "/averages".sub('{format}','json')
# query parameters
query_params = {}
query_params[:'api_key'] = api_key
query_params[:'vin'] = opts[:'vin'] if opts[:'vin']
query_params[:'year'] = opts[:'year'] if opts[:'year']
query_params[:'make'] = opts[:'make'] if opts[:'make']
query_params[:'model'] = opts[:'model'] if opts[:'model']
query_params[:'trim'] = opts[:'trim'] if opts[:'trim']
query_params[:'fields'] = opts[:'fields'] if opts[:'fields']
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
_header_accept = ['application/json']
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
# HTTP header 'Content-Type'
_header_content_type = []
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
# form parameters
form_params = {}
# http body (model)
post_body = nil
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 => 'Averages')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: MarketAveragesApi#get_averages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
end
end