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,207 @@
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 location
17
+ class Location
18
+ # City of the listing
19
+ attr_accessor :city
20
+
21
+ # State of the listing
22
+ attr_accessor :state
23
+
24
+ # Zip of the listing
25
+ attr_accessor :zip
26
+
27
+ # Latitude component of the location
28
+ attr_accessor :latitude
29
+
30
+ # Longitude component of the location
31
+ attr_accessor :longitude
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+
37
+ :'city' => :'city',
38
+
39
+ :'state' => :'state',
40
+
41
+ :'zip' => :'zip',
42
+
43
+ :'latitude' => :'latitude',
44
+
45
+ :'longitude' => :'longitude'
46
+
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.swagger_types
52
+ {
53
+ :'city' => :'String',
54
+ :'state' => :'String',
55
+ :'zip' => :'String',
56
+ :'latitude' => :'Float',
57
+ :'longitude' => :'Float'
58
+
59
+ }
60
+ end
61
+
62
+ def initialize(attributes = {})
63
+ return unless attributes.is_a?(Hash)
64
+
65
+ # convert string to symbol for hash key
66
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
67
+
68
+
69
+ if attributes[:'city']
70
+ self.city = attributes[:'city']
71
+ end
72
+
73
+ if attributes[:'state']
74
+ self.state = attributes[:'state']
75
+ end
76
+
77
+ if attributes[:'zip']
78
+ self.zip = attributes[:'zip']
79
+ end
80
+
81
+ if attributes[:'latitude']
82
+ self.latitude = attributes[:'latitude']
83
+ end
84
+
85
+ if attributes[:'longitude']
86
+ self.longitude = attributes[:'longitude']
87
+ end
88
+
89
+ end
90
+
91
+ # Check equality by comparing each attribute.
92
+ def ==(o)
93
+ return true if self.equal?(o)
94
+ self.class == o.class &&
95
+ city == o.city &&
96
+ state == o.state &&
97
+ zip == o.zip &&
98
+ latitude == o.latitude &&
99
+ longitude == o.longitude
100
+ end
101
+
102
+ # @see the `==` method
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculate hash code according to all attributes.
108
+ def hash
109
+ [city, state, zip, latitude, longitude].hash
110
+ end
111
+
112
+ # build the object from hash
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.swagger_types.each_pair do |key, type|
116
+ if type =~ /^Array<(.*)>/i
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
119
+ else
120
+ #TODO show warning in debug mode
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ else
125
+ # data not found in attributes(hash), not an issue as the data can be optional
126
+ end
127
+ end
128
+
129
+ self
130
+ end
131
+
132
+ def _deserialize(type, value)
133
+ case type.to_sym
134
+ when :DateTime
135
+ DateTime.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :BOOLEAN
145
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ _model = SwaggerClient.const_get(type).new
166
+ _model.build_from_hash(value)
167
+ end
168
+ end
169
+
170
+ def to_s
171
+ to_hash.to_s
172
+ end
173
+
174
+ # to_body is an alias to to_body (backward compatibility))
175
+ def to_body
176
+ to_hash
177
+ end
178
+
179
+ # return the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ next if value.nil?
185
+ hash[param] = _to_hash(value)
186
+ end
187
+ hash
188
+ end
189
+
190
+ # Method to output non-array value in the form of hash
191
+ # For object, use to_hash. Otherwise, just return the value
192
+ def _to_hash(value)
193
+ if value.is_a?(Array)
194
+ value.compact.map{ |v| _to_hash(v) }
195
+ elsif value.is_a?(Hash)
196
+ {}.tap do |hash|
197
+ value.each { |k, v| hash[k] = _to_hash(v) }
198
+ end
199
+ elsif value.respond_to? :to_hash
200
+ value.to_hash
201
+ else
202
+ value
203
+ end
204
+ end
205
+
206
+ end
207
+ end
@@ -0,0 +1,171 @@
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 MakeModel
17
+ attr_accessor :make
18
+
19
+ attr_accessor :model
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+
25
+ :'make' => :'make',
26
+
27
+ :'model' => :'model'
28
+
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'make' => :'String',
36
+ :'model' => :'String'
37
+
38
+ }
39
+ end
40
+
41
+ def initialize(attributes = {})
42
+ return unless attributes.is_a?(Hash)
43
+
44
+ # convert string to symbol for hash key
45
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
46
+
47
+
48
+ if attributes[:'make']
49
+ self.make = attributes[:'make']
50
+ end
51
+
52
+ if attributes[:'model']
53
+ self.model = attributes[:'model']
54
+ end
55
+
56
+ end
57
+
58
+ # Check equality by comparing each attribute.
59
+ def ==(o)
60
+ return true if self.equal?(o)
61
+ self.class == o.class &&
62
+ make == o.make &&
63
+ model == o.model
64
+ end
65
+
66
+ # @see the `==` method
67
+ def eql?(o)
68
+ self == o
69
+ end
70
+
71
+ # Calculate hash code according to all attributes.
72
+ def hash
73
+ [make, model].hash
74
+ end
75
+
76
+ # build the object from hash
77
+ def build_from_hash(attributes)
78
+ return nil unless attributes.is_a?(Hash)
79
+ self.class.swagger_types.each_pair do |key, type|
80
+ if type =~ /^Array<(.*)>/i
81
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
82
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
83
+ else
84
+ #TODO show warning in debug mode
85
+ end
86
+ elsif !attributes[self.class.attribute_map[key]].nil?
87
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
88
+ else
89
+ # data not found in attributes(hash), not an issue as the data can be optional
90
+ end
91
+ end
92
+
93
+ self
94
+ end
95
+
96
+ def _deserialize(type, value)
97
+ case type.to_sym
98
+ when :DateTime
99
+ DateTime.parse(value)
100
+ when :Date
101
+ Date.parse(value)
102
+ when :String
103
+ value.to_s
104
+ when :Integer
105
+ value.to_i
106
+ when :Float
107
+ value.to_f
108
+ when :BOOLEAN
109
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
110
+ true
111
+ else
112
+ false
113
+ end
114
+ when :Object
115
+ # generic object (usually a Hash), return directly
116
+ value
117
+ when /\AArray<(?<inner_type>.+)>\z/
118
+ inner_type = Regexp.last_match[:inner_type]
119
+ value.map { |v| _deserialize(inner_type, v) }
120
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
121
+ k_type = Regexp.last_match[:k_type]
122
+ v_type = Regexp.last_match[:v_type]
123
+ {}.tap do |hash|
124
+ value.each do |k, v|
125
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
126
+ end
127
+ end
128
+ else # model
129
+ _model = SwaggerClient.const_get(type).new
130
+ _model.build_from_hash(value)
131
+ end
132
+ end
133
+
134
+ def to_s
135
+ to_hash.to_s
136
+ end
137
+
138
+ # to_body is an alias to to_body (backward compatibility))
139
+ def to_body
140
+ to_hash
141
+ end
142
+
143
+ # return the object in the form of hash
144
+ def to_hash
145
+ hash = {}
146
+ self.class.attribute_map.each_pair do |attr, param|
147
+ value = self.send(attr)
148
+ next if value.nil?
149
+ hash[param] = _to_hash(value)
150
+ end
151
+ hash
152
+ end
153
+
154
+ # Method to output non-array value in the form of hash
155
+ # For object, use to_hash. Otherwise, just return the value
156
+ def _to_hash(value)
157
+ if value.is_a?(Array)
158
+ value.compact.map{ |v| _to_hash(v) }
159
+ elsif value.is_a?(Hash)
160
+ {}.tap do |hash|
161
+ value.each { |k, v| hash[k] = _to_hash(v) }
162
+ end
163
+ elsif value.respond_to? :to_hash
164
+ value.to_hash
165
+ else
166
+ value
167
+ end
168
+ end
169
+
170
+ end
171
+ end
@@ -0,0 +1,228 @@
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 PlotPoint
17
+ # Price
18
+ attr_accessor :price
19
+
20
+ # Miles
21
+ attr_accessor :miles
22
+
23
+ # Vin
24
+ attr_accessor :vin
25
+
26
+ # Msrp
27
+ attr_accessor :msrp
28
+
29
+ # DOM
30
+ attr_accessor :dom
31
+
32
+ # Seller name
33
+ attr_accessor :seller_name
34
+
35
+ # Listing id
36
+ attr_accessor :id
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+
42
+ :'price' => :'price',
43
+
44
+ :'miles' => :'miles',
45
+
46
+ :'vin' => :'vin',
47
+
48
+ :'msrp' => :'msrp',
49
+
50
+ :'dom' => :'dom',
51
+
52
+ :'seller_name' => :'seller_name',
53
+
54
+ :'id' => :'id'
55
+
56
+ }
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.swagger_types
61
+ {
62
+ :'price' => :'Float',
63
+ :'miles' => :'Float',
64
+ :'vin' => :'String',
65
+ :'msrp' => :'Float',
66
+ :'dom' => :'Float',
67
+ :'seller_name' => :'String',
68
+ :'id' => :'String'
69
+
70
+ }
71
+ end
72
+
73
+ def initialize(attributes = {})
74
+ return unless attributes.is_a?(Hash)
75
+
76
+ # convert string to symbol for hash key
77
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
78
+
79
+
80
+ if attributes[:'price']
81
+ self.price = attributes[:'price']
82
+ end
83
+
84
+ if attributes[:'miles']
85
+ self.miles = attributes[:'miles']
86
+ end
87
+
88
+ if attributes[:'vin']
89
+ self.vin = attributes[:'vin']
90
+ end
91
+
92
+ if attributes[:'msrp']
93
+ self.msrp = attributes[:'msrp']
94
+ end
95
+
96
+ if attributes[:'dom']
97
+ self.dom = attributes[:'dom']
98
+ end
99
+
100
+ if attributes[:'seller_name']
101
+ self.seller_name = attributes[:'seller_name']
102
+ end
103
+
104
+ if attributes[:'id']
105
+ self.id = attributes[:'id']
106
+ end
107
+
108
+ end
109
+
110
+ # Check equality by comparing each attribute.
111
+ def ==(o)
112
+ return true if self.equal?(o)
113
+ self.class == o.class &&
114
+ price == o.price &&
115
+ miles == o.miles &&
116
+ vin == o.vin &&
117
+ msrp == o.msrp &&
118
+ dom == o.dom &&
119
+ seller_name == o.seller_name &&
120
+ id == o.id
121
+ end
122
+
123
+ # @see the `==` method
124
+ def eql?(o)
125
+ self == o
126
+ end
127
+
128
+ # Calculate hash code according to all attributes.
129
+ def hash
130
+ [price, miles, vin, msrp, dom, seller_name, id].hash
131
+ end
132
+
133
+ # build the object from hash
134
+ def build_from_hash(attributes)
135
+ return nil unless attributes.is_a?(Hash)
136
+ self.class.swagger_types.each_pair do |key, type|
137
+ if type =~ /^Array<(.*)>/i
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
140
+ else
141
+ #TODO show warning in debug mode
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
+ else
146
+ # data not found in attributes(hash), not an issue as the data can be optional
147
+ end
148
+ end
149
+
150
+ self
151
+ end
152
+
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :DateTime
156
+ DateTime.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :BOOLEAN
166
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ _model = SwaggerClient.const_get(type).new
187
+ _model.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ def to_s
192
+ to_hash.to_s
193
+ end
194
+
195
+ # to_body is an alias to to_body (backward compatibility))
196
+ def to_body
197
+ to_hash
198
+ end
199
+
200
+ # return the object in the form of hash
201
+ def to_hash
202
+ hash = {}
203
+ self.class.attribute_map.each_pair do |attr, param|
204
+ value = self.send(attr)
205
+ next if value.nil?
206
+ hash[param] = _to_hash(value)
207
+ end
208
+ hash
209
+ end
210
+
211
+ # Method to output non-array value in the form of hash
212
+ # For object, use to_hash. Otherwise, just return the value
213
+ def _to_hash(value)
214
+ if value.is_a?(Array)
215
+ value.compact.map{ |v| _to_hash(v) }
216
+ elsif value.is_a?(Hash)
217
+ {}.tap do |hash|
218
+ value.each { |k, v| hash[k] = _to_hash(v) }
219
+ end
220
+ elsif value.respond_to? :to_hash
221
+ value.to_hash
222
+ else
223
+ value
224
+ end
225
+ end
226
+
227
+ end
228
+ end