marketcheck_ruby_client 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +133 -0
  3. data/docs/Averages.md +13 -0
  4. data/docs/BaseListing.md +27 -0
  5. data/docs/Build.md +19 -0
  6. data/docs/Dealer.md +23 -0
  7. data/docs/DealerApi.md +230 -0
  8. data/docs/Error.md +9 -0
  9. data/docs/FacetItem.md +9 -0
  10. data/docs/FacetsApi.md +71 -0
  11. data/docs/GraphsApi.md +73 -0
  12. data/docs/HistoricalListing.md +19 -0
  13. data/docs/HistoryApi.md +65 -0
  14. data/docs/InventoryApi.md +113 -0
  15. data/docs/Listing.md +23 -0
  16. data/docs/ListingDebugAttributes.md +13 -0
  17. data/docs/ListingExtraAttributes.md +10 -0
  18. data/docs/ListingMedia.md +9 -0
  19. data/docs/ListingVDP.md +10 -0
  20. data/docs/ListingsApi.md +324 -0
  21. data/docs/Location.md +12 -0
  22. data/docs/MakeModel.md +9 -0
  23. data/docs/MarketAveragesApi.md +70 -0
  24. data/docs/MarketTrendsApi.md +72 -0
  25. data/docs/PlotPoint.md +14 -0
  26. data/docs/SearchResponse.md +9 -0
  27. data/docs/TrendPoint.md +12 -0
  28. data/docs/VINDecoderApi.md +59 -0
  29. data/git_push.sh +52 -0
  30. data/lib/marketcheck_ruby_client.rb +65 -0
  31. data/lib/swagger_client/api/dealer_api.rb +312 -0
  32. data/lib/swagger_client/api/facets_api.rb +105 -0
  33. data/lib/swagger_client/api/graphs_api.rb +108 -0
  34. data/lib/swagger_client/api/history_api.rb +95 -0
  35. data/lib/swagger_client/api/inventory_api.rb +155 -0
  36. data/lib/swagger_client/api/listings_api.rb +474 -0
  37. data/lib/swagger_client/api/market_averages_api.rb +102 -0
  38. data/lib/swagger_client/api/market_trends_api.rb +108 -0
  39. data/lib/swagger_client/api/vin_decoder_api.rb +89 -0
  40. data/lib/swagger_client/api_client.rb +332 -0
  41. data/lib/swagger_client/api_error.rb +36 -0
  42. data/lib/swagger_client/configuration.rb +163 -0
  43. data/lib/swagger_client/models/averages.rb +217 -0
  44. data/lib/swagger_client/models/base_listing.rb +370 -0
  45. data/lib/swagger_client/models/build.rb +284 -0
  46. data/lib/swagger_client/models/dealer.rb +329 -0
  47. data/lib/swagger_client/models/error.rb +173 -0
  48. data/lib/swagger_client/models/facet_item.rb +173 -0
  49. data/lib/swagger_client/models/historical_listing.rb +284 -0
  50. data/lib/swagger_client/models/listing.rb +327 -0
  51. data/lib/swagger_client/models/listing_debug_attributes.rb +217 -0
  52. data/lib/swagger_client/models/listing_extra_attributes.rb +188 -0
  53. data/lib/swagger_client/models/listing_media.rb +175 -0
  54. data/lib/swagger_client/models/listing_vdp.rb +185 -0
  55. data/lib/swagger_client/models/location.rb +207 -0
  56. data/lib/swagger_client/models/make_model.rb +171 -0
  57. data/lib/swagger_client/models/plot_point.rb +228 -0
  58. data/lib/swagger_client/models/search_response.rb +175 -0
  59. data/lib/swagger_client/models/trend_point.rb +206 -0
  60. data/lib/swagger_client/version.rb +15 -0
  61. data/marketcheck_ruby_client-1.0.6.gem +0 -0
  62. data/marketcheck_ruby_client.gemspec +32 -0
  63. data/spec/api/dealer_api_spec.rb +109 -0
  64. data/spec/api/facets_api_spec.rb +57 -0
  65. data/spec/api/graphs_api_spec.rb +58 -0
  66. data/spec/api/history_api_spec.rb +54 -0
  67. data/spec/api/inventory_api_spec.rb +70 -0
  68. data/spec/api/listings_api_spec.rb +148 -0
  69. data/spec/api/market_averages_api_spec.rb +57 -0
  70. data/spec/api/market_trends_api_spec.rb +57 -0
  71. data/spec/api/vin_decoder_api_spec.rb +52 -0
  72. data/spec/models/averages_spec.rb +96 -0
  73. data/spec/models/base_listing_spec.rb +236 -0
  74. data/spec/models/build_spec.rb +156 -0
  75. data/spec/models/dealer_spec.rb +196 -0
  76. data/spec/models/error_spec.rb +56 -0
  77. data/spec/models/facet_item_spec.rb +56 -0
  78. data/spec/models/historical_listing_spec.rb +156 -0
  79. data/spec/models/listing_debug_attributes_spec.rb +96 -0
  80. data/spec/models/listing_extra_attributes_spec.rb +66 -0
  81. data/spec/models/listing_media_spec.rb +56 -0
  82. data/spec/models/listing_spec.rb +196 -0
  83. data/spec/models/listing_vdp_spec.rb +66 -0
  84. data/spec/models/location_spec.rb +86 -0
  85. data/spec/models/make_model_spec.rb +56 -0
  86. data/spec/models/plot_point_spec.rb +106 -0
  87. data/spec/models/search_response_spec.rb +56 -0
  88. data/spec/models/trend_point_spec.rb +86 -0
  89. metadata +337 -0
@@ -0,0 +1,474 @@
1
+ =begin
2
+ Marketcheck Cars API
3
+
4
+ <b>Access the New, Used and Certified cars inventories for all Car Dealers in US.</b> <br/>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 <a href='http://www.marketcheck.com' target='_blank'>www.marketcheck.com</a> and our Android and iOS mobile apps too.<br/><h5> Few useful links : </h5><ul><li>A quick view of the API and the use cases is depicated <a href='https://portals.marketcheck.com/mcapi/' target='_blank'>here</a></li><li>The Postman collection with various usages of the API is shared here https://www.getpostman.com/collections/2752684ff636cdd7bac2</li><li> [Coming soon] API Key : Request your API Key <a href='https://portals.marketcheck.com/api' target='_blank'> here </a> </li><li> [Coming soon] Benchmarks : See the API benchmarks <a href='https://portals.marketcheck.com/mcapi/benchmarks'>here</a></li></ul>
5
+
6
+ OpenAPI spec version: 1.0.3
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+
11
+ =end
12
+
13
+ require "uri"
14
+
15
+ module SwaggerClient
16
+ class ListingsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+ # Listing by id
24
+ # Get a particular listing by its id
25
+ # @param api_key The API Authentication Key. Mandatory with all API calls.
26
+ # @param id Listing id to get all the listing attributes
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [Listing]
29
+ def get_listing(api_key, id, opts = {})
30
+ data, status_code, headers = get_listing_with_http_info(api_key, id, opts)
31
+ return data
32
+ end
33
+
34
+ # Listing by id
35
+ # Get a particular listing by its id
36
+ # @param api_key The API Authentication Key. Mandatory with all API calls.
37
+ # @param id Listing id to get all the listing attributes
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [Array<(Listing, Fixnum, Hash)>] Listing data, response status code and response headers
40
+ def get_listing_with_http_info(api_key, id, opts = {})
41
+ if @api_client.config.debugging
42
+ @api_client.config.logger.debug "Calling API: ListingsApi#get_listing ..."
43
+ end
44
+
45
+ # verify the required parameter 'api_key' is set
46
+ fail "Missing the required parameter 'api_key' when calling get_listing" if api_key.nil?
47
+
48
+ # verify the required parameter 'id' is set
49
+ fail "Missing the required parameter 'id' when calling get_listing" if id.nil?
50
+
51
+ # resource path
52
+ local_var_path = "/listing/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
53
+
54
+ # query parameters
55
+ query_params = {}
56
+ query_params[:'api_key'] = api_key
57
+
58
+ # header parameters
59
+ header_params = {}
60
+
61
+ # HTTP header 'Accept' (if needed)
62
+ _header_accept = ['application/json']
63
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
64
+
65
+ # HTTP header 'Content-Type'
66
+ _header_content_type = []
67
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
68
+
69
+ # form parameters
70
+ form_params = {}
71
+
72
+ # http body (model)
73
+ post_body = nil
74
+
75
+ auth_names = []
76
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
77
+ :header_params => header_params,
78
+ :query_params => query_params,
79
+ :form_params => form_params,
80
+ :body => post_body,
81
+ :auth_names => auth_names,
82
+ :return_type => 'Listing')
83
+ if @api_client.config.debugging
84
+ @api_client.config.logger.debug "API called: ListingsApi#get_listing\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
85
+ end
86
+ return data, status_code, headers
87
+ end
88
+
89
+ # Long text Listings attributes for Listing with the given id
90
+ # Get listing options, features, seller comments
91
+ # @param api_key The API Authentication Key. Mandatory with all API calls.
92
+ # @param id Listing id to get all the long text listing attributes
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [ListingExtraAttributes]
95
+ def get_listing_extra(api_key, id, opts = {})
96
+ data, status_code, headers = get_listing_extra_with_http_info(api_key, id, opts)
97
+ return data
98
+ end
99
+
100
+ # Long text Listings attributes for Listing with the given id
101
+ # Get listing options, features, seller comments
102
+ # @param api_key The API Authentication Key. Mandatory with all API calls.
103
+ # @param id Listing id to get all the long text listing attributes
104
+ # @param [Hash] opts the optional parameters
105
+ # @return [Array<(ListingExtraAttributes, Fixnum, Hash)>] ListingExtraAttributes data, response status code and response headers
106
+ def get_listing_extra_with_http_info(api_key, id, opts = {})
107
+ if @api_client.config.debugging
108
+ @api_client.config.logger.debug "Calling API: ListingsApi#get_listing_extra ..."
109
+ end
110
+
111
+ # verify the required parameter 'api_key' is set
112
+ fail "Missing the required parameter 'api_key' when calling get_listing_extra" if api_key.nil?
113
+
114
+ # verify the required parameter 'id' is set
115
+ fail "Missing the required parameter 'id' when calling get_listing_extra" if id.nil?
116
+
117
+ # resource path
118
+ local_var_path = "/listing/{id}/extra".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
119
+
120
+ # query parameters
121
+ query_params = {}
122
+ query_params[:'api_key'] = api_key
123
+
124
+ # header parameters
125
+ header_params = {}
126
+
127
+ # HTTP header 'Accept' (if needed)
128
+ _header_accept = ['application/json']
129
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
130
+
131
+ # HTTP header 'Content-Type'
132
+ _header_content_type = []
133
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
134
+
135
+ # form parameters
136
+ form_params = {}
137
+
138
+ # http body (model)
139
+ post_body = nil
140
+
141
+ auth_names = []
142
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
143
+ :header_params => header_params,
144
+ :query_params => query_params,
145
+ :form_params => form_params,
146
+ :body => post_body,
147
+ :auth_names => auth_names,
148
+ :return_type => 'ListingExtraAttributes')
149
+ if @api_client.config.debugging
150
+ @api_client.config.logger.debug "API called: ListingsApi#get_listing_extra\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
151
+ end
152
+ return data, status_code, headers
153
+ end
154
+
155
+ # Listing media by id
156
+ # Get listing media (photo, photos) by id
157
+ # @param api_key The API Authentication Key. Mandatory with all API calls.
158
+ # @param id Listing id to get all the listing attributes
159
+ # @param [Hash] opts the optional parameters
160
+ # @return [ListingMedia]
161
+ def get_listing_media(api_key, id, opts = {})
162
+ data, status_code, headers = get_listing_media_with_http_info(api_key, id, opts)
163
+ return data
164
+ end
165
+
166
+ # Listing media by id
167
+ # Get listing media (photo, photos) by id
168
+ # @param api_key The API Authentication Key. Mandatory with all API calls.
169
+ # @param id Listing id to get all the listing attributes
170
+ # @param [Hash] opts the optional parameters
171
+ # @return [Array<(ListingMedia, Fixnum, Hash)>] ListingMedia data, response status code and response headers
172
+ def get_listing_media_with_http_info(api_key, id, opts = {})
173
+ if @api_client.config.debugging
174
+ @api_client.config.logger.debug "Calling API: ListingsApi#get_listing_media ..."
175
+ end
176
+
177
+ # verify the required parameter 'api_key' is set
178
+ fail "Missing the required parameter 'api_key' when calling get_listing_media" if api_key.nil?
179
+
180
+ # verify the required parameter 'id' is set
181
+ fail "Missing the required parameter 'id' when calling get_listing_media" if id.nil?
182
+
183
+ # resource path
184
+ local_var_path = "/listing/{id}/media".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
185
+
186
+ # query parameters
187
+ query_params = {}
188
+ query_params[:'api_key'] = api_key
189
+
190
+ # header parameters
191
+ header_params = {}
192
+
193
+ # HTTP header 'Accept' (if needed)
194
+ _header_accept = ['application/json']
195
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
196
+
197
+ # HTTP header 'Content-Type'
198
+ _header_content_type = []
199
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
200
+
201
+ # form parameters
202
+ form_params = {}
203
+
204
+ # http body (model)
205
+ post_body = nil
206
+
207
+ auth_names = []
208
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
209
+ :header_params => header_params,
210
+ :query_params => query_params,
211
+ :form_params => form_params,
212
+ :body => post_body,
213
+ :auth_names => auth_names,
214
+ :return_type => 'ListingMedia')
215
+ if @api_client.config.debugging
216
+ @api_client.config.logger.debug "API called: ListingsApi#get_listing_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
217
+ end
218
+ return data, status_code, headers
219
+ end
220
+
221
+ # Get listing HTML
222
+ # 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
223
+ # @param api_key The API Authentication Key. Mandatory with all API calls.
224
+ # @param id Listing id to get the vehicle details page (VDP) HTML
225
+ # @param [Hash] opts the optional parameters
226
+ # @return [ListingVDP]
227
+ def get_listing_vdp(api_key, id, opts = {})
228
+ data, status_code, headers = get_listing_vdp_with_http_info(api_key, id, opts)
229
+ return data
230
+ end
231
+
232
+ # Get listing HTML
233
+ # 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
234
+ # @param api_key The API Authentication Key. Mandatory with all API calls.
235
+ # @param id Listing id to get the vehicle details page (VDP) HTML
236
+ # @param [Hash] opts the optional parameters
237
+ # @return [Array<(ListingVDP, Fixnum, Hash)>] ListingVDP data, response status code and response headers
238
+ def get_listing_vdp_with_http_info(api_key, id, opts = {})
239
+ if @api_client.config.debugging
240
+ @api_client.config.logger.debug "Calling API: ListingsApi#get_listing_vdp ..."
241
+ end
242
+
243
+ # verify the required parameter 'api_key' is set
244
+ fail "Missing the required parameter 'api_key' when calling get_listing_vdp" if api_key.nil?
245
+
246
+ # verify the required parameter 'id' is set
247
+ fail "Missing the required parameter 'id' when calling get_listing_vdp" if id.nil?
248
+
249
+ # resource path
250
+ local_var_path = "/listing/{id}/vdp".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)
251
+
252
+ # query parameters
253
+ query_params = {}
254
+ query_params[:'api_key'] = api_key
255
+
256
+ # header parameters
257
+ header_params = {}
258
+
259
+ # HTTP header 'Accept' (if needed)
260
+ _header_accept = ['application/json']
261
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
262
+
263
+ # HTTP header 'Content-Type'
264
+ _header_content_type = []
265
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
266
+
267
+ # form parameters
268
+ form_params = {}
269
+
270
+ # http body (model)
271
+ post_body = nil
272
+
273
+ auth_names = []
274
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
275
+ :header_params => header_params,
276
+ :query_params => query_params,
277
+ :form_params => form_params,
278
+ :body => post_body,
279
+ :auth_names => auth_names,
280
+ :return_type => 'ListingVDP')
281
+ if @api_client.config.debugging
282
+ @api_client.config.logger.debug "API called: ListingsApi#get_listing_vdp\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
283
+ end
284
+ return data, status_code, headers
285
+ end
286
+
287
+ # Gets active car listings for the given search criteria
288
+ # 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 request\n4. Filter results by most car specification attributes\n5. Search for similar cars by VIN or Taxonomy VIN \n6. Filter cars within a given price / miles / days on market (dom) range\n7. 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
289
+ # @param api_key The API Authentication Key. Mandatory with all API calls.
290
+ # @param latitude Latitude component of location
291
+ # @param longitude Longitude component of location
292
+ # @param radius Radius around the search location
293
+ # @param car_type Car type. Allowed values are - new / used / certified
294
+ # @param [Hash] opts the optional parameters
295
+ # @option opts [String] :year Car year - 1980 onwards. You can pass in multiple year separated by comma e.g. 2010,2011
296
+ # @option opts [String] :make Car Make - should be a standard OEM Make name
297
+ # @option opts [String] :model Car model to search
298
+ # @option opts [String] :trim Car trim to search
299
+ # @option opts [String] :dealer_id Dealer id to filter the cars
300
+ # @option opts [String] :body_type Body type to filter the cars on
301
+ # @option opts [String] :body_subtype Body subtype to filter the cars on
302
+ # @option opts [String] :vehicle_type Vehicle type to filter the cars on
303
+ # @option opts [String] :vins 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
304
+ # @option opts [String] :taxonomy_vins 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.
305
+ # @option opts [String] :ymmt 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.
306
+ # @option opts [String] :cylinders Cylinders to filter the cars on
307
+ # @option opts [String] :transmission Transmission to filter the cars on. [a = Automatic, m = Manual]
308
+ # @option opts [String] :drivetrain Drivetrain to filter the cars on.
309
+ # @option opts [String] :exterior_color Exterior color to match
310
+ # @option opts [String] :interior_color Interior color to match
311
+ # @option opts [String] :miles_range Miles range to filter cars with miles in the given range. Range to be given in the format - min-max e.g. 1000-5000
312
+ # @option opts [String] :price_range 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
313
+ # @option opts [String] :dom_range 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
314
+ # @option opts [String] :sort_by Sort by field - allowed fields are distance|price|miles|dom|age|posted_at|year. Default sort field is distance from the given point
315
+ # @option opts [String] :sort_order Sort order - asc or desc. Default sort order is distance from a point.
316
+ # @option opts [String] :rows Number of results to return. Default is 10. Max is 50
317
+ # @option opts [String] :start 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
318
+ # @option opts [String] :facets 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.
319
+ # @option opts [String] :stats 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.
320
+ # @return [SearchResponse]
321
+ def search(api_key, latitude, longitude, radius, car_type, opts = {})
322
+ data, status_code, headers = search_with_http_info(api_key, latitude, longitude, radius, car_type, opts)
323
+ return data
324
+ end
325
+
326
+ # Gets active car listings for the given search criteria
327
+ # 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 request\n4. Filter results by most car specification attributes\n5. Search for similar cars by VIN or Taxonomy VIN \n6. Filter cars within a given price / miles / days on market (dom) range\n7. 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
328
+ # @param api_key The API Authentication Key. Mandatory with all API calls.
329
+ # @param latitude Latitude component of location
330
+ # @param longitude Longitude component of location
331
+ # @param radius Radius around the search location
332
+ # @param car_type Car type. Allowed values are - new / used / certified
333
+ # @param [Hash] opts the optional parameters
334
+ # @option opts [String] :year Car year - 1980 onwards. You can pass in multiple year separated by comma e.g. 2010,2011
335
+ # @option opts [String] :make Car Make - should be a standard OEM Make name
336
+ # @option opts [String] :model Car model to search
337
+ # @option opts [String] :trim Car trim to search
338
+ # @option opts [String] :dealer_id Dealer id to filter the cars
339
+ # @option opts [String] :body_type Body type to filter the cars on
340
+ # @option opts [String] :body_subtype Body subtype to filter the cars on
341
+ # @option opts [String] :vehicle_type Vehicle type to filter the cars on
342
+ # @option opts [String] :vins 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
343
+ # @option opts [String] :taxonomy_vins 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.
344
+ # @option opts [String] :ymmt 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.
345
+ # @option opts [String] :cylinders Cylinders to filter the cars on
346
+ # @option opts [String] :transmission Transmission to filter the cars on. [a = Automatic, m = Manual]
347
+ # @option opts [String] :drivetrain Drivetrain to filter the cars on.
348
+ # @option opts [String] :exterior_color Exterior color to match
349
+ # @option opts [String] :interior_color Interior color to match
350
+ # @option opts [String] :miles_range Miles range to filter cars with miles in the given range. Range to be given in the format - min-max e.g. 1000-5000
351
+ # @option opts [String] :price_range 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
352
+ # @option opts [String] :dom_range 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
353
+ # @option opts [String] :sort_by Sort by field - allowed fields are distance|price|miles|dom|age|posted_at|year. Default sort field is distance from the given point
354
+ # @option opts [String] :sort_order Sort order - asc or desc. Default sort order is distance from a point.
355
+ # @option opts [String] :rows Number of results to return. Default is 10. Max is 50
356
+ # @option opts [String] :start 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
357
+ # @option opts [String] :facets 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.
358
+ # @option opts [String] :stats 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.
359
+ # @return [Array<(SearchResponse, Fixnum, Hash)>] SearchResponse data, response status code and response headers
360
+ def search_with_http_info(api_key, latitude, longitude, radius, car_type, opts = {})
361
+ if @api_client.config.debugging
362
+ @api_client.config.logger.debug "Calling API: ListingsApi#search ..."
363
+ end
364
+
365
+ # verify the required parameter 'api_key' is set
366
+ fail "Missing the required parameter 'api_key' when calling search" if api_key.nil?
367
+
368
+ # verify the required parameter 'latitude' is set
369
+ fail "Missing the required parameter 'latitude' when calling search" if latitude.nil?
370
+
371
+ # verify the required parameter 'longitude' is set
372
+ fail "Missing the required parameter 'longitude' when calling search" if longitude.nil?
373
+
374
+ # verify the required parameter 'radius' is set
375
+ fail "Missing the required parameter 'radius' when calling search" if radius.nil?
376
+
377
+ # verify the required parameter 'car_type' is set
378
+ fail "Missing the required parameter 'car_type' when calling search" if car_type.nil?
379
+ unless ['new', 'used', 'certified'].include?(car_type)
380
+ fail "invalid value for 'car_type', must be one of new, used, certified"
381
+ end
382
+
383
+ if opts[:'body_type'] && !['suv', 'sedan', 'pickup', 'minivan', 'coupe', 'hatchback', 'convertible', 'wagon', 'crossover', 'chassis', 'liftback'].include?(opts[:'body_type'])
384
+ fail 'invalid value for "body_type", must be one of suv, sedan, pickup, minivan, coupe, hatchback, convertible, wagon, crossover, chassis, liftback'
385
+ end
386
+
387
+ 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'])
388
+ 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'
389
+ end
390
+
391
+ if opts[:'vehicle_type'] && !['suv', 'truck', 'car', 'van'].include?(opts[:'vehicle_type'])
392
+ fail 'invalid value for "vehicle_type", must be one of suv, truck, car, van'
393
+ end
394
+
395
+ if opts[:'cylinders'] && !['0', '3', '4', '5', '6', '8', '10', '12', '16'].include?(opts[:'cylinders'])
396
+ fail 'invalid value for "cylinders", must be one of 0, 3, 4, 5, 6, 8, 10, 12, 16'
397
+ end
398
+
399
+ if opts[:'transmission'] && !['a', 'm'].include?(opts[:'transmission'])
400
+ fail 'invalid value for "transmission", must be one of a, m'
401
+ end
402
+
403
+ if opts[:'drivetrain'] && !['4wd', '2wd', 'awd', 'fwd', 'rwd', '4x2', '4x4'].include?(opts[:'drivetrain'])
404
+ fail 'invalid value for "drivetrain", must be one of 4wd, 2wd, awd, fwd, rwd, 4x2, 4x4'
405
+ end
406
+
407
+ # resource path
408
+ local_var_path = "/search".sub('{format}','json')
409
+
410
+ # query parameters
411
+ query_params = {}
412
+ query_params[:'api_key'] = api_key
413
+ query_params[:'latitude'] = latitude
414
+ query_params[:'longitude'] = longitude
415
+ query_params[:'radius'] = radius
416
+ query_params[:'car_type'] = car_type
417
+ query_params[:'year'] = opts[:'year'] if opts[:'year']
418
+ query_params[:'make'] = opts[:'make'] if opts[:'make']
419
+ query_params[:'model'] = opts[:'model'] if opts[:'model']
420
+ query_params[:'trim'] = opts[:'trim'] if opts[:'trim']
421
+ query_params[:'dealer_id'] = opts[:'dealer_id'] if opts[:'dealer_id']
422
+ query_params[:'body_type'] = opts[:'body_type'] if opts[:'body_type']
423
+ query_params[:'body_subtype'] = opts[:'body_subtype'] if opts[:'body_subtype']
424
+ query_params[:'vehicle_type'] = opts[:'vehicle_type'] if opts[:'vehicle_type']
425
+ query_params[:'vins'] = opts[:'vins'] if opts[:'vins']
426
+ query_params[:'taxonomy_vins'] = opts[:'taxonomy_vins'] if opts[:'taxonomy_vins']
427
+ query_params[:'ymmt'] = opts[:'ymmt'] if opts[:'ymmt']
428
+ query_params[:'cylinders'] = opts[:'cylinders'] if opts[:'cylinders']
429
+ query_params[:'transmission'] = opts[:'transmission'] if opts[:'transmission']
430
+ query_params[:'drivetrain'] = opts[:'drivetrain'] if opts[:'drivetrain']
431
+ query_params[:'exterior_color'] = opts[:'exterior_color'] if opts[:'exterior_color']
432
+ query_params[:'interior_color'] = opts[:'interior_color'] if opts[:'interior_color']
433
+ query_params[:'miles_range'] = opts[:'miles_range'] if opts[:'miles_range']
434
+ query_params[:'price_range'] = opts[:'price_range'] if opts[:'price_range']
435
+ query_params[:'dom_range'] = opts[:'dom_range'] if opts[:'dom_range']
436
+ query_params[:'sort_by'] = opts[:'sort_by'] if opts[:'sort_by']
437
+ query_params[:'sort_order'] = opts[:'sort_order'] if opts[:'sort_order']
438
+ query_params[:'rows'] = opts[:'rows'] if opts[:'rows']
439
+ query_params[:'start'] = opts[:'start'] if opts[:'start']
440
+ query_params[:'facets'] = opts[:'facets'] if opts[:'facets']
441
+ query_params[:'stats'] = opts[:'stats'] if opts[:'stats']
442
+
443
+ # header parameters
444
+ header_params = {}
445
+
446
+ # HTTP header 'Accept' (if needed)
447
+ _header_accept = ['application/json']
448
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
449
+
450
+ # HTTP header 'Content-Type'
451
+ _header_content_type = []
452
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
453
+
454
+ # form parameters
455
+ form_params = {}
456
+
457
+ # http body (model)
458
+ post_body = nil
459
+
460
+ auth_names = []
461
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
462
+ :header_params => header_params,
463
+ :query_params => query_params,
464
+ :form_params => form_params,
465
+ :body => post_body,
466
+ :auth_names => auth_names,
467
+ :return_type => 'SearchResponse')
468
+ if @api_client.config.debugging
469
+ @api_client.config.logger.debug "API called: ListingsApi#search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
470
+ end
471
+ return data, status_code, headers
472
+ end
473
+ end
474
+ end