Class: SwaggerClient::ListingsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ListingsApi

Returns a new instance of ListingsApi.



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

def api_client
  @api_client
end

Instance Method Details

#get_listing(api_key, id, opts = {}) ⇒ Listing

Listing by id Get a particular listing by its id

Parameters:

  • api_key

    The API Authentication Key. Mandatory with all API calls.

  • id

    Listing id to get all the listing attributes

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

    the optional parameters

Returns:



29
30
31
32
# File 'lib/swagger_client/api/listings_api.rb', line 29

def get_listing(api_key, id, opts = {})
  data, status_code, headers = get_listing_with_http_info(api_key, id, opts)
  return data
end

#get_listing_extra(api_key, id, opts = {}) ⇒ ListingExtraAttributes

Long text Listings attributes for Listing with the given id Get listing options, features, seller comments

Parameters:

  • api_key

    The API Authentication Key. Mandatory with all API calls.

  • id

    Listing id to get all the long text listing attributes

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

    the optional parameters

Returns:



95
96
97
98
# File 'lib/swagger_client/api/listings_api.rb', line 95

def get_listing_extra(api_key, id, opts = {})
  data, status_code, headers = get_listing_extra_with_http_info(api_key, id, opts)
  return data
end

#get_listing_extra_with_http_info(api_key, id, opts = {}) ⇒ Array<(ListingExtraAttributes, Fixnum, Hash)>

Long text Listings attributes for Listing with the given id Get listing options, features, seller comments

Parameters:

  • api_key

    The API Authentication Key. Mandatory with all API calls.

  • id

    Listing id to get all the long text listing attributes

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

    the optional parameters

Returns:

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

    ListingExtraAttributes data, response status code and response headers



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/swagger_client/api/listings_api.rb', line 106

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

  # query parameters
  query_params = {}
  query_params[:'api_key'] = api_key

  # 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 => 'ListingExtraAttributes')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListingsApi#get_listing_extra\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_listing_media(api_key, id, opts = {}) ⇒ ListingMedia

Listing media by id Get listing media (photo, photos) by id

Parameters:

  • api_key

    The API Authentication Key. Mandatory with all API calls.

  • id

    Listing id to get all the listing attributes

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

    the optional parameters

Returns:



161
162
163
164
# File 'lib/swagger_client/api/listings_api.rb', line 161

def get_listing_media(api_key, id, opts = {})
  data, status_code, headers = get_listing_media_with_http_info(api_key, id, opts)
  return data
end

#get_listing_media_with_http_info(api_key, id, opts = {}) ⇒ Array<(ListingMedia, Fixnum, Hash)>

Listing media by id Get listing media (photo, photos) by id

Parameters:

  • api_key

    The API Authentication Key. Mandatory with all API calls.

  • id

    Listing id to get all the listing attributes

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

    the optional parameters

Returns:

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

    ListingMedia data, response status code and response headers



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/swagger_client/api/listings_api.rb', line 172

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

  # query parameters
  query_params = {}
  query_params[:'api_key'] = api_key

  # 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 => 'ListingMedia')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListingsApi#get_listing_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_listing_vdp(api_key, id, opts = {}) ⇒ ListingVDP

Get listing HTML Cached HTML of the Vehicle Details Page (VDP) for the listing. The HTML is cached only for 7 days for all listings. So this API could be used to get HTML of mostly active listings and that have recently expired

Parameters:

  • api_key

    The API Authentication Key. Mandatory with all API calls.

  • id

    Listing id to get the vehicle details page (VDP) HTML

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

    the optional parameters

Returns:



227
228
229
230
# File 'lib/swagger_client/api/listings_api.rb', line 227

def get_listing_vdp(api_key, id, opts = {})
  data, status_code, headers = get_listing_vdp_with_http_info(api_key, id, opts)
  return data
end

#get_listing_vdp_with_http_info(api_key, id, opts = {}) ⇒ Array<(ListingVDP, Fixnum, Hash)>

Get listing HTML Cached HTML of the Vehicle Details Page (VDP) for the listing. The HTML is cached only for 7 days for all listings. So this API could be used to get HTML of mostly active listings and that have recently expired

Parameters:

  • api_key

    The API Authentication Key. Mandatory with all API calls.

  • id

    Listing id to get the vehicle details page (VDP) HTML

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

    the optional parameters

