marketcheck_ruby_client 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,36 @@
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
+ module SwaggerClient
14
+ class ApiError < StandardError
15
+ attr_reader :code, :response_headers, :response_body
16
+
17
+ # Usage examples:
18
+ # ApiError.new
19
+ # ApiError.new("message")
20
+ # ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
21
+ # ApiError.new(:code => 404, :message => "Not Found")
22
+ def initialize(arg = nil)
23
+ if arg.is_a? Hash
24
+ arg.each do |k, v|
25
+ if k.to_s == 'message'
26
+ super v
27
+ else
28
+ instance_variable_set "@#{k}", v
29
+ end
30
+ end
31
+ else
32
+ super arg
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,163 @@
1
+ require 'uri'
2
+
3
+ module SwaggerClient
4
+ class Configuration
5
+ # Defines url scheme
6
+ attr_accessor :scheme
7
+
8
+ # Defines url host
9
+ attr_accessor :host
10
+
11
+ # Defines url base path
12
+ attr_accessor :base_path
13
+
14
+ # Defines API keys used with API Key authentications.
15
+ #
16
+ # @return [Hash] key: parameter name, value: parameter value (API key)
17
+ #
18
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
19
+ # config.api_key['api_key'] = 'xxx'
20
+ attr_accessor :api_key
21
+
22
+ # Defines API key prefixes used with API Key authentications.
23
+ #
24
+ # @return [Hash] key: parameter name, value: API key prefix
25
+ #
26
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
27
+ # config.api_key_prefix['api_key'] = 'Token'
28
+ attr_accessor :api_key_prefix
29
+
30
+ # Defines the username used with HTTP basic authentication.
31
+ #
32
+ # @return [String]
33
+ attr_accessor :username
34
+
35
+ # Defines the password used with HTTP basic authentication.
36
+ #
37
+ # @return [String]
38
+ attr_accessor :password
39
+
40
+ # Defines the access token (Bearer) used with OAuth2.
41
+ attr_accessor :access_token
42
+
43
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
44
+ # details will be logged with `logger.debug` (see the `logger` attribute).
45
+ # Default to false.
46
+ #
47
+ # @return [true, false]
48
+ attr_accessor :debugging
49
+
50
+ # Defines the logger used for debugging.
51
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
52
+ #
53
+ # @return [#debug]
54
+ attr_accessor :logger
55
+
56
+ # Defines the temporary folder to store downloaded files
57
+ # (for API endpoints that have file response).
58
+ # Default to use `Tempfile`.
59
+ #
60
+ # @return [String]
61
+ attr_accessor :temp_folder_path
62
+
63
+ # The time limit for HTTP request in seconds.
64
+ # Default to 0 (never times out).
65
+ attr_accessor :timeout
66
+
67
+ ### TLS/SSL
68
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
69
+ # Default to true.
70
+ #
71
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
72
+ #
73
+ # @return [true, false]
74
+ attr_accessor :verify_ssl
75
+
76
+ # Set this to customize the certificate file to verify the peer.
77
+ #
78
+ # @return [String] the path to the certificate file
79
+ #
80
+ # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
81
+ # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
82
+ attr_accessor :ssl_ca_cert
83
+
84
+ # Client certificate file (for client certificate)
85
+ attr_accessor :cert_file
86
+
87
+ # Client private key file (for client certificate)
88
+ attr_accessor :key_file
89
+
90
+ attr_accessor :inject_format
91
+
92
+ attr_accessor :force_ending_format
93
+
94
+ def initialize
95
+ @scheme = 'http'
96
+ @host = 'api.marketcheck.com'
97
+ @base_path = '/v1'
98
+ @api_key = {}
99
+ @api_key_prefix = {}
100
+ @timeout = 0
101
+ @verify_ssl = true
102
+ @cert_file = nil
103
+ @key_file = nil
104
+ @debugging = false
105
+ @inject_format = false
106
+ @force_ending_format = false
107
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
108
+
109
+ yield(self) if block_given?
110
+ end
111
+
112
+ # The default Configuration object.
113
+ def self.default
114
+ @@default ||= Configuration.new
115
+ end
116
+
117
+ def configure
118
+ yield(self) if block_given?
119
+ end
120
+
121
+ def scheme=(scheme)
122
+ # remove :// from scheme
123
+ @scheme = scheme.sub(/:\/\//, '')
124
+ end
125
+
126
+ def host=(host)
127
+ # remove http(s):// and anything after a slash
128
+ @host = host.sub(/https?:\/\//, '').split('/').first
129
+ end
130
+
131
+ def base_path=(base_path)
132
+ # Add leading and trailing slashes to base_path
133
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
134
+ @base_path = "" if @base_path == "/"
135
+ end
136
+
137
+ def base_url
138
+ url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
139
+ URI.encode(url)
140
+ end
141
+
142
+ # Gets API key (with prefix if set).
143
+ # @param [String] param_name the parameter name of API key auth
144
+ def api_key_with_prefix(param_name)
145
+ if @api_key_prefix[param_name]
146
+ "#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
147
+ else
148
+ @api_key[param_name]
149
+ end
150
+ end
151
+
152
+ # Gets Basic Auth token string
153
+ def basic_auth_token
154
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
155
+ end
156
+
157
+ # Returns Auth Settings hash for api client.
158
+ def auth_settings
159
+ {
160
+ }
161
+ end
162
+ end
163
+ end
@@ -0,0 +1,217 @@
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 'date'
14
+
15
+ module SwaggerClient
16
+ class Averages
17
+ # Mean price value for the car
18
+ attr_accessor :price
19
+
20
+ # Mean msrp value for the car
21
+ attr_accessor :msrp
22
+
23
+ # Mean miles value for the car
24
+ attr_accessor :miles
25
+
26
+ # Average Days on Market value for the car based on all listings found in the Marketcheck database for this car
27
+ attr_accessor :dom
28
+
29
+ # Average age of the car
30
+ attr_accessor :age
31
+
32
+ # No of units for this car on the market
33
+ attr_accessor :units
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+
39
+ :'price' => :'price',
40
+
41
+ :'msrp' => :'msrp',
42
+
43
+ :'miles' => :'miles',
44
+
45
+ :'dom' => :'dom',
46
+
47
+ :'age' => :'age',
48
+
49
+ :'units' => :'units'
50
+
51
+ }
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.swagger_types
56
+ {
57
+ :'price' => :'Float',
58
+ :'msrp' => :'Float',
59
+ :'miles' => :'Float',
60
+ :'dom' => :'Float',
61
+ :'age' => :'Float',
62
+ :'units' => :'Float'
63
+
64
+ }
65
+ end
66
+
67
+ def initialize(attributes = {})
68
+ return unless attributes.is_a?(Hash)
69
+
70
+ # convert string to symbol for hash key
71
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
72
+
73
+
74
+ if attributes[:'price']
75
+ self.price = attributes[:'price']
76
+ end
77
+
78
+ if attributes[:'msrp']
79
+ self.msrp = attributes[:'msrp']
80
+ end
81
+
82
+ if attributes[:'miles']
83
+ self.miles = attributes[:'miles']
84
+ end
85
+
86
+ if attributes[:'dom']
87
+ self.dom = attributes[:'dom']
88
+ end
89
+
90
+ if attributes[:'age']
91
+ self.age = attributes[:'age']
92
+ end
93
+
94
+ if attributes[:'units']
95
+ self.units = attributes[:'units']
96
+ end
97
+
98
+ end
99
+
100
+ # Check equality by comparing each attribute.
101
+ def ==(o)
102
+ return true if self.equal?(o)
103
+ self.class == o.class &&
104
+ price == o.price &&
105
+ msrp == o.msrp &&
106
+ miles == o.miles &&
107
+ dom == o.dom &&
108
+ age == o.age &&
109
+ units == o.units
110
+ end
111
+
112
+ # @see the `==` method
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculate hash code according to all attributes.
118
+ def hash
119
+ [price, msrp, miles, dom, age, units].hash
120
+ end
121
+
122
+ # build the object from hash
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ self.class.swagger_types.each_pair do |key, type|
126
+ if type =~ /^Array<(.*)>/i
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
129
+ else
130
+ #TODO show warning in debug mode
131
+ end
132
+ elsif !attributes[self.class.attribute_map[key]].nil?
133
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
+ else
135
+ # data not found in attributes(hash), not an issue as the data can be optional
136
+ end
137
+ end
138
+
139
+ self
140
+ end
141
+
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :DateTime
145
+ DateTime.parse(value)
146
+ when :Date
147
+ Date.parse(value)
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :BOOLEAN
155
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ _model = SwaggerClient.const_get(type).new
176
+ _model.build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ def to_s
181
+ to_hash.to_s
182
+ end
183
+
184
+ # to_body is an alias to to_body (backward compatibility))
185
+ def to_body
186
+ to_hash
187
+ end
188
+
189
+ # return the object in the form of hash
190
+ def to_hash
191
+ hash = {}
192
+ self.class.attribute_map.each_pair do |attr, param|
193
+ value = self.send(attr)
194
+ next if value.nil?
195
+ hash[param] = _to_hash(value)
196
+ end
197
+ hash
198
+ end
199
+
200
+ # Method to output non-array value in the form of hash
201
+ # For object, use to_hash. Otherwise, just return the value
202
+ def _to_hash(value)
203
+ if value.is_a?(Array)
204
+ value.compact.map{ |v| _to_hash(v) }
205
+ elsif value.is_a?(Hash)
206
+ {}.tap do |hash|
207
+ value.each { |k, v| hash[k] = _to_hash(v) }
208
+ end
209
+ elsif value.respond_to? :to_hash
210
+ value.to_hash
211
+ else
212
+ value
213
+ end
214
+ end
215
+
216
+ end
217
+ end
@@ -0,0 +1,370 @@
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 'date'
14
+
15
+ module SwaggerClient
16
+ # Minimal set of attributes describing a listing
17
+ class BaseListing
18
+ # Unique identifier representing a specific listing from the Marketcheck database
19
+ attr_accessor :id
20
+
21
+ # Listing title as displayed on the source website
22
+ attr_accessor :heading
23
+
24
+ # VIN for the car
25
+ attr_accessor :vin
26
+
27
+ # Asking price for the car
28
+ attr_accessor :price
29
+
30
+ # Odometer reading / reported miles usage for the car
31
+ attr_accessor :miles
32
+
33
+ # Listing last seen at (most recent) timestamp
34
+ attr_accessor :last_seen_at
35
+
36
+ # Last reported price for the car. If the asking price value is not or is available then the last_price could perhaps be used. last_price is the price for the car listed on the source website as of last_price_dt date
37
+ attr_accessor :ref_price
38
+
39
+ # Last Odometer reading / reported miles usage for the car. If the asking miles value is not or is available then the last_miles could perhaps be used. last_miles is the miles for the car listed on the source website as of last_miles_dt date
40
+ attr_accessor :ref_miles
41
+
42
+ # The date at which the last price was reported online. This is earlier to last_seen_date
43
+ attr_accessor :ref_price_dt
44
+
45
+ # The date at which the last miles was reported online. This is earlier to last_seen_date
46
+ attr_accessor :ref_miles_dt
47
+
48
+ # Days on Market value for the car based on current and historical listings found in the Marketcheck database for this car
49
+ attr_accessor :dom
50
+
51
+ # Exterior color of the car
52
+ attr_accessor :exterior_color
53
+
54
+ # Interior color of the car
55
+ attr_accessor :interior_color
56
+
57
+ # Vehicle Details Page url of the specific car
58
+ attr_accessor :vdp_url
59
+
60
+ # Source domain of the listing
61
+ attr_accessor :source
62
+
63
+ # Car Media Attributes - main photo link/url and photo links
64
+ attr_accessor :media
65
+
66
+ attr_accessor :build
67
+
68
+ attr_accessor :dealer
69
+
70
+ # Certified car
71
+ attr_accessor :is_certified
72
+
73
+ # Distance of the car's location from the specified user lcoation
74
+ attr_accessor :distance
75
+
76
+ # Attribute mapping from ruby-style variable name to JSON key.
77
+ def self.attribute_map
78
+ {
79
+
80
+ :'id' => :'id',
81
+
82
+ :'heading' => :'heading',
83
+
84
+ :'vin' => :'vin',
85
+
86
+ :'price' => :'price',
87
+
88
+ :'miles' => :'miles',
89
+
90
+ :'last_seen_at' => :'last_seen_at',
91
+
92
+ :'ref_price' => :'ref_price',
93
+
94
+ :'ref_miles' => :'ref_miles',
95
+
96
+ :'ref_price_dt' => :'ref_price_dt',
97
+
98
+ :'ref_miles_dt' => :'ref_miles_dt',
99
+
100
+ :'dom' => :'dom',
101
+
102
+ :'exterior_color' => :'exterior_color',
103
+
104
+ :'interior_color' => :'interior_color',
105
+
106
+ :'vdp_url' => :'vdp_url',
107
+
108
+ :'source' => :'source',
109
+
110
+ :'media' => :'media',
111
+
112
+ :'build' => :'build',
113
+
114
+ :'dealer' => :'dealer',
115
+
116
+ :'is_certified' => :'is_certified',
117
+
118
+ :'distance' => :'distance'
119
+
120
+ }
121
+ end
122
+
123
+ # Attribute type mapping.
124
+ def self.swagger_types
125
+ {
126
+ :'id' => :'String',
127
+ :'heading' => :'String',
128
+ :'vin' => :'String',
129
+ :'price' => :'String',
130
+ :'miles' => :'String',
131
+ :'last_seen_at' => :'Float',
132
+ :'ref_price' => :'String',
133
+ :'ref_miles' => :'String',
134
+ :'ref_price_dt' => :'Integer',
135
+ :'ref_miles_dt' => :'Integer',
136
+ :'dom' => :'Float',
137
+ :'exterior_color' => :'String',
138
+ :'interior_color' => :'String',
139
+ :'vdp_url' => :'String',
140
+ :'source' => :'String',
141
+ :'media' => :'ListingMedia',
142
+ :'build' => :'Build',
143
+ :'dealer' => :'Dealer',
144
+ :'is_certified' => :'Integer',
145
+ :'distance' => :'Float'
146
+
147
+ }
148
+ end
149
+
150
+ def initialize(attributes = {})
151
+ return unless attributes.is_a?(Hash)
152
+
153
+ # convert string to symbol for hash key
154
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
155
+
156
+
157
+ if attributes[:'id']
158
+ self.id = attributes[:'id']
159
+ end
160
+
161
+ if attributes[:'heading']
162
+ self.heading = attributes[:'heading']
163
+ end
164
+
165
+ if attributes[:'vin']
166
+ self.vin = attributes[:'vin']
167
+ end
168
+
169
+ if attributes[:'price']
170
+ self.price = attributes[:'price']
171
+ end
172
+
173
+ if attributes[:'miles']
174
+ self.miles = attributes[:'miles']
175
+ end
176
+
177
+ if attributes[:'last_seen_at']
178
+ self.last_seen_at = attributes[:'last_seen_at']
179
+ end
180
+
181
+ if attributes[:'ref_price']
182
+ self.ref_price = attributes[:'ref_price']
183
+ end
184
+
185
+ if attributes[:'ref_miles']
186
+ self.ref_miles = attributes[:'ref_miles']
187
+ end
188
+
189
+ if attributes[:'ref_price_dt']
190
+ self.ref_price_dt = attributes[:'ref_price_dt']
191
+ end
192
+
193
+ if attributes[:'ref_miles_dt']
194
+ self.ref_miles_dt = attributes[:'ref_miles_dt']
195
+ end
196
+
197
+ if attributes[:'dom']
198
+ self.dom = attributes[:'dom']
199
+ end
200
+
201
+ if attributes[:'exterior_color']
202
+ self.exterior_color = attributes[:'exterior_color']
203
+ end
204
+
205
+ if attributes[:'interior_color']
206
+ self.interior_color = attributes[:'interior_color']
207
+ end
208
+
209
+ if attributes[:'vdp_url']
210
+ self.vdp_url = attributes[:'vdp_url']
211
+ end
212
+
213
+ if attributes[:'source']
214
+ self.source = attributes[:'source']
215
+ end
216
+
217
+ if attributes[:'media']
218
+ self.media = attributes[:'media']
219
+ end
220
+
221
+ if attributes[:'build']
222
+ self.build = attributes[:'build']
223
+ end
224
+
225
+ if attributes[:'dealer']
226
+ self.dealer = attributes[:'dealer']
227
+ end
228
+
229
+ if attributes[:'is_certified']
230
+ self.is_certified = attributes[:'is_certified']
231
+ end
232
+
233
+ if attributes[:'distance']
234
+ self.distance = attributes[:'distance']
235
+ end
236
+
237
+ end
238
+
239
+ # Check equality by comparing each attribute.
240
+ def ==(o)
241
+ return true if self.equal?(o)
242
+ self.class == o.class &&
243
+ id == o.id &&
244
+ heading == o.heading &&
245
+ vin == o.vin &&
246
+ price == o.price &&
247
+ miles == o.miles &&
248
+ last_seen_at == o.last_seen_at &&
249
+ ref_price == o.ref_price &&
250
+ ref_miles == o.ref_miles &&
251
+ ref_price_dt == o.ref_price_dt &&
252
+ ref_miles_dt == o.ref_miles_dt &&
253
+ dom == o.dom &&
254
+ exterior_color == o.exterior_color &&
255
+ interior_color == o.interior_color &&
256
+ vdp_url == o.vdp_url &&
257
+ source == o.source &&
258
+ media == o.media &&
259
+ build == o.build &&
260
+ dealer == o.dealer &&
261
+ is_certified == o.is_certified &&
262
+ distance == o.distance
263
+ end
264
+
265
+ # @see the `==` method
266
+ def eql?(o)
267
+ self == o
268
+ end
269
+
270
+ # Calculate hash code according to all attributes.
271
+ def hash
272
+ [id, heading, vin, price, miles, last_seen_at, ref_price, ref_miles, ref_price_dt, ref_miles_dt, dom, exterior_color, interior_color, vdp_url, source, media, build, dealer, is_certified, distance].hash
273
+ end
274
+
275
+ # build the object from hash
276
+ def build_from_hash(attributes)
277
+ return nil unless attributes.is_a?(Hash)
278
+ self.class.swagger_types.each_pair do |key, type|
279
+ if type =~ /^Array<(.*)>/i
280
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
281
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
282
+ else
283
+ #TODO show warning in debug mode
284
+ end
285
+ elsif !attributes[self.class.attribute_map[key]].nil?
286
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
287
+ else
288
+ # data not found in attributes(hash), not an issue as the data can be optional
289
+ end
290
+ end
291
+
292
+ self
293
+ end
294
+
295
+ def _deserialize(type, value)
296
+ case type.to_sym
297
+ when :DateTime
298
+ DateTime.parse(value)
299
+ when :Date
300
+ Date.parse(value)
301
+ when :String
302
+ value.to_s
303
+ when :Integer
304
+ value.to_i
305
+ when :Float
306
+ value.to_f
307
+ when :BOOLEAN
308
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
309
+ true
310
+ else
311
+ false
312
+ end
313
+ when :Object
314
+ # generic object (usually a Hash), return directly
315
+ value
316
+ when /\AArray<(?<inner_type>.+)>\z/
317
+ inner_type = Regexp.last_match[:inner_type]
318
+ value.map { |v| _deserialize(inner_type, v) }
319
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
320
+ k_type = Regexp.last_match[:k_type]
321
+ v_type = Regexp.last_match[:v_type]
322
+ {}.tap do |hash|
323
+ value.each do |k, v|
324
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
325
+ end
326
+ end
327
+ else # model
328
+ _model = SwaggerClient.const_get(type).new
329
+ _model.build_from_hash(value)
330
+ end
331
+ end
332
+
333
+ def to_s
334
+ to_hash.to_s
335
+ end
336
+
337
+ # to_body is an alias to to_body (backward compatibility))
338
+ def to_body
339
+ to_hash
340
+ end
341
+
342
+ # return the object in the form of hash
343
+ def to_hash
344
+ hash = {}
345
+ self.class.attribute_map.each_pair do |attr, param|
346
+ value = self.send(attr)
347
+ next if value.nil?
348
+ hash[param] = _to_hash(value)
349
+ end
350
+ hash
351
+ end
352
+
353
+ # Method to output non-array value in the form of hash
354
+ # For object, use to_hash. Otherwise, just return the value
355
+ def _to_hash(value)
356
+ if value.is_a?(Array)
357
+ value.compact.map{ |v| _to_hash(v) }
358
+ elsif value.is_a?(Hash)
359
+ {}.tap do |hash|
360
+ value.each { |k, v| hash[k] = _to_hash(v) }
361
+ end
362
+ elsif value.respond_to? :to_hash
363
+ value.to_hash
364
+ else
365
+ value
366
+ end
367
+ end
368
+
369
+ end
370
+ end