Class: SwaggerClient::HistoryApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ HistoryApi

Returns a new instance of HistoryApi.



19
20
21
# File 'lib/swagger_client/api/history_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/history_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#history(api_key, vin, opts = {}) ⇒ Array<HistoricalListing>

Get a cars online listing history The history API returns online listing history for a car identified by its VIN. History listings are sorted in the descending order of the listing date / last seen date

Parameters:

  • api_key

    The API Authentication Key. Mandatory with all API calls.

  • vin

    The VIN to identify the car to fetch the listing history. Must be a valid 17 char VIN

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

    the optional parameters

Options Hash (opts):

  • :rows (Float)

    Number of results to return. Default is 10. Max is 50

  • :page (Float)

    Page number to fetch the results for the given criteria. Default is 1.

Returns:



31
32
33
34
# File 'lib/swagger_client/api/history_api.rb', line 31

def history(api_key, vin, opts = {})
  data, status_code, headers = history_with_http_info(api_key, vin, opts)
  return data
end

#history_with_http_info(api_key, vin, opts = {}) ⇒ Array<(Array<HistoricalListing>, Fixnum, Hash)>

Get a cars online listing history The history API returns online listing history for a car identified by its VIN. History listings are sorted in the descending order of the listing date / last seen date

Parameters:

  • api_key

    The API Authentication Key. Mandatory with all API calls.

  • vin

    The VIN to identify the car to fetch the listing history. Must be a valid 17 char VIN

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

    the optional parameters

Options Hash (opts):

  • :rows (Float)

    Number of results to return. Default is 10. Max is 50

  • :page (Float)

    Page number to fetch the results for the given criteria. Default is 1.

Returns:

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

    Array<HistoricalListing> data, response status code and response headers



44
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/swagger_client/api/history_api.rb', line 44

def history_with_http_info(api_key, vin, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: HistoryApi#history ..."
  end
  
  # verify the required parameter 'api_key' is set
  fail "Missing the required parameter 'api_key' when calling history" if api_key.nil?
  
  # verify the required parameter 'vin' is set
  fail "Missing the required parameter 'vin' when calling history" if vin.nil?
  
  # resource path
  local_var_path = "/history/{vin}".sub('{format}','json').sub('{' + 'vin' + '}', vin.to_s)

  # query parameters
  query_params = {}
  query_params[:'api_key'] = api_key
  query_params[:'rows'] = opts[:'rows'] if opts[:'rows']
  query_params[:'page'] = opts[:'page'] if opts[:'page']
  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 => 'Array<HistoricalListing>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: HistoryApi#history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end