Returns:

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

    ListingVDP data, response status code and response headers



238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/swagger_client/api/listings_api.rb', line 238

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

  # query parameters
  query_params = {}
  query_params[:'api_key'] = api_key

  # 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 => 'ListingVDP')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListingsApi#get_listing_vdp\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_listing_with_http_info(api_key, id, opts = {}) ⇒ Array<(Listing, Fixnum, Hash)>

Listing by id Get a particular listing by its id

Parameters:

  • api_key

    The API Authentication Key. Mandatory with all API calls.

  • id

    Listing id to get all the listing attributes

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

    the optional parameters

Returns:

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

    Listing data, response status code and response headers



40
41
42
43
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
# File 'lib/swagger_client/api/listings_api.rb', line 40

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

  # query parameters
  query_params = {}
  query_params[:'api_key'] = api_key

  # 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 => 'Listing')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListingsApi#get_listing\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search(api_key, latitude, longitude, radius, car_type, opts = {}) ⇒ SearchResponse

Gets active car listings for the given search criteria This endpoint is the meat of the API and serves many purposes. This API produces a list of currently active cars from the market for the given search criteria. The API results are limited to allow pagination upto 1000 rows. n The search API facilitates the following use cases - n1. Search Cars around a given geo-point within a given radius n2. Search cars for a specific year / make / model or combination of these n3. Search cars matching multiple year, make, model combinatins in the same search requestn4. Filter results by most car specification attributesn5. Search for similar cars by VIN or Taxonomy VIN n6. Filter cars within a given price / miles / days on market (dom) rangen7. Specify a sort order for the results on price / miles / dom / listed date n8. Search cars for a given City / State combination n9. Get Facets to build the search drill downs n10. Get Market averages for price/miles/dom/msrp for your search

Parameters:

  • api_key

    The API Authentication Key. Mandatory with all API calls.

  • latitude

    Latitude component of location

  • longitude

    Longitude component of location

  • radius

    Radius around the search location

  • car_type

    Car type. Allowed values are - new / used / certified

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

    the optional parameters

Options Hash (opts):

  • :year (String)

    Car year - 1980 onwards. You can pass in multiple year separated by comma e.g. 2010,2011

  • :make (String)

    Car Make - should be a standard OEM Make name

  • :model (String)

    Car model to search

  • :trim (String)

    Car trim to search

  • :dealer_id (String)

    Dealer id to filter the cars

  • :body_type (String)

    Body type to filter the cars on

  • :body_subtype (String)

    Body subtype to filter the cars on

  • :vehicle_type (String)

    Vehicle type to filter the cars on

  • :vins (String)

    Comma separated list of 17 digit vins to search the matching cars for. Only 10 VINs allowed per request. If the request contains more than 10 VINs the first 10 VINs will be considered. Could be used as a More Like This or Similar Vehicles search for the given VINs. Ths vins parameter is an alternative to taxonomy_vins or ymmt parameters available with the search API. vins and taxonomy_vins parameters could be used to filter our cars with the exact build represented by the vins or taxonomy_vins whereas ymmt is a top level filter that does not filter cars by the build attributes like doors, drivetrain, cylinders, body type, body subtype, vehicle type etc

  • :taxonomy_vins (String)

    Comma separated list of 10 letters excert from the 17 letter VIN. The 10 letters to be picked up from the 17 letter VIN are - first 8 letters and the 10th and 11th letter. E.g. For a VIN - 1FTFW1EF3EKE57182 the taxonomy vin would be - 1FTFW1EFEK A taxonomy VIN identified a build of a car and could be used to filter our cars of a particular build. This is an alternative to the vin or ymmt parameters to the search API.

  • :ymmt (String)

    Comma separated list of Year, Make, Model, Trim combinations. Each combination needs to have the year,make,model, trim values separated by a pipe &#39;|&#39; character in the form year|make|model|trim. e.g. 2010|Audi|A5,2014|Nissan|Sentra|S 6MT,|Honda|City| You could just provide strings of the form - &#39;year|make||&#39; or &#39;year|make|model&#39; or &#39;|make|model|&#39; combinations. Individual year / make / model filters provied with the API calls will take precedence over the Year, Make, Model, Trim combinations. The Make, Model, Trim values must be valid values as per the Marketcheck Vin Decoder. If you are using a separate vin decoder then look at using the &#39;vins&#39; or &#39;taxonomy_vins&#39; parameter to the search api instead the year|make|model|trim combinations.

  • :cylinders (String)

    Cylinders to filter the cars on

  • :transmission (String)

    Transmission to filter the cars on. [a = Automatic, m = Manual]

  • :drivetrain (String)

    Drivetrain to filter the cars on.

  • :exterior_color (String)

    Exterior color to match

  • :interior_color (String)

    Interior color to match

  • :miles_range (String)

    Miles range to filter cars with miles in the given range. Range to be given in the format - min-max e.g. 1000-5000

  • :price_range (String)

    Price range to filter cars with the price in the range given. Range to be given in the format - min-max e.g. 1000-5000

  • :dom_range (String)

    Days on Market range to filter cars with the DOM within the given range. Range to be given in the format - min-max e.g. 10-50

  • :sort_by (String)

    Sort by field - allowed fields are distance|price|miles|dom|age|posted_at|year. Default sort field is distance from the given point

  • :sort_order (String)

    Sort order - asc or desc. Default sort order is distance from a point.

  • :rows (String)

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

  • :start (String)

    Page number to fetch the results for the given criteria. Default is 1. Pagination is allowed only till first 1000 results for the search and sort criteria. The page value can be only between 1 to 1000/rows

  • :facets (String)

    The comma separated list of fields for which facets are requested. Supported fields are - year, make, model, trim, vehicle_type, car_type, body_type, body_subtype, drivetrain, cylinders, transmission, exterior_color, interior_color. Facets could be requested in addition to the listings for the search. Please note - The API calls with lots of facet fields may take longer to respond.

  • :stats (String)

    The list of fields for which stats need to be generated based on the matching listings for the search criteria. Allowed fields are - price, miles, msrp, dom The stats consists of mean, max, average and count of listings based on which the stats are calculated for the field. Stats could be requested in addition to the listings for the search. Please note - The API calls with the stats fields may take longer to respond.

Returns:



321
322
323
324
# File 'lib/swagger_client/api/listings_api.rb', line 321

def search(api_key, latitude, longitude, radius, car_type, opts = {})
  data, status_code, headers = search_with_http_info(api_key, latitude, longitude, radius, car_type, opts)
  return data
end

#search_with_http_info(api_key, latitude, longitude, radius, car_type, opts = {}) ⇒ Array<(SearchResponse, Fixnum, Hash)>

Gets active car listings for the given search criteria This endpoint is the meat of the API and serves many purposes. This API produces a list of currently active cars from the market for the given search criteria. The API results are limited to allow pagination upto 1000 rows. n The search API facilitates the following use cases - n1. Search Cars around a given geo-point within a given radius n2. Search cars for a specific year / make / model or combination of these n3. Search cars matching multiple year, make, model combinatins in the same search requestn4. Filter results by most car specification attributesn5. Search for similar cars by VIN or Taxonomy VIN n6. Filter cars within a given price / miles / days on market (dom) rangen7. Specify a sort order for the results on price / miles / dom / listed date n8. Search cars for a given City / State combination n9. Get Facets to build the search drill downs n10. Get Market averages for price/miles/dom/msrp for your search

Parameters:

  • api_key

    The API Authentication Key. Mandatory with all API calls.

  • latitude

    Latitude component of location

  • longitude

    Longitude component of location

  • radius

    Radius around the search location

  • car_type

    Car type. Allowed values are - new / used / certified

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

    the optional parameters

Options Hash (opts):

  • :year (String)

    Car year - 1980 onwards. You can pass in multiple year separated by comma e.g. 2010,2011

  • :make (String)

    Car Make - should be a standard OEM Make name

  • :model (String)

    Car model to search

  • :trim (String)

    Car trim to search

  • :dealer_id (String)

    Dealer id to filter the cars

  • :body_type (String)

    Body type to filter the cars on

  • :body_subtype (String)

    Body subtype to filter the cars on

  • :vehicle_type (String)

    Vehicle type to filter the cars on

  • :vins (String)

    Comma separated list of 17 digit vins to search the matching cars for. Only 10 VINs allowed per request. If the request contains more than 10 VINs the first 10 VINs will be considered. Could be used as a More Like This or Similar Vehicles search for the given VINs. Ths vins parameter is an alternative to taxonomy_vins or ymmt parameters available with the search API. vins and taxonomy_vins parameters could be used to filter our cars with the exact build represented by the vins or taxonomy_vins whereas ymmt is a top level filter that does not filter cars by the build attributes like doors, drivetrain, cylinders, body type, body subtype, vehicle type etc

  • :taxonomy_vins (String)

    Comma separated list of 10 letters excert from the 17 letter VIN. The 10 letters to be picked up from the 17 letter VIN are - first 8 letters and the 10th and 11th letter. E.g. For a VIN - 1FTFW1EF3EKE57182 the taxonomy vin would be - 1FTFW1EFEK A taxonomy VIN identified a build of a car and could be used to filter our cars of a particular build. This is an alternative to the vin or ymmt parameters to the search API.

  • :ymmt (String)

    Comma separated list of Year, Make, Model, Trim combinations. Each combination needs to have the year,make,model, trim values separated by a pipe &#39;|&#39; character in the form year|make|model|trim. e.g. 2010|Audi|A5,2014|Nissan|Sentra|S 6MT,|Honda|City| You could just provide strings of the form - &#39;year|make||&#39; or &#39;year|make|model&#39; or &#39;|make|model|&#39; combinations. Individual year / make / model filters provied with the API calls will take precedence over the Year, Make, Model, Trim combinations. The Make, Model, Trim values must be valid values as per the Marketcheck Vin Decoder. If you are using a separate vin decoder then look at using the &#39;vins&#39; or &#39;taxonomy_vins&#39; parameter to the search api instead the year|make|model|trim combinations.

  • :cylinders (String)

    Cylinders to filter the cars on

  • :transmission (String)

    Transmission to filter the cars on. [a = Automatic, m = Manual]

  • :drivetrain (String)

    Drivetrain to filter the cars on.

  • :exterior_color (String)

    Exterior color to match

  • :interior_color (String)

    Interior color to match

  • :miles_range (String)

    Miles range to filter cars with miles in the given range. Range to be given in the format - min-max e.g. 1000-5000

  • :price_range (String)

    Price range to filter cars with the price in the range given. Range to be given in the format - min-max e.g. 1000-5000

  • :dom_range (String)

    Days on Market range to filter cars with the DOM within the given range. Range to be given in the format - min-max e.g. 10-50

  • :sort_by (String)

    Sort by field - allowed fields are distance|price|miles|dom|age|posted_at|year. Default sort field is distance from the given point

  • :sort_order (String)

    Sort order - asc or desc. Default sort order is distance from a point.

  • :rows (String)

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

  • :start (String)

    Page number to fetch the results for the given criteria. Default is 1. Pagination is allowed only till first 1000 results for the search and sort criteria. The page value can be only between 1 to 1000/rows

  • :facets (String)

    The comma separated list of fields for which facets are requested. Supported fields are - year, make, model, trim, vehicle_type, car_type, body_type, body_subtype, drivetrain, cylinders, transmission, exterior_color, interior_color. Facets could be requested in addition to the listings for the search. Please note - The API calls with lots of facet fields may take longer to respond.

  • :stats (String)

    The list of fields for which stats need to be generated based on the matching listings for the search criteria. Allowed fields are - price, miles, msrp, dom The stats consists of mean, max, average and count of listings based on which the stats are calculated for the field. Stats could be requested in addition to the listings for the search. Please note - The API calls with the stats fields may take longer to respond.

Returns:

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

    SearchResponse data, response status code and response headers



360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
# File 'lib/swagger_client/api/listings_api.rb', line 360

def search_with_http_info(api_key, latitude, longitude, radius, car_type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ListingsApi#search ..."
  end
  
  # verify the required parameter 'api_key' is set
  fail "Missing the required parameter 'api_key' when calling search" if api_key.nil?
  
  # verify the required parameter 'latitude' is set
  fail "Missing the required parameter 'latitude' when calling search" if latitude.nil?
  
  # verify the required parameter 'longitude' is set
  fail "Missing the required parameter 'longitude' when calling search" if longitude.nil?
  
  # verify the required parameter 'radius' is set
  fail "Missing the required parameter 'radius' when calling search" if radius.nil?
  
  # verify the required parameter 'car_type' is set
  fail "Missing the required parameter 'car_type' when calling search" if car_type.nil?
  unless ['new', 'used', 'certified'].include?(car_type)
    fail "invalid value for 'car_type', must be one of new, used, certified"
  end
  
  if opts[:'body_type'] && !['suv', 'sedan', 'pickup', 'minivan', 'coupe', 'hatchback', 'convertible', 'wagon', 'crossover', 'chassis', 'liftback'].include?(opts[:'body_type'])
    fail 'invalid value for "body_type", must be one of suv, sedan, pickup, minivan, coupe, hatchback, convertible, wagon, crossover, chassis, liftback'
  end
  
  if opts[:'body_subtype'] && !['crew cab', 'quad cab', 'extended cab', 'double cab', 'regular cab', 'super cab', 'mega cab', 'king cab', 'supercab'].include?(opts[:'body_subtype'])
    fail 'invalid value for "body_subtype", must be one of crew cab, quad cab, extended cab, double cab, regular cab, super cab, mega cab, king cab', 'supercab'
  end
  
  if opts[:'vehicle_type'] && !['suv', 'truck', 'car', 'van'].include?(opts[:'vehicle_type'])
    fail 'invalid value for "vehicle_type", must be one of suv, truck, car, van'
  end
  
  if opts[:'cylinders'] && !['0', '3', '4', '5', '6', '8', '10', '12', '16'].include?(opts[:'cylinders'])
    fail 'invalid value for "cylinders", must be one of 0, 3, 4, 5, 6, 8, 10, 12, 16'
  end
  
  if opts[:'transmission'] && !['a', 'm'].include?(opts[:'transmission'])
    fail 'invalid value for "transmission", must be one of a, m'
  end
  
  if opts[:'drivetrain'] && !['4wd', '2wd', 'awd', 'fwd', 'rwd', '4x2', '4x4'].include?(opts[:'drivetrain'])
    fail 'invalid value for "drivetrain", must be one of 4wd, 2wd, awd, fwd, rwd, 4x2, 4x4'
  end
  
  # resource path
  local_var_path = "/search".sub('{format}','json')

  # query parameters
  query_params = {}
  query_params[:'api_key'] = api_key
  query_params[:'latitude'] = latitude
  query_params[:'longitude'] = longitude
  query_params[:'radius'] = radius
  query_params[:'car_type'] = car_type
  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[:'dealer_id'] = opts[:'dealer_id'] if opts[:'dealer_id']
  query_params[:'body_type'] = opts[:'body_type'] if opts[:'body_type']
  query_params[:'body_subtype'] = opts[:'body_subtype'] if opts[:'body_subtype']
  query_params[:'vehicle_type'] = opts[:'vehicle_type'] if opts[:'vehicle_type']
  query_params[:'vins'] = opts[:'vins'] if opts[:'vins']
  query_params[:'taxonomy_vins'] = opts[:'taxonomy_vins'] if opts[:'taxonomy_vins']
  query_params[:'ymmt'] = opts[:'ymmt'] if opts[:'ymmt']
  query_params[:'cylinders'] = opts[:'cylinders'] if opts[:'cylinders']
  query_params[:'transmission'] = opts[:'transmission'] if opts[:'transmission']
  query_params[:'drivetrain'] = opts[:'drivetrain'] if opts[:'drivetrain']
  query_params[:'exterior_color'] = opts[:'exterior_color'] if opts[:'exterior_color']
  query_params[:'interior_color'] = opts[:'interior_color'] if opts[:'interior_color']
  query_params[:'miles_range'] = opts[:'miles_range'] if opts[:'miles_range']
  query_params[:'price_range'] = opts[:'price_range'] if opts[:'price_range']
  query_params[:'dom_range'] = opts[:'dom_range'] if opts[:'dom_range']
  query_params[:'sort_by'] = opts[:'sort_by'] if opts[:'sort_by']
  query_params[:'sort_order'] = opts[:'sort_order'] if opts[:'sort_order']
  query_params[:'rows'] = opts[:'rows'] if opts[:'rows']
  query_params[:'start'] = opts[:'start'] if opts[:'start']
  query_params[:'facets'] = opts[:'facets'] if opts[:'facets']
  query_params[:'stats'] = opts[:'stats'] if opts[:'stats']

  # 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 => 'SearchResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ListingsApi#search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end