dock_genius_api_ruby_client 0.1.1.pre.g582ac6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/README.md +200 -0
  4. data/dock_genius_api_ruby_client.gemspec +55 -0
  5. data/docs/AccessToken.md +11 -0
  6. data/docs/Address.md +16 -0
  7. data/docs/Customer.md +22 -0
  8. data/docs/CustomerApi.md +1938 -0
  9. data/docs/Dock.md +20 -0
  10. data/docs/DockApi.md +1112 -0
  11. data/docs/EmailAddress.md +9 -0
  12. data/docs/GeoPoint.md +9 -0
  13. data/docs/InlineResponse200.md +8 -0
  14. data/docs/InlineResponse2001.md +8 -0
  15. data/docs/InlineResponse2002.md +8 -0
  16. data/docs/ListingAgent.md +12 -0
  17. data/docs/Marina.md +15 -0
  18. data/docs/MarinaApi.md +1602 -0
  19. data/docs/Phone.md +9 -0
  20. data/git_push.sh +67 -0
  21. data/lib/dock_genius_api_ruby_client/api/customer_api.rb +2363 -0
  22. data/lib/dock_genius_api_ruby_client/api/dock_api.rb +1352 -0
  23. data/lib/dock_genius_api_ruby_client/api/marina_api.rb +1945 -0
  24. data/lib/dock_genius_api_ruby_client/api_client.rb +378 -0
  25. data/lib/dock_genius_api_ruby_client/api_error.rb +47 -0
  26. data/lib/dock_genius_api_ruby_client/configuration.rb +207 -0
  27. data/lib/dock_genius_api_ruby_client/models/access_token.rb +230 -0
  28. data/lib/dock_genius_api_ruby_client/models/address.rb +281 -0
  29. data/lib/dock_genius_api_ruby_client/models/customer.rb +330 -0
  30. data/lib/dock_genius_api_ruby_client/models/dock.rb +327 -0
  31. data/lib/dock_genius_api_ruby_client/models/email_address.rb +208 -0
  32. data/lib/dock_genius_api_ruby_client/models/geo_point.rb +208 -0
  33. data/lib/dock_genius_api_ruby_client/models/inline_response_200.rb +199 -0
  34. data/lib/dock_genius_api_ruby_client/models/inline_response_200_1.rb +200 -0
  35. data/lib/dock_genius_api_ruby_client/models/inline_response_200_2.rb +199 -0
  36. data/lib/dock_genius_api_ruby_client/models/listing_agent.rb +239 -0
  37. data/lib/dock_genius_api_ruby_client/models/marina.rb +263 -0
  38. data/lib/dock_genius_api_ruby_client/models/phone.rb +209 -0
  39. data/lib/dock_genius_api_ruby_client/version.rb +26 -0
  40. data/lib/dock_genius_api_ruby_client.rb +65 -0
  41. data/spec/api/customer_api_spec.rb +551 -0
  42. data/spec/api/dock_api_spec.rb +332 -0
  43. data/spec/api/marina_api_spec.rb +461 -0
  44. data/spec/api_client_spec.rb +237 -0
  45. data/spec/configuration_spec.rb +53 -0
  46. data/spec/models/access_token_spec.rb +71 -0
  47. data/spec/models/address_spec.rb +101 -0
  48. data/spec/models/customer_spec.rb +137 -0
  49. data/spec/models/dock_spec.rb +125 -0
  50. data/spec/models/email_address_spec.rb +59 -0
  51. data/spec/models/geo_point_spec.rb +59 -0
  52. data/spec/models/inline_response_200_1_spec.rb +53 -0
  53. data/spec/models/inline_response_200_2_spec.rb +53 -0
  54. data/spec/models/inline_response_200_spec.rb +53 -0
  55. data/spec/models/listing_agent_spec.rb +77 -0
  56. data/spec/models/marina_spec.rb +95 -0
  57. data/spec/models/phone_spec.rb +59 -0
  58. data/spec/spec_helper.rb +122 -0
  59. metadata +299 -0
