Class: SwaggerClient::MarketAveragesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger_client/api/market_averages_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MarketAveragesApi

Returns a new instance of MarketAveragesApi.



19
20
21
# File 'lib/swagger_client/api/market_averages_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/swagger_client/api/market_averages_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_averages(api_key, opts = {}) ⇒ Averages

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

Parameters:

  • api_key

    The API Authentication Key. Mandatory with all API calls.

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

    the optional parameters

Options Hash (opts):

  • :vin (String)

    VIN as a reference to the type of car for which averages data is to be returned

  • :year (String)

    Year of the car

  • :make (String)

    Make of the car

  • :model (String)

    Model of the Car

  • :trim (String)

    Trim of the Car

  • :fields (String)

    Comma separated list of fields to generate stats for. Allowed fields in the list are - price, miles, msrp, dom (days on market)

Returns:



34
35
36
37
# File 'lib/swagger_client/api/market_averages_api.rb', line 34

def get_averages(api_key, opts = {})
  data, status_code, headers = get_averages_with_http_info(api_key, opts)
  return data
end

#get_averages_with_http_info(api_key, opts = {}) ⇒ Array<(Averages, Fixnum, Hash)>

Get Averages for YMM

Merged with the /search API - Please check the &#39;stats&#39; 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&#39;s basic specification or Year, Make, Model, Trim (Optional) criteria

Parameters:

  • api_key

    The API Authentication Key. Mandatory with all API calls.

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

    the optional parameters

Options Hash (opts):

  • :vin (String)

    VIN as a reference to the type of car for which averages data is to be returned

  • :year (String)

    Year of the car

  • :make (String)

    Make of the car

  • :model (String)

    Model of the Car

  • :trim (String)

    Trim of the Car

  • :fields (String)

    Comma separated list of fields to generate stats for. Allowed fields in the list are - price, miles, msrp, dom (days on market)

Returns:

  • (Array<(Averages, Fixnum, Hash)>)

    Averages data, response status code and response headers



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
# File 'lib/swagger_client/api/market_averages_api.rb', line 50

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