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,284 @@
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
+ # Describes the Car specification
17
+ class Build
18
+ # Year of the Car
19
+ attr_accessor :year
20
+
21
+ # Car Make
22
+ attr_accessor :make
23
+
24
+ # Car model
25
+ attr_accessor :model
26
+
27
+ # Trim of the car
28
+ attr_accessor :trim
29
+
30
+ # Engine of the car
31
+ attr_accessor :engine
32
+
33
+ # Engine block of the car
34
+ attr_accessor :engine_block
35
+
36
+ # Engine size of the car
37
+ attr_accessor :engine_size
38
+
39
+ # Engine block of the car
40
+ attr_accessor :engine_measure
41
+
42
+ # Engine aspiration of the car
43
+ attr_accessor :engine_aspiration
44
+
45
+ # Transmission of the car
46
+ attr_accessor :transmission
47
+
48
+ # No of doors of the car
49
+ attr_accessor :doors
50
+
51
+ # No of cylinders of the car
52
+ attr_accessor :cylinders
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+
58
+ :'year' => :'year',
59
+
60
+ :'make' => :'make',
61
+
62
+ :'model' => :'model',
63
+
64
+ :'trim' => :'trim',
65
+
66
+ :'engine' => :'engine',
67
+
68
+ :'engine_block' => :'engine_block',
69
+
70
+ :'engine_size' => :'engine_size',
71
+
72
+ :'engine_measure' => :'engine_measure',
73
+
74
+ :'engine_aspiration' => :'engine_aspiration',
75
+
76
+ :'transmission' => :'transmission',
77
+
78
+ :'doors' => :'doors',
79
+
80
+ :'cylinders' => :'cylinders'
81
+
82
+ }
83
+ end
84
+
85
+ # Attribute type mapping.
86
+ def self.swagger_types
87
+ {
88
+ :'year' => :'Float',
89
+ :'make' => :'String',
90
+ :'model' => :'String',
91
+ :'trim' => :'String',
92
+ :'engine' => :'String',
93
+ :'engine_block' => :'String',
94
+ :'engine_size' => :'String',
95
+ :'engine_measure' => :'String',
96
+ :'engine_aspiration' => :'String',
97
+ :'transmission' => :'String',
98
+ :'doors' => :'Float',
99
+ :'cylinders' => :'Float'
100
+
101
+ }
102
+ end
103
+
104
+ def initialize(attributes = {})
105
+ return unless attributes.is_a?(Hash)
106
+
107
+ # convert string to symbol for hash key
108
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
109
+
110
+
111
+ if attributes[:'year']
112
+ self.year = attributes[:'year']
113
+ end
114
+
115
+ if attributes[:'make']
116
+ self.make = attributes[:'make']
117
+ end
118
+
119
+ if attributes[:'model']
120
+ self.model = attributes[:'model']
121
+ end
122
+
123
+ if attributes[:'trim']
124
+ self.trim = attributes[:'trim']
125
+ end
126
+
127
+ if attributes[:'engine']
128
+ self.engine = attributes[:'engine']
129
+ end
130
+
131
+ if attributes[:'engine_block']
132
+ self.engine_block = attributes[:'engine_block']
133
+ end
134
+
135
+ if attributes[:'engine_size']
136
+ self.engine_size = attributes[:'engine_size']
137
+ end
138
+
139
+ if attributes[:'engine_measure']
140
+ self.engine_measure = attributes[:'engine_measure']
141
+ end
142
+
143
+ if attributes[:'engine_aspiration']
144
+ self.engine_aspiration = attributes[:'engine_aspiration']
145
+ end
146
+
147
+ if attributes[:'transmission']
148
+ self.transmission = attributes[:'transmission']
149
+ end
150
+
151
+ if attributes[:'doors']
152
+ self.doors = attributes[:'doors']
153
+ end
154
+
155
+ if attributes[:'cylinders']
156
+ self.cylinders = attributes[:'cylinders']
157
+ end
158
+
159
+ end
160
+
161
+ # Check equality by comparing each attribute.
162
+ def ==(o)
163
+ return true if self.equal?(o)
164
+ self.class == o.class &&
165
+ year == o.year &&
166
+ make == o.make &&
167
+ model == o.model &&
168
+ trim == o.trim &&
169
+ engine == o.engine &&
170
+ engine_block == o.engine_block &&
171
+ engine_size == o.engine_size &&
172
+ engine_measure == o.engine_measure &&
173
+ engine_aspiration == o.engine_aspiration &&
174
+ transmission == o.transmission &&
175
+ doors == o.doors &&
176
+ cylinders == o.cylinders
177
+ end
178
+
179
+ # @see the `==` method
180
+ def eql?(o)
181
+ self == o
182
+ end
183
+
184
+ # Calculate hash code according to all attributes.
185
+ def hash
186
+ [year, make, model, trim, engine, engine_block, engine_size, engine_measure, engine_aspiration, transmission, doors, cylinders].hash
187
+ end
188
+
189
+ # build the object from hash
190
+ def build_from_hash(attributes)
191
+ return nil unless attributes.is_a?(Hash)
192
+ self.class.swagger_types.each_pair do |key, type|
193
+ if type =~ /^Array<(.*)>/i
194
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
195
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
196
+ else
197
+ #TODO show warning in debug mode
198
+ end
199
+ elsif !attributes[self.class.attribute_map[key]].nil?
200
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
201
+ else
202
+ # data not found in attributes(hash), not an issue as the data can be optional
203
+ end
204
+ end
205
+
206
+ self
207
+ end
208
+
209
+ def _deserialize(type, value)
210
+ case type.to_sym
211
+ when :DateTime
212
+ DateTime.parse(value)
213
+ when :Date
214
+ Date.parse(value)
215
+ when :String
216
+ value.to_s
217
+ when :Integer
218
+ value.to_i
219
+ when :Float
220
+ value.to_f
221
+ when :BOOLEAN
222
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
223
+ true
224
+ else
225
+ false
226
+ end
227
+ when :Object
228
+ # generic object (usually a Hash), return directly
229
+ value
230
+ when /\AArray<(?<inner_type>.+)>\z/
231
+ inner_type = Regexp.last_match[:inner_type]
232
+ value.map { |v| _deserialize(inner_type, v) }
233
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
234
+ k_type = Regexp.last_match[:k_type]
235
+ v_type = Regexp.last_match[:v_type]
236
+ {}.tap do |hash|
237
+ value.each do |k, v|
238
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
239
+ end
240
+ end
241
+ else # model
242
+ _model = SwaggerClient.const_get(type).new
243
+ _model.build_from_hash(value)
244
+ end
245
+ end
246
+
247
+ def to_s
248
+ to_hash.to_s
249
+ end
250
+
251
+ # to_body is an alias to to_body (backward compatibility))
252
+ def to_body
253
+ to_hash
254
+ end
255
+
256
+ # return the object in the form of hash
257
+ def to_hash
258
+ hash = {}
259
+ self.class.attribute_map.each_pair do |attr, param|
260
+ value = self.send(attr)
261
+ next if value.nil?
262
+ hash[param] = _to_hash(value)
263
+ end
264
+ hash
265
+ end
266
+
267
+ # Method to output non-array value in the form of hash
268
+ # For object, use to_hash. Otherwise, just return the value
269
+ def _to_hash(value)
270
+ if value.is_a?(Array)
271
+ value.compact.map{ |v| _to_hash(v) }
272
+ elsif value.is_a?(Hash)
273
+ {}.tap do |hash|
274
+ value.each { |k, v| hash[k] = _to_hash(v) }
275
+ end
276
+ elsif value.respond_to? :to_hash
277
+ value.to_hash
278
+ else
279
+ value
280
+ end
281
+ end
282
+
283
+ end
284
+ end
@@ -0,0 +1,329 @@
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 Dealer
17
+ # The unique id associated with the dealer in the Marketcheck database
18
+ attr_accessor :id
19
+
20
+ # Dealer franchise id
21
+ attr_accessor :franchise_id
22
+
23
+ # Name of the dealer
24
+ attr_accessor :name
25
+
26
+ # Street of the dealer
27
+ attr_accessor :street
28
+
29
+ # City of the dealer
30
+ attr_accessor :city
31
+
32
+ # State of the dealer
33
+ attr_accessor :state
34
+
35
+ # Zip of the dealer
36
+ attr_accessor :zip
37
+
38
+ # Latutide for the dealer location
39
+ attr_accessor :latitude
40
+
41
+ # Longitude for the dealer location
42
+ attr_accessor :longitude
43
+
44
+ # Contact no of the dealer
45
+ attr_accessor :phone
46
+
47
+ # Car type new|used|certified
48
+ attr_accessor :car_type
49
+
50
+ # Target url for the new cars listing
51
+ attr_accessor :target_url_new
52
+
53
+ # Target url for the used cars listing
54
+ attr_accessor :target_url_used
55
+
56
+ # Target url for the certified cars listing
57
+ attr_accessor :target_url_certified
58
+
59
+ # Dealer type - independent, franchise, multi-brand, authorized
60
+ attr_accessor :dealer_type
61
+
62
+ # Overall rating of the dealership on scale 1-5
63
+ attr_accessor :rating
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+
69
+ :'id' => :'id',
70
+
71
+ :'franchise_id' => :'franchise_id',
72
+
73
+ :'name' => :'name',
74
+
75
+ :'street' => :'street',
76
+
77
+ :'city' => :'city',
78
+
79
+ :'state' => :'state',
80
+
81
+ :'zip' => :'zip',
82
+
83
+ :'latitude' => :'latitude',
84
+
85
+ :'longitude' => :'longitude',
86
+
87
+ :'phone' => :'phone',
88
+
89
+ :'car_type' => :'car_type',
90
+
91
+ :'target_url_new' => :'target_url_new',
92
+
93
+ :'target_url_used' => :'target_url_used',
94
+
95
+ :'target_url_certified' => :'target_url_certified',
96
+
97
+ :'dealer_type' => :'dealer_type',
98
+
99
+ :'rating' => :'rating'
100
+
101
+ }
102
+ end
103
+
104
+ # Attribute type mapping.
105
+ def self.swagger_types
106
+ {
107
+ :'id' => :'String',
108
+ :'franchise_id' => :'String',
109
+ :'name' => :'String',
110
+ :'street' => :'String',
111
+ :'city' => :'String',
112
+ :'state' => :'String',
113
+ :'zip' => :'String',
114
+ :'latitude' => :'String',
115
+ :'longitude' => :'String',
116
+ :'phone' => :'String',
117
+ :'car_type' => :'String',
118
+ :'target_url_new' => :'String',
119
+ :'target_url_used' => :'String',
120
+ :'target_url_certified' => :'String',
121
+ :'dealer_type' => :'String',
122
+ :'rating' => :'Float'
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[:'franchise_id']
139
+ self.franchise_id = attributes[:'franchise_id']
140
+ end
141
+
142
+ if attributes[:'name']
143
+ self.name = attributes[:'name']
144
+ end
145
+
146
+ if attributes[:'street']
147
+ self.street = attributes[:'street']
148
+ end
149
+
150
+ if attributes[:'city']
151
+ self.city = attributes[:'city']
152
+ end
153
+
154
+ if attributes[:'state']
155
+ self.state = attributes[:'state']
156
+ end
157
+
158
+ if attributes[:'zip']
159
+ self.zip = attributes[:'zip']
160
+ end
161
+
162
+ if attributes[:'latitude']
163
+ self.latitude = attributes[:'latitude']
164
+ end
165
+
166
+ if attributes[:'longitude']
167
+ self.longitude = attributes[:'longitude']
168
+ end
169
+
170
+ if attributes[:'phone']
171
+ self.phone = attributes[:'phone']
172
+ end
173
+
174
+ if attributes[:'car_type']
175
+ self.car_type = attributes[:'car_type']
176
+ end
177
+
178
+ if attributes[:'target_url_new']
179
+ self.target_url_new = attributes[:'target_url_new']
180
+ end
181
+
182
+ if attributes[:'target_url_used']
183
+ self.target_url_used = attributes[:'target_url_used']
184
+ end
185
+
186
+ if attributes[:'target_url_certified']
187
+ self.target_url_certified = attributes[:'target_url_certified']
188
+ end
189
+
190
+ if attributes[:'dealer_type']
191
+ self.dealer_type = attributes[:'dealer_type']
192
+ else
193
+ self.dealer_type = "independent"
194
+ end
195
+
196
+ if attributes[:'rating']
197
+ self.rating = attributes[:'rating']
198
+ end
199
+
200
+ end
201
+
202
+ # Check equality by comparing each attribute.
203
+ def ==(o)
204
+ return true if self.equal?(o)
205
+ self.class == o.class &&
206
+ id == o.id &&
207
+ franchise_id == o.franchise_id &&
208
+ name == o.name &&
209
+ street == o.street &&
210
+ city == o.city &&
211
+ state == o.state &&
212
+ zip == o.zip &&
213
+ latitude == o.latitude &&
214
+ longitude == o.longitude &&
215
+ phone == o.phone &&
216
+ car_type == o.car_type &&
217
+ target_url_new == o.target_url_new &&
218
+ target_url_used == o.target_url_used &&
219
+ target_url_certified == o.target_url_certified &&
220
+ dealer_type == o.dealer_type &&
221
+ rating == o.rating
222
+ end
223
+
224
+ # @see the `==` method
225
+ def eql?(o)
226
+ self == o
227
+ end
228
+
229
+ # Calculate hash code according to all attributes.
230
+ def hash
231
+ [id, franchise_id, name, street, city, state, zip, latitude, longitude, phone, car_type, target_url_new, target_url_used, target_url_certified, dealer_type, rating].hash
232
+ end
233
+
234
+ # build the object from hash
235
+ def build_from_hash(attributes)
236
+ return nil unless attributes.is_a?(Hash)
237
+ self.class.swagger_types.each_pair do |key, type|
238
+ if type =~ /^Array<(.*)>/i
239
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
240
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
241
+ else
242
+ #TODO show warning in debug mode
243
+ end
244
+ elsif !attributes[self.class.attribute_map[key]].nil?
245
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
246
+ else
247
+ # data not found in attributes(hash), not an issue as the data can be optional
248
+ end
249
+ end
250
+
251
+ self
252
+ end
253
+
254
+ def _deserialize(type, value)
255
+ case type.to_sym
256
+ when :DateTime
257
+ DateTime.parse(value)
258
+ when :Date
259
+ Date.parse(value)
260
+ when :String
261
+ value.to_s
262
+ when :Integer
263
+ value.to_i
264
+ when :Float
265
+ value.to_f
266
+ when :BOOLEAN
267
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
268
+ true
269
+ else
270
+ false
271
+ end
272
+ when :Object
273
+ # generic object (usually a Hash), return directly
274
+ value
275
+ when /\AArray<(?<inner_type>.+)>\z/
276
+ inner_type = Regexp.last_match[:inner_type]
277
+ value.map { |v| _deserialize(inner_type, v) }
278
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
279
+ k_type = Regexp.last_match[:k_type]
280
+ v_type = Regexp.last_match[:v_type]
281
+ {}.tap do |hash|
282
+ value.each do |k, v|
283
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
284
+ end
285
+ end
286
+ else # model
287
+ _model = SwaggerClient.const_get(type).new
288
+ _model.build_from_hash(value)
289
+ end
290
+ end
291
+
292
+ def to_s
293
+ to_hash.to_s
294
+ end
295
+
296
+ # to_body is an alias to to_body (backward compatibility))
297
+ def to_body
298
+ to_hash
299
+ end
300
+
301
+ # return the object in the form of hash
302
+ def to_hash
303
+ hash = {}
304
+ self.class.attribute_map.each_pair do |attr, param|
305
+ value = self.send(attr)
306
+ next if value.nil?
307
+ hash[param] = _to_hash(value)
308
+ end
309
+ hash
310
+ end
311
+
312
+ # Method to output non-array value in the form of hash
313
+ # For object, use to_hash. Otherwise, just return the value
314
+ def _to_hash(value)
315
+ if value.is_a?(Array)
316
+ value.compact.map{ |v| _to_hash(v) }
317
+ elsif value.is_a?(Hash)
318
+ {}.tap do |hash|
319
+ value.each { |k, v| hash[k] = _to_hash(v) }
320
+ end
321
+ elsif value.respond_to? :to_hash
322
+ value.to_hash
323
+ else
324
+ value
325
+ end
326
+ end
327
+
328
+ end
329
+ end