@@ -0,0 +1,330 @@
1
+ =begin
2
+ #dockgenius-sl
3
+
4
+ #No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 0.1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'date'
25
+
26
+ module DockGeniusApiRubyClient
27
+
28
+ class Customer
29
+ attr_accessor :first_name
30
+
31
+ attr_accessor :last_name
32
+
33
+ attr_accessor :image_url
34
+
35
+ attr_accessor :realm
36
+
37
+ attr_accessor :username
38
+
39
+ attr_accessor :credentials
40
+
41
+ attr_accessor :challenges
42
+
43
+ attr_accessor :email
44
+
45
+ attr_accessor :email_verified
46
+
47
+ attr_accessor :status
48
+
49
+ attr_accessor :created
50
+
51
+ attr_accessor :last_updated
52
+
53
+ attr_accessor :id
54
+
55
+ attr_accessor :billing_address
56
+
57
+ attr_accessor :email_list
58
+
59
+
60
+ # Attribute mapping from ruby-style variable name to JSON key.
61
+ def self.attribute_map
62
+ {
63
+ :'first_name' => :'firstName',
64
+ :'last_name' => :'lastName',
65
+ :'image_url' => :'imageURL',
66
+ :'realm' => :'realm',
67
+ :'username' => :'username',
68
+ :'credentials' => :'credentials',
69
+ :'challenges' => :'challenges',
70
+ :'email' => :'email',
71
+ :'email_verified' => :'emailVerified',
72
+ :'status' => :'status',
73
+ :'created' => :'created',
74
+ :'last_updated' => :'lastUpdated',
75
+ :'id' => :'id',
76
+ :'billing_address' => :'billingAddress',
77
+ :'email_list' => :'emailList'
78
+ }
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.swagger_types
83
+ {
84
+ :'first_name' => :'String',
85
+ :'last_name' => :'String',
86
+ :'image_url' => :'String',
87
+ :'realm' => :'String',
88
+ :'username' => :'String',
89
+ :'credentials' => :'Object',
90
+ :'challenges' => :'Object',
91
+ :'email' => :'String',
92
+ :'email_verified' => :'BOOLEAN',
93
+ :'status' => :'String',
94
+ :'created' => :'Date',
95
+ :'last_updated' => :'Date',
96
+ :'id' => :'Float',
97
+ :'billing_address' => :'Address',
98
+ :'email_list' => :'Array<EmailAddress>'
99
+ }
100
+ end
101
+
102
+ # Initializes the object
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ def initialize(attributes = {})
105
+ return unless attributes.is_a?(Hash)
106
+
107
+ # convert string to symbol for hash key
108
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
109
+
110
+ if attributes.has_key?(:'firstName')
111
+ self.first_name = attributes[:'firstName']
112
+ end
113
+
114
+ if attributes.has_key?(:'lastName')
115
+ self.last_name = attributes[:'lastName']
116
+ end
117
+
118
+ if attributes.has_key?(:'imageURL')
119
+ self.image_url = attributes[:'imageURL']
120
+ end
121
+
122
+ if attributes.has_key?(:'realm')
123
+ self.realm = attributes[:'realm']
124
+ end
125
+
126
+ if attributes.has_key?(:'username')
127
+ self.username = attributes[:'username']
128
+ end
129
+
130
+ if attributes.has_key?(:'credentials')
131
+ self.credentials = attributes[:'credentials']
132
+ end
133
+
134
+ if attributes.has_key?(:'challenges')
135
+ self.challenges = attributes[:'challenges']
136
+ end
137
+
138
+ if attributes.has_key?(:'email')
139
+ self.email = attributes[:'email']
140
+ end
141
+
142
+ if attributes.has_key?(:'emailVerified')
143
+ self.email_verified = attributes[:'emailVerified']
144
+ end
145
+
146
+ if attributes.has_key?(:'status')
147
+ self.status = attributes[:'status']
148
+ end
149
+
150
+ if attributes.has_key?(:'created')
151
+ self.created = attributes[:'created']
152
+ end
153
+
154
+ if attributes.has_key?(:'lastUpdated')
155
+ self.last_updated = attributes[:'lastUpdated']
156
+ end
157
+
158
+ if attributes.has_key?(:'id')
159
+ self.id = attributes[:'id']
160
+ end
161
+
162
+ if attributes.has_key?(:'billingAddress')
163
+ self.billing_address = attributes[:'billingAddress']
164
+ end
165
+
166
+ if attributes.has_key?(:'emailList')
167
+ if (value = attributes[:'emailList']).is_a?(Array)
168
+ self.email_list = value
169
+ end
170
+ end
171
+
172
+ end
173
+
174
+ # Show invalid properties with the reasons. Usually used together with valid?
175
+ # @return Array for valid properies with the reasons
176
+ def list_invalid_properties
177
+ invalid_properties = Array.new
178
+ return invalid_properties
179
+ end
180
+
181
+ # Check to see if the all the properties in the model are valid
182
+ # @return true if the model is valid
183
+ def valid?
184
+ return false if @first_name.nil?
185
+ return false if @last_name.nil?
186
+ return false if @email.nil?
187
+ return true
188
+ end
189
+
190
+ # Checks equality by comparing each attribute.
191
+ # @param [Object] Object to be compared
192
+ def ==(o)
193
+ return true if self.equal?(o)
194
+ self.class == o.class &&
195
+ first_name == o.first_name &&
196
+ last_name == o.last_name &&
197
+ image_url == o.image_url &&
198
+ realm == o.realm &&
199
+ username == o.username &&
200
+ credentials == o.credentials &&
201
+ challenges == o.challenges &&
202
+ email == o.email &&
203
+ email_verified == o.email_verified &&
204
+ status == o.status &&
205
+ created == o.created &&
206
+ last_updated == o.last_updated &&
207
+ id == o.id &&
208
+ billing_address == o.billing_address &&
209
+ email_list == o.email_list
210
+ end
211
+
212
+ # @see the `==` method
213
+ # @param [Object] Object to be compared
214
+ def eql?(o)
215
+ self == o
216
+ end
217
+
218
+ # Calculates hash code according to all attributes.
219
+ # @return [Fixnum] Hash code
220
+ def hash
221
+ [first_name, last_name, image_url, realm, username, credentials, challenges, email, email_verified, status, created, last_updated, id, billing_address, email_list].hash
222
+ end
223
+
224
+ # Builds the object from hash
225
+ # @param [Hash] attributes Model attributes in the form of hash
226
+ # @return [Object] Returns the model itself
227
+ def build_from_hash(attributes)
228
+ return nil unless attributes.is_a?(Hash)
229
+ self.class.swagger_types.each_pair do |key, type|
230
+ if type =~ /^Array<(.*)>/i
231
+ # check to ensure the input is an array given that the the attribute
232
+ # is documented as an array but the input is not
233
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
234
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
235
+ end
236
+ elsif !attributes[self.class.attribute_map[key]].nil?
237
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
238
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
239
+ end
240
+
241
+ self
242
+ end
243
+
244
+ # Deserializes the data based on type
245
+ # @param string type Data type
246
+ # @param string value Value to be deserialized
247
+ # @return [Object] Deserialized data
248
+ def _deserialize(type, value)
249
+ case type.to_sym
250
+ when :DateTime
251
+ DateTime.parse(value)
252
+ when :Date
253
+ Date.parse(value)
254
+ when :String
255
+ value.to_s
256
+ when :Integer
257
+ value.to_i
258
+ when :Float
259
+ value.to_f
260
+ when :BOOLEAN
261
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
262
+ true
263
+ else
264
+ false
265
+ end
266
+ when :Object
267
+ # generic object (usually a Hash), return directly
268
+ value
269
+ when /\AArray<(?<inner_type>.+)>\z/
270
+ inner_type = Regexp.last_match[:inner_type]
271
+ value.map { |v| _deserialize(inner_type, v) }
272
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
273
+ k_type = Regexp.last_match[:k_type]
274
+ v_type = Regexp.last_match[:v_type]
275
+ {}.tap do |hash|
276
+ value.each do |k, v|
277
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
278
+ end
279
+ end
280
+ else # model
281
+ temp_model = DockGeniusApiRubyClient.const_get(type).new
282
+ temp_model.build_from_hash(value)
283
+ end
284
+ end
285
+
286
+ # Returns the string representation of the object
287
+ # @return [String] String presentation of the object
288
+ def to_s
289
+ to_hash.to_s
290
+ end
291
+
292
+ # to_body is an alias to to_hash (backward compatibility)
293
+ # @return [Hash] Returns the object in the form of hash
294
+ def to_body
295
+ to_hash
296
+ end
297
+
298
+ # Returns the object in the form of hash
299
+ # @return [Hash] Returns 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
+ # Outputs non-array value in the form of hash
311
+ # For object, use to_hash. Otherwise, just return the value
312
+ # @param [Object] value Any valid value
313
+ # @return [Hash] Returns the value in the form of hash
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
+
330
+ end
@@ -0,0 +1,327 @@
1
+ =begin
2
+ #dockgenius-sl
3
+
4
+ #No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 0.1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ =end
23
+
24
+ require 'date'
25
+
26
+ module DockGeniusApiRubyClient
27
+ # This class describes a physical dock or slip.
28
+ class Dock
29
+ attr_accessor :id
30
+
31
+ # The name given to the dock (usually by a marina with many docks).
32
+ attr_accessor :common_name
33
+
34
+ # The URL to the image that shows this dock
35
+ attr_accessor :image_url
36
+
37
+ # The coordinates of this dock. If a boundary GeoJSON is provided, this attribute may be overridden at creation or update
38
+ attr_accessor :location
39
+
40
+ # A GeoJSON fragment representing the boundary of the slip. If this attribute is provided at creation or update it overrides the location
41
+ attr_accessor :boundary_geo_json
42
+
43
+ # Indicates if it is a slip (true) or a dock (false)
44
+ attr_accessor :is_slip
45
+
46
+ # Indicates if it is listed for rent
47
+ attr_accessor :for_rent
48
+
49
+ # Indicates if it is listed for sale
50
+ attr_accessor :for_sale
51
+
52
+ attr_accessor :source
53
+
54
+ attr_accessor :created
55
+
56
+ attr_accessor :last_updated
57
+
58
+ attr_accessor :marina_id
59
+
60
+ attr_accessor :_listing_agent
61
+
62
+
63
+ # Attribute mapping from ruby-style variable name to JSON key.
64
+ def self.attribute_map
65
+ {
66
+ :'id' => :'id',
67
+ :'common_name' => :'commonName',
68
+ :'image_url' => :'imageURL',
69
+ :'location' => :'location',
70
+ :'boundary_geo_json' => :'boundaryGeoJSON',
71
+ :'is_slip' => :'isSlip',
72
+ :'for_rent' => :'forRent',
73
+ :'for_sale' => :'forSale',
74
+ :'source' => :'source',
75
+ :'created' => :'created',
76
+ :'last_updated' => :'lastUpdated',
77
+ :'marina_id' => :'marinaId',
78
+ :'_listing_agent' => :'_listingAgent'
79
+ }
80
+ end
81
+
82
+ # Attribute type mapping.
83
+ def self.swagger_types
84
+ {
85
+ :'id' => :'Float',
86
+ :'common_name' => :'String',
87
+ :'image_url' => :'String',
88
+ :'location' => :'GeoPoint',
89
+ :'boundary_geo_json' => :'String',
90
+ :'is_slip' => :'BOOLEAN',
91
+ :'for_rent' => :'BOOLEAN',
92
+ :'for_sale' => :'BOOLEAN',
93
+ :'source' => :'String',
94
+ :'created' => :'Date',
95
+ :'last_updated' => :'Date',
96
+ :'marina_id' => :'Float',
97
+ :'_listing_agent' => :'ListingAgent'
98
+ }
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ return unless attributes.is_a?(Hash)
105
+
106
+ # convert string to symbol for hash key
107
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
108
+
109
+ if attributes.has_key?(:'id')
110
+ self.id = attributes[:'id']
111
+ end
112
+
113
+ if attributes.has_key?(:'commonName')
114
+ self.common_name = attributes[:'commonName']
115
+ else
116
+ self.common_name = ""
117
+ end
118
+
119
+ if attributes.has_key?(:'imageURL')
120
+ self.image_url = attributes[:'imageURL']
121
+ end
122
+
123
+ if attributes.has_key?(:'location')
124
+ self.location = attributes[:'location']
125
+ end
126
+
127
+ if attributes.has_key?(:'boundaryGeoJSON')
128
+ self.boundary_geo_json = attributes[:'boundaryGeoJSON']
129
+ end
130
+
131
+ if attributes.has_key?(:'isSlip')
132
+ self.is_slip = attributes[:'isSlip']
133
+ else
134
+ self.is_slip = false
135
+ end
136
+
137
+ if attributes.has_key?(:'forRent')
138
+ self.for_rent = attributes[:'forRent']
139
+ else
140
+ self.for_rent = false
141
+ end
142
+
143
+ if attributes.has_key?(:'forSale')
144
+ self.for_sale = attributes[:'forSale']
145
+ else
146
+ self.for_sale = false
147
+ end
148
+
149
+ if attributes.has_key?(:'source')
150
+ self.source = attributes[:'source']
151
+ end
152
+
153
+ if attributes.has_key?(:'created')
154
+ self.created = attributes[:'created']
155
+ end
156
+
157
+ if attributes.has_key?(:'lastUpdated')
158
+ self.last_updated = attributes[:'lastUpdated']
159
+ end
160
+
161
+ if attributes.has_key?(:'marinaId')
162
+ self.marina_id = attributes[:'marinaId']
163
+ end
164
+
165
+ if attributes.has_key?(:'_listingAgent')
166
+ self._listing_agent = attributes[:'_listingAgent']
167
+ end
168
+
169
+ end
170
+
171
+ # Show invalid properties with the reasons. Usually used together with valid?
172
+ # @return Array for valid properies with the reasons
173
+ def list_invalid_properties
174
+ invalid_properties = Array.new
175
+ return invalid_properties
176
+ end
177
+
178
+ # Check to see if the all the properties in the model are valid
179
+ # @return true if the model is valid
180
+ def valid?
181
+ return false if @common_name.nil?
182
+ return false if @location.nil?
183
+ return false if @is_slip.nil?
184
+ return false if @for_rent.nil?
185
+ return false if @for_sale.nil?
186
+ return true
187
+ end
188
+
189
+ # Checks equality by comparing each attribute.
190
+ # @param [Object] Object to be compared
191
+ def ==(o)
192
+ return true if self.equal?(o)
193
+ self.class == o.class &&
194
+ id == o.id &&
195
+ common_name == o.common_name &&
196
+ image_url == o.image_url &&
197
+ location == o.location &&
198
+ boundary_geo_json == o.boundary_geo_json &&
199
+ is_slip == o.is_slip &&
200
+ for_rent == o.for_rent &&
201
+ for_sale == o.for_sale &&
202
+ source == o.source &&
203
+ created == o.created &&
204
+ last_updated == o.last_updated &&
205
+ marina_id == o.marina_id &&
206
+ _listing_agent == o._listing_agent
207
+ end
208
+
209
+ # @see the `==` method
210
+ # @param [Object] Object to be compared
211
+ def eql?(o)
212
+ self == o
213
+ end
214
+
215
+ # Calculates hash code according to all attributes.
216
+ # @return [Fixnum] Hash code
217
+ def hash
218
+ [id, common_name, image_url, location, boundary_geo_json, is_slip, for_rent, for_sale, source, created, last_updated, marina_id, _listing_agent].hash
219
+ end
220
+
221
+ # Builds the object from hash
222
+ # @param [Hash] attributes Model attributes in the form of hash
223
+ # @return [Object] Returns the model itself
224
+ def build_from_hash(attributes)
225
+ return nil unless attributes.is_a?(Hash)
226
+ self.class.swagger_types.each_pair do |key, type|
227
+ if type =~ /^Array<(.*)>/i
228
+ # check to ensure the input is an array given that the the attribute
229
+ # is documented as an array but the input is not
230
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
231
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
232
+ end
233
+ elsif !attributes[self.class.attribute_map[key]].nil?
234
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
235
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
236
+ end
237
+
238
+ self
239
+ end
240
+
241
+ # Deserializes the data based on type
242
+ # @param string type Data type
243
+ # @param string value Value to be deserialized
244
+ # @return [Object] Deserialized data
245
+ def _deserialize(type, value)
246
+ case type.to_sym
247
+ when :DateTime
248
+ DateTime.parse(value)
249
+ when :Date
250
+ Date.parse(value)
251
+ when :String
252
+ value.to_s
253
+ when :Integer
254
+ value.to_i
255
+ when :Float
256
+ value.to_f
257
+ when :BOOLEAN
258
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
259
+ true
260
+ else
261
+ false
262
+ end
263
+ when :Object
264
+ # generic object (usually a Hash), return directly
265
+ value
266
+ when /\AArray<(?<inner_type>.+)>\z/
267
+ inner_type = Regexp.last_match[:inner_type]
268
+ value.map { |v| _deserialize(inner_type, v) }
269
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
270
+ k_type = Regexp.last_match[:k_type]
271
+ v_type = Regexp.last_match[:v_type]
272
+ {}.tap do |hash|
273
+ value.each do |k, v|
274
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
275
+ end
276
+ end
277
+ else # model
278
+ temp_model = DockGeniusApiRubyClient.const_get(type).new
279
+ temp_model.build_from_hash(value)
280
+ end
281
+ end
282
+
283
+ # Returns the string representation of the object
284
+ # @return [String] String presentation of the object
285
+ def to_s
286
+ to_hash.to_s
287
+ end
288
+
289
+ # to_body is an alias to to_hash (backward compatibility)
290
+ # @return [Hash] Returns the object in the form of hash
291
+ def to_body
292
+ to_hash
293
+ end
294
+
295
+ # Returns the object in the form of hash
296
+ # @return [Hash] Returns the object in the form of hash
297
+ def to_hash
298
+ hash = {}
299
+ self.class.attribute_map.each_pair do |attr, param|
300
+ value = self.send(attr)
301
+ next if value.nil?
302
+ hash[param] = _to_hash(value)
303
+ end
304
+ hash
305
+ end
306
+
307
+ # Outputs non-array value in the form of hash
308
+ # For object, use to_hash. Otherwise, just return the value
309
+ # @param [Object] value Any valid value
310
+ # @return [Hash] Returns the value in the form of hash
311
+ def _to_hash(value)
312
+ if value.is_a?(Array)
313
+ value.compact.map{ |v| _to_hash(v) }
314
+ elsif value.is_a?(Hash)
315
+ {}.tap do |hash|
316
+ value.each { |k, v| hash[k] = _to_hash(v) }
317
+ end
318
+ elsif value.respond_to? :to_hash
319
+ value.to_hash
320
+ else
321
+ value
322
+ end
323
+ end
324
+
325
+ end
326
+
327
+ end