marketcheck_ruby_client 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +133 -0
- data/docs/Averages.md +13 -0
- data/docs/BaseListing.md +27 -0
- data/docs/Build.md +19 -0
- data/docs/Dealer.md +23 -0
- data/docs/DealerApi.md +230 -0
- data/docs/Error.md +9 -0
- data/docs/FacetItem.md +9 -0
- data/docs/FacetsApi.md +71 -0
- data/docs/GraphsApi.md +73 -0
- data/docs/HistoricalListing.md +19 -0
- data/docs/HistoryApi.md +65 -0
- data/docs/InventoryApi.md +113 -0
- data/docs/Listing.md +23 -0
- data/docs/ListingDebugAttributes.md +13 -0
- data/docs/ListingExtraAttributes.md +10 -0
- data/docs/ListingMedia.md +9 -0
- data/docs/ListingVDP.md +10 -0
- data/docs/ListingsApi.md +324 -0
- data/docs/Location.md +12 -0
- data/docs/MakeModel.md +9 -0
- data/docs/MarketAveragesApi.md +70 -0
- data/docs/MarketTrendsApi.md +72 -0
- data/docs/PlotPoint.md +14 -0
- data/docs/SearchResponse.md +9 -0
- data/docs/TrendPoint.md +12 -0
- data/docs/VINDecoderApi.md +59 -0
- data/git_push.sh +52 -0
- data/lib/marketcheck_ruby_client.rb +65 -0
- data/lib/swagger_client/api/dealer_api.rb +312 -0
- data/lib/swagger_client/api/facets_api.rb +105 -0
- data/lib/swagger_client/api/graphs_api.rb +108 -0
- data/lib/swagger_client/api/history_api.rb +95 -0
- data/lib/swagger_client/api/inventory_api.rb +155 -0
- data/lib/swagger_client/api/listings_api.rb +474 -0
- data/lib/swagger_client/api/market_averages_api.rb +102 -0
- data/lib/swagger_client/api/market_trends_api.rb +108 -0
- data/lib/swagger_client/api/vin_decoder_api.rb +89 -0
- data/lib/swagger_client/api_client.rb +332 -0
- data/lib/swagger_client/api_error.rb +36 -0
- data/lib/swagger_client/configuration.rb +163 -0
- data/lib/swagger_client/models/averages.rb +217 -0
- data/lib/swagger_client/models/base_listing.rb +370 -0
- data/lib/swagger_client/models/build.rb +284 -0
- data/lib/swagger_client/models/dealer.rb +329 -0
- data/lib/swagger_client/models/error.rb +173 -0
- data/lib/swagger_client/models/facet_item.rb +173 -0
- data/lib/swagger_client/models/historical_listing.rb +284 -0
- data/lib/swagger_client/models/listing.rb +327 -0
- data/lib/swagger_client/models/listing_debug_attributes.rb +217 -0
- data/lib/swagger_client/models/listing_extra_attributes.rb +188 -0
- data/lib/swagger_client/models/listing_media.rb +175 -0
- data/lib/swagger_client/models/listing_vdp.rb +185 -0
- data/lib/swagger_client/models/location.rb +207 -0
- data/lib/swagger_client/models/make_model.rb +171 -0
- data/lib/swagger_client/models/plot_point.rb +228 -0
- data/lib/swagger_client/models/search_response.rb +175 -0
- data/lib/swagger_client/models/trend_point.rb +206 -0
- data/lib/swagger_client/version.rb +15 -0
- data/marketcheck_ruby_client-1.0.6.gem +0 -0
- data/marketcheck_ruby_client.gemspec +32 -0
- data/spec/api/dealer_api_spec.rb +109 -0
- data/spec/api/facets_api_spec.rb +57 -0
- data/spec/api/graphs_api_spec.rb +58 -0
- data/spec/api/history_api_spec.rb +54 -0
- data/spec/api/inventory_api_spec.rb +70 -0
- data/spec/api/listings_api_spec.rb +148 -0
- data/spec/api/market_averages_api_spec.rb +57 -0
- data/spec/api/market_trends_api_spec.rb +57 -0
- data/spec/api/vin_decoder_api_spec.rb +52 -0
- data/spec/models/averages_spec.rb +96 -0
- data/spec/models/base_listing_spec.rb +236 -0
- data/spec/models/build_spec.rb +156 -0
- data/spec/models/dealer_spec.rb +196 -0
- data/spec/models/error_spec.rb +56 -0
- data/spec/models/facet_item_spec.rb +56 -0
- data/spec/models/historical_listing_spec.rb +156 -0
- data/spec/models/listing_debug_attributes_spec.rb +96 -0
- data/spec/models/listing_extra_attributes_spec.rb +66 -0
- data/spec/models/listing_media_spec.rb +56 -0
- data/spec/models/listing_spec.rb +196 -0
- data/spec/models/listing_vdp_spec.rb +66 -0
- data/spec/models/location_spec.rb +86 -0
- data/spec/models/make_model_spec.rb +56 -0
- data/spec/models/plot_point_spec.rb +106 -0
- data/spec/models/search_response_spec.rb +56 -0
- data/spec/models/trend_point_spec.rb +86 -0
- metadata +337 -0
@@ -0,0 +1,327 @@
|
|
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
|
+
# Represents a full list of attributes available with Marketcheck for a car
|
17
|
+
class Listing
|
18
|
+
# Unique identifier representing a specific listing from the Marketcheck database
|
19
|
+
attr_accessor :id
|
20
|
+
|
21
|
+
# Listing heading
|
22
|
+
attr_accessor :heading
|
23
|
+
|
24
|
+
# VIN for the car
|
25
|
+
attr_accessor :vin
|
26
|
+
|
27
|
+
# Stock no of the car
|
28
|
+
attr_accessor :stock_no
|
29
|
+
|
30
|
+
# Asking price for the car
|
31
|
+
attr_accessor :price
|
32
|
+
|
33
|
+
# MSRP for the car
|
34
|
+
attr_accessor :msrp
|
35
|
+
|
36
|
+
# Odometer reading / reported miles usage for the car
|
37
|
+
attr_accessor :miles
|
38
|
+
|
39
|
+
# Vehicle Details Page url of the specific car
|
40
|
+
attr_accessor :vdp_url
|
41
|
+
|
42
|
+
# Source domain of the listing
|
43
|
+
attr_accessor :source
|
44
|
+
|
45
|
+
# Flag indicating whether the car is Certified
|
46
|
+
attr_accessor :is_certified
|
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
|
+
# Build / Specifications attributes
|
52
|
+
attr_accessor :build
|
53
|
+
|
54
|
+
# Car Media Attributes - main photo link/url and photo links
|
55
|
+
attr_accessor :media
|
56
|
+
|
57
|
+
# Extra attributes for the listing - options, features, seller comments etc
|
58
|
+
attr_accessor :extra
|
59
|
+
|
60
|
+
attr_accessor :dealer
|
61
|
+
|
62
|
+
# Car location data. Included only if its a different location to the dealers location
|
63
|
+
attr_accessor :car_location
|
64
|
+
|
65
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
66
|
+
def self.attribute_map
|
67
|
+
{
|
68
|
+
|
69
|
+
:'id' => :'id',
|
70
|
+
|
71
|
+
:'heading' => :'heading',
|
72
|
+
|
73
|
+
:'vin' => :'vin',
|
74
|
+
|
75
|
+
:'stock_no' => :'stock_no',
|
76
|
+
|
77
|
+
:'price' => :'price',
|
78
|
+
|
79
|
+
:'msrp' => :'msrp',
|
80
|
+
|
81
|
+
:'miles' => :'miles',
|
82
|
+
|
83
|
+
:'vdp_url' => :'vdp_url',
|
84
|
+
|
85
|
+
:'source' => :'source',
|
86
|
+
|
87
|
+
:'is_certified' => :'is_certified',
|
88
|
+
|
89
|
+
:'dom' => :'dom',
|
90
|
+
|
91
|
+
:'build' => :'build',
|
92
|
+
|
93
|
+
:'media' => :'media',
|
94
|
+
|
95
|
+
:'extra' => :'extra',
|
96
|
+
|
97
|
+
:'dealer' => :'dealer',
|
98
|
+
|
99
|
+
:'car_location' => :'car_location'
|
100
|
+
|
101
|
+
}
|
102
|
+
end
|
103
|
+
|
104
|
+
# Attribute type mapping.
|
105
|
+
def self.swagger_types
|
106
|
+
{
|
107
|
+
:'id' => :'String',
|
108
|
+
:'heading' => :'String',
|
109
|
+
:'vin' => :'String',
|
110
|
+
:'stock_no' => :'String',
|
111
|
+
:'price' => :'String',
|
112
|
+
:'msrp' => :'String',
|
113
|
+
:'miles' => :'String',
|
114
|
+
:'vdp_url' => :'String',
|
115
|
+
:'source' => :'String',
|
116
|
+
:'is_certified' => :'Integer',
|
117
|
+
:'dom' => :'Float',
|
118
|
+
:'build' => :'Build',
|
119
|
+
:'media' => :'ListingMedia',
|
120
|
+
:'extra' => :'ListingExtraAttributes',
|
121
|
+
:'dealer' => :'Dealer',
|
122
|
+
:'car_location' => :'Location'
|
123
|
+
|
124
|
+
}
|
125
|
+
end
|
126
|
+
|
127
|
+
def initialize(attributes = {})
|
128
|
+
return unless attributes.is_a?(Hash)
|
129
|
+
|
130
|
+
# convert string to symbol for hash key
|
131
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
132
|
+
|
133
|
+
|
134
|
+
if attributes[:'id']
|
135
|
+
self.id = attributes[:'id']
|
136
|
+
end
|
137
|
+
|
138
|
+
if attributes[:'heading']
|
139
|
+
self.heading = attributes[:'heading']
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes[:'vin']
|
143
|
+
self.vin = attributes[:'vin']
|
144
|
+
end
|
145
|
+
|
146
|
+
if attributes[:'stock_no']
|
147
|
+
self.stock_no = attributes[:'stock_no']
|
148
|
+
end
|
149
|
+
|
150
|
+
if attributes[:'price']
|
151
|
+
self.price = attributes[:'price']
|
152
|
+
end
|
153
|
+
|
154
|
+
if attributes[:'msrp']
|
155
|
+
self.msrp = attributes[:'msrp']
|
156
|
+
end
|
157
|
+
|
158
|
+
if attributes[:'miles']
|
159
|
+
self.miles = attributes[:'miles']
|
160
|
+
end
|
161
|
+
|
162
|
+
if attributes[:'vdp_url']
|
163
|
+
self.vdp_url = attributes[:'vdp_url']
|
164
|
+
end
|
165
|
+
|
166
|
+
if attributes[:'source']
|
167
|
+
self.source = attributes[:'source']
|
168
|
+
end
|
169
|
+
|
170
|
+
if attributes[:'is_certified']
|
171
|
+
self.is_certified = attributes[:'is_certified']
|
172
|
+
end
|
173
|
+
|
174
|
+
if attributes[:'dom']
|
175
|
+
self.dom = attributes[:'dom']
|
176
|
+
end
|
177
|
+
|
178
|
+
if attributes[:'build']
|
179
|
+
self.build = attributes[:'build']
|
180
|
+
end
|
181
|
+
|
182
|
+
if attributes[:'media']
|
183
|
+
self.media = attributes[:'media']
|
184
|
+
end
|
185
|
+
|
186
|
+
if attributes[:'extra']
|
187
|
+
self.extra = attributes[:'extra']
|
188
|
+
end
|
189
|
+
|
190
|
+
if attributes[:'dealer']
|
191
|
+
self.dealer = attributes[:'dealer']
|
192
|
+
end
|
193
|
+
|
194
|
+
if attributes[:'car_location']
|
195
|
+
self.car_location = attributes[:'car_location']
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|
199
|
+
|
200
|
+
# Check equality by comparing each attribute.
|
201
|
+
def ==(o)
|
202
|
+
return true if self.equal?(o)
|
203
|
+
self.class == o.class &&
|
204
|
+
id == o.id &&
|
205
|
+
heading == o.heading &&
|
206
|
+
vin == o.vin &&
|
207
|
+
stock_no == o.stock_no &&
|
208
|
+
price == o.price &&
|
209
|
+
msrp == o.msrp &&
|
210
|
+
miles == o.miles &&
|
211
|
+
vdp_url == o.vdp_url &&
|
212
|
+
source == o.source &&
|
213
|
+
is_certified == o.is_certified &&
|
214
|
+
dom == o.dom &&
|
215
|
+
build == o.build &&
|
216
|
+
media == o.media &&
|
217
|
+
extra == o.extra &&
|
218
|
+
dealer == o.dealer &&
|
219
|
+
car_location == o.car_location
|
220
|
+
end
|
221
|
+
|
222
|
+
# @see the `==` method
|
223
|
+
def eql?(o)
|
224
|
+
self == o
|
225
|
+
end
|
226
|
+
|
227
|
+
# Calculate hash code according to all attributes.
|
228
|
+
def hash
|
229
|
+
[id, heading, vin, stock_no, price, msrp, miles, vdp_url, source, is_certified, dom, build, media, extra, dealer, car_location].hash
|
230
|
+
end
|
231
|
+
|
232
|
+
# build the object from hash
|
233
|
+
def build_from_hash(attributes)
|
234
|
+
return nil unless attributes.is_a?(Hash)
|
235
|
+
self.class.swagger_types.each_pair do |key, type|
|
236
|
+
if type =~ /^Array<(.*)>/i
|
237
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
238
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
239
|
+
else
|
240
|
+
#TODO show warning in debug mode
|
241
|
+
end
|
242
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
243
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
244
|
+
else
|
245
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
self
|
250
|
+
end
|
251
|
+
|
252
|
+
def _deserialize(type, value)
|
253
|
+
case type.to_sym
|
254
|
+
when :DateTime
|
255
|
+
DateTime.parse(value)
|
256
|
+
when :Date
|
257
|
+
Date.parse(value)
|
258
|
+
when :String
|
259
|
+
value.to_s
|
260
|
+
when :Integer
|
261
|
+
value.to_i
|
262
|
+
when :Float
|
263
|
+
value.to_f
|
264
|
+
when :BOOLEAN
|
265
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
266
|
+
true
|
267
|
+
else
|
268
|
+
false
|
269
|
+
end
|
270
|
+
when :Object
|
271
|
+
# generic object (usually a Hash), return directly
|
272
|
+
value
|
273
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
274
|
+
inner_type = Regexp.last_match[:inner_type]
|
275
|
+
value.map { |v| _deserialize(inner_type, v) }
|
276
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
277
|
+
k_type = Regexp.last_match[:k_type]
|
278
|
+
v_type = Regexp.last_match[:v_type]
|
279
|
+
{}.tap do |hash|
|
280
|
+
value.each do |k, v|
|
281
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
282
|
+
end
|
283
|
+
end
|
284
|
+
else # model
|
285
|
+
_model = SwaggerClient.const_get(type).new
|
286
|
+
_model.build_from_hash(value)
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
def to_s
|
291
|
+
to_hash.to_s
|
292
|
+
end
|
293
|
+
|
294
|
+
# to_body is an alias to to_body (backward compatibility))
|
295
|
+
def to_body
|
296
|
+
to_hash
|
297
|
+
end
|
298
|
+
|
299
|
+
# return the object in the form of hash
|
300
|
+
def to_hash
|
301
|
+
hash = {}
|
302
|
+
self.class.attribute_map.each_pair do |attr, param|
|
303
|
+
value = self.send(attr)
|
304
|
+
next if value.nil?
|
305
|
+
hash[param] = _to_hash(value)
|
306
|
+
end
|
307
|
+
hash
|
308
|
+
end
|
309
|
+
|
310
|
+
# Method to output non-array value in the form of hash
|
311
|
+
# For object, use to_hash. Otherwise, just return the value
|
312
|
+
def _to_hash(value)
|
313
|
+
if value.is_a?(Array)
|
314
|
+
value.compact.map{ |v| _to_hash(v) }
|
315
|
+
elsif value.is_a?(Hash)
|
316
|
+
{}.tap do |hash|
|
317
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
318
|
+
end
|
319
|
+
elsif value.respond_to? :to_hash
|
320
|
+
value.to_hash
|
321
|
+
else
|
322
|
+
value
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
end
|
327
|
+
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 ListingDebugAttributes
|
17
|
+
# Robot id
|
18
|
+
attr_accessor :robot_id
|
19
|
+
|
20
|
+
# Cycle id
|
21
|
+
attr_accessor :cycle_id
|
22
|
+
|
23
|
+
# Scraped date and time
|
24
|
+
attr_accessor :scraped_at
|
25
|
+
|
26
|
+
# Template id
|
27
|
+
attr_accessor :template_id
|
28
|
+
|
29
|
+
# User id
|
30
|
+
attr_accessor :user_id
|
31
|
+
|
32
|
+
# Taxonomy vin
|
33
|
+
attr_accessor :taxonomy_vin
|
34
|
+
|
35
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
36
|
+
def self.attribute_map
|
37
|
+
{
|
38
|
+
|
39
|
+
:'robot_id' => :'robot_id',
|
40
|
+
|
41
|
+
:'cycle_id' => :'cycle_id',
|
42
|
+
|
43
|
+
:'scraped_at' => :'scraped_at',
|
44
|
+
|
45
|
+
:'template_id' => :'template_id',
|
46
|
+
|
47
|
+
:'user_id' => :'user_id',
|
48
|
+
|
49
|
+
:'taxonomy_vin' => :'taxonomy_vin'
|
50
|
+
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
# Attribute type mapping.
|
55
|
+
def self.swagger_types
|
56
|
+
{
|
57
|
+
:'robot_id' => :'Float',
|
58
|
+
:'cycle_id' => :'Float',
|
59
|
+
:'scraped_at' => :'String',
|
60
|
+
:'template_id' => :'Float',
|
61
|
+
:'user_id' => :'Float',
|
62
|
+
:'taxonomy_vin' => :'String'
|
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[:'robot_id']
|
75
|
+
self.robot_id = attributes[:'robot_id']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes[:'cycle_id']
|
79
|
+
self.cycle_id = attributes[:'cycle_id']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes[:'scraped_at']
|
83
|
+
self.scraped_at = attributes[:'scraped_at']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes[:'template_id']
|
87
|
+
self.template_id = attributes[:'template_id']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes[:'user_id']
|
91
|
+
self.user_id = attributes[:'user_id']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes[:'taxonomy_vin']
|
95
|
+
self.taxonomy_vin = attributes[:'taxonomy_vin']
|
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
|
+
robot_id == o.robot_id &&
|
105
|
+
cycle_id == o.cycle_id &&
|
106
|
+
scraped_at == o.scraped_at &&
|
107
|
+
template_id == o.template_id &&
|
108
|
+
user_id == o.user_id &&
|
109
|
+
taxonomy_vin == o.taxonomy_vin
|
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
|
+
[robot_id, cycle_id, scraped_at, template_id, user_id, taxonomy_vin].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
|