app_token_api 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/app_token_api.gemspec +1 -1
- data/lib/admin_api/api/app_token_api.rb +2 -2
- data/lib/admin_api/api/auto_generate_app_token_api.rb +2 -2
- data/lib/admin_api/api/card_api.rb +371 -0
- data/lib/admin_api/api/client_api.rb +368 -0
- data/lib/admin_api/api_client.rb +2 -2
- data/lib/admin_api/api_error.rb +1 -1
- data/lib/admin_api/auth_configuration.rb +4 -4
- data/lib/admin_api/configuration.rb +2 -2
- data/lib/admin_api/models/app_token.rb +1 -1
- data/lib/admin_api/models/card.rb +499 -0
- data/lib/admin_api/models/card_address.rb +271 -0
- data/lib/admin_api/models/client.rb +557 -0
- data/lib/admin_api/models/client_address.rb +281 -0
- data/lib/admin_api/models/employment.rb +216 -0
- data/lib/admin_api/models/page_card.rb +261 -0
- data/lib/admin_api/models/page_client.rb +261 -0
- data/lib/admin_api/models/sort.rb +236 -0
- data/lib/admin_api/version.rb +2 -2
- data/lib/admin_api.rb +1 -1
- data/spec/api/app_token_api_spec.rb +1 -1
- data/spec/api/card_api_spec.rb +88 -0
- data/spec/api/client_api_spec.rb +20 -27
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +4 -4
- data/spec/models/app_token_spec.rb +1 -1
- data/spec/models/card_address_spec.rb +77 -0
- data/spec/models/card_spec.rb +215 -0
- data/spec/models/client_address_spec.rb +83 -0
- data/spec/models/client_spec.rb +162 -6
- data/spec/models/employment_spec.rb +59 -0
- data/spec/models/page_card_spec.rb +89 -0
- data/spec/models/page_client_spec.rb +1 -1
- data/spec/models/sort_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +24 -2
@@ -0,0 +1,557 @@
|
|
1
|
+
=begin
|
2
|
+
#Hydrogen Admin API
|
3
|
+
|
4
|
+
#The Hydrogen Admin API
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0.2
|
7
|
+
Contact: info@hydrogenplatform.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.15
|
10
|
+
|
11
|
+
=end
|
12
|
+
require 'date'
|
13
|
+
|
14
|
+
module AdminApi
|
15
|
+
# Client Object
|
16
|
+
class Client
|
17
|
+
attr_accessor :address
|
18
|
+
|
19
|
+
# authorities
|
20
|
+
attr_accessor :authorities
|
21
|
+
|
22
|
+
# business_id
|
23
|
+
attr_accessor :business_id
|
24
|
+
|
25
|
+
# citizenshipStatus
|
26
|
+
attr_accessor :citizenship_status
|
27
|
+
|
28
|
+
# clientTypeId
|
29
|
+
attr_accessor :client_type
|
30
|
+
|
31
|
+
# countryOfCitizenship
|
32
|
+
attr_accessor :country_of_citizenship
|
33
|
+
|
34
|
+
# countryOfResidence
|
35
|
+
attr_accessor :country_of_residence
|
36
|
+
|
37
|
+
attr_accessor :create_date
|
38
|
+
|
39
|
+
# dateOfBirth
|
40
|
+
attr_accessor :date_of_birth
|
41
|
+
|
42
|
+
# email
|
43
|
+
attr_accessor :email
|
44
|
+
|
45
|
+
attr_accessor :employment
|
46
|
+
|
47
|
+
# firmName
|
48
|
+
attr_accessor :firm_name
|
49
|
+
|
50
|
+
# firmType
|
51
|
+
attr_accessor :firm_type
|
52
|
+
|
53
|
+
# firstName
|
54
|
+
attr_accessor :first_name
|
55
|
+
|
56
|
+
# gender
|
57
|
+
attr_accessor :gender
|
58
|
+
|
59
|
+
# group
|
60
|
+
attr_accessor :group
|
61
|
+
|
62
|
+
# hydroId
|
63
|
+
attr_accessor :hydro_id
|
64
|
+
|
65
|
+
attr_accessor :id
|
66
|
+
|
67
|
+
# identificationNumber
|
68
|
+
attr_accessor :identification_number
|
69
|
+
|
70
|
+
# identificationNumberType
|
71
|
+
attr_accessor :identification_number_type
|
72
|
+
|
73
|
+
# image
|
74
|
+
attr_accessor :image
|
75
|
+
|
76
|
+
# income
|
77
|
+
attr_accessor :income
|
78
|
+
|
79
|
+
# isActive
|
80
|
+
attr_accessor :is_active
|
81
|
+
|
82
|
+
# isVerified
|
83
|
+
attr_accessor :is_verified
|
84
|
+
|
85
|
+
# last_name
|
86
|
+
attr_accessor :last_name
|
87
|
+
|
88
|
+
# liquidNetWorth
|
89
|
+
attr_accessor :liquid_net_worth
|
90
|
+
|
91
|
+
# metadata
|
92
|
+
attr_accessor :metadata
|
93
|
+
|
94
|
+
# middleName
|
95
|
+
attr_accessor :middle_name
|
96
|
+
|
97
|
+
# password
|
98
|
+
attr_accessor :password
|
99
|
+
|
100
|
+
# phoneNumber
|
101
|
+
attr_accessor :phone_number
|
102
|
+
|
103
|
+
attr_accessor :secondary_id
|
104
|
+
|
105
|
+
# status
|
106
|
+
attr_accessor :status
|
107
|
+
|
108
|
+
# suffix
|
109
|
+
attr_accessor :suffix
|
110
|
+
|
111
|
+
# title
|
112
|
+
attr_accessor :title
|
113
|
+
|
114
|
+
# totalNetWorth
|
115
|
+
attr_accessor :total_net_worth
|
116
|
+
|
117
|
+
attr_accessor :update_date
|
118
|
+
|
119
|
+
# username
|
120
|
+
attr_accessor :username
|
121
|
+
|
122
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
123
|
+
def self.attribute_map
|
124
|
+
{
|
125
|
+
:'address' => :'address',
|
126
|
+
:'authorities' => :'authorities',
|
127
|
+
:'business_id' => :'business_id',
|
128
|
+
:'citizenship_status' => :'citizenship_status',
|
129
|
+
:'client_type' => :'client_type',
|
130
|
+
:'country_of_citizenship' => :'country_of_citizenship',
|
131
|
+
:'country_of_residence' => :'country_of_residence',
|
132
|
+
:'create_date' => :'create_date',
|
133
|
+
:'date_of_birth' => :'date_of_birth',
|
134
|
+
:'email' => :'email',
|
135
|
+
:'employment' => :'employment',
|
136
|
+
:'firm_name' => :'firm_name',
|
137
|
+
:'firm_type' => :'firm_type',
|
138
|
+
:'first_name' => :'first_name',
|
139
|
+
:'gender' => :'gender',
|
140
|
+
:'group' => :'group',
|
141
|
+
:'hydro_id' => :'hydro_id',
|
142
|
+
:'id' => :'id',
|
143
|
+
:'identification_number' => :'identification_number',
|
144
|
+
:'identification_number_type' => :'identification_number_type',
|
145
|
+
:'image' => :'image',
|
146
|
+
:'income' => :'income',
|
147
|
+
:'is_active' => :'is_active',
|
148
|
+
:'is_verified' => :'is_verified',
|
149
|
+
:'last_name' => :'last_name',
|
150
|
+
:'liquid_net_worth' => :'liquid_net_worth',
|
151
|
+
:'metadata' => :'metadata',
|
152
|
+
:'middle_name' => :'middle_name',
|
153
|
+
:'password' => :'password',
|
154
|
+
:'phone_number' => :'phone_number',
|
155
|
+
:'secondary_id' => :'secondary_id',
|
156
|
+
:'status' => :'status',
|
157
|
+
:'suffix' => :'suffix',
|
158
|
+
:'title' => :'title',
|
159
|
+
:'total_net_worth' => :'total_net_worth',
|
160
|
+
:'update_date' => :'update_date',
|
161
|
+
:'username' => :'username'
|
162
|
+
}
|
163
|
+
end
|
164
|
+
|
165
|
+
# Attribute type mapping.
|
166
|
+
def self.swagger_types
|
167
|
+
{
|
168
|
+
:'address' => :'Array<ClientAddress>',
|
169
|
+
:'authorities' => :'Array<String>',
|
170
|
+
:'business_id' => :'String',
|
171
|
+
:'citizenship_status' => :'String',
|
172
|
+
:'client_type' => :'String',
|
173
|
+
:'country_of_citizenship' => :'Array<String>',
|
174
|
+
:'country_of_residence' => :'String',
|
175
|
+
:'create_date' => :'DateTime',
|
176
|
+
:'date_of_birth' => :'String',
|
177
|
+
:'email' => :'String',
|
178
|
+
:'employment' => :'Employment',
|
179
|
+
:'firm_name' => :'String',
|
180
|
+
:'firm_type' => :'String',
|
181
|
+
:'first_name' => :'String',
|
182
|
+
:'gender' => :'String',
|
183
|
+
:'group' => :'Array<String>',
|
184
|
+
:'hydro_id' => :'String',
|
185
|
+
:'id' => :'String',
|
186
|
+
:'identification_number' => :'String',
|
187
|
+
:'identification_number_type' => :'String',
|
188
|
+
:'image' => :'String',
|
189
|
+
:'income' => :'Integer',
|
190
|
+
:'is_active' => :'BOOLEAN',
|
191
|
+
:'is_verified' => :'BOOLEAN',
|
192
|
+
:'last_name' => :'String',
|
193
|
+
:'liquid_net_worth' => :'Float',
|
194
|
+
:'metadata' => :'Hash<String, String>',
|
195
|
+
:'middle_name' => :'String',
|
196
|
+
:'password' => :'String',
|
197
|
+
:'phone_number' => :'String',
|
198
|
+
:'secondary_id' => :'String',
|
199
|
+
:'status' => :'String',
|
200
|
+
:'suffix' => :'String',
|
201
|
+
:'title' => :'String',
|
202
|
+
:'total_net_worth' => :'Float',
|
203
|
+
:'update_date' => :'DateTime',
|
204
|
+
:'username' => :'String'
|
205
|
+
}
|
206
|
+
end
|
207
|
+
|
208
|
+
# Initializes the object
|
209
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
210
|
+
def initialize(attributes = {})
|
211
|
+
return unless attributes.is_a?(Hash)
|
212
|
+
|
213
|
+
# convert string to symbol for hash key
|
214
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
215
|
+
|
216
|
+
if attributes.has_key?(:'address')
|
217
|
+
if (value = attributes[:'address']).is_a?(Array)
|
218
|
+
self.address = value
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
if attributes.has_key?(:'authorities')
|
223
|
+
if (value = attributes[:'authorities']).is_a?(Array)
|
224
|
+
self.authorities = value
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
if attributes.has_key?(:'business_id')
|
229
|
+
self.business_id = attributes[:'business_id']
|
230
|
+
end
|
231
|
+
|
232
|
+
if attributes.has_key?(:'citizenship_status')
|
233
|
+
self.citizenship_status = attributes[:'citizenship_status']
|
234
|
+
end
|
235
|
+
|
236
|
+
if attributes.has_key?(:'client_type')
|
237
|
+
self.client_type = attributes[:'client_type']
|
238
|
+
end
|
239
|
+
|
240
|
+
if attributes.has_key?(:'country_of_citizenship')
|
241
|
+
if (value = attributes[:'country_of_citizenship']).is_a?(Array)
|
242
|
+
self.country_of_citizenship = value
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
if attributes.has_key?(:'country_of_residence')
|
247
|
+
self.country_of_residence = attributes[:'country_of_residence']
|
248
|
+
end
|
249
|
+
|
250
|
+
if attributes.has_key?(:'create_date')
|
251
|
+
self.create_date = attributes[:'create_date']
|
252
|
+
end
|
253
|
+
|
254
|
+
if attributes.has_key?(:'date_of_birth')
|
255
|
+
self.date_of_birth = attributes[:'date_of_birth']
|
256
|
+
end
|
257
|
+
|
258
|
+
if attributes.has_key?(:'email')
|
259
|
+
self.email = attributes[:'email']
|
260
|
+
end
|
261
|
+
|
262
|
+
if attributes.has_key?(:'employment')
|
263
|
+
self.employment = attributes[:'employment']
|
264
|
+
end
|
265
|
+
|
266
|
+
if attributes.has_key?(:'firm_name')
|
267
|
+
self.firm_name = attributes[:'firm_name']
|
268
|
+
end
|
269
|
+
|
270
|
+
if attributes.has_key?(:'firm_type')
|
271
|
+
self.firm_type = attributes[:'firm_type']
|
272
|
+
end
|
273
|
+
|
274
|
+
if attributes.has_key?(:'first_name')
|
275
|
+
self.first_name = attributes[:'first_name']
|
276
|
+
end
|
277
|
+
|
278
|
+
if attributes.has_key?(:'gender')
|
279
|
+
self.gender = attributes[:'gender']
|
280
|
+
end
|
281
|
+
|
282
|
+
if attributes.has_key?(:'group')
|
283
|
+
if (value = attributes[:'group']).is_a?(Array)
|
284
|
+
self.group = value
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
288
|
+
if attributes.has_key?(:'hydro_id')
|
289
|
+
self.hydro_id = attributes[:'hydro_id']
|
290
|
+
end
|
291
|
+
|
292
|
+
if attributes.has_key?(:'id')
|
293
|
+
self.id = attributes[:'id']
|
294
|
+
end
|
295
|
+
|
296
|
+
if attributes.has_key?(:'identification_number')
|
297
|
+
self.identification_number = attributes[:'identification_number']
|
298
|
+
end
|
299
|
+
|
300
|
+
if attributes.has_key?(:'identification_number_type')
|
301
|
+
self.identification_number_type = attributes[:'identification_number_type']
|
302
|
+
end
|
303
|
+
|
304
|
+
if attributes.has_key?(:'image')
|
305
|
+
self.image = attributes[:'image']
|
306
|
+
end
|
307
|
+
|
308
|
+
if attributes.has_key?(:'income')
|
309
|
+
self.income = attributes[:'income']
|
310
|
+
end
|
311
|
+
|
312
|
+
if attributes.has_key?(:'is_active')
|
313
|
+
self.is_active = attributes[:'is_active']
|
314
|
+
end
|
315
|
+
|
316
|
+
if attributes.has_key?(:'is_verified')
|
317
|
+
self.is_verified = attributes[:'is_verified']
|
318
|
+
end
|
319
|
+
|
320
|
+
if attributes.has_key?(:'last_name')
|
321
|
+
self.last_name = attributes[:'last_name']
|
322
|
+
end
|
323
|
+
|
324
|
+
if attributes.has_key?(:'liquid_net_worth')
|
325
|
+
self.liquid_net_worth = attributes[:'liquid_net_worth']
|
326
|
+
end
|
327
|
+
|
328
|
+
if attributes.has_key?(:'metadata')
|
329
|
+
if (value = attributes[:'metadata']).is_a?(Hash)
|
330
|
+
self.metadata = value
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
if attributes.has_key?(:'middle_name')
|
335
|
+
self.middle_name = attributes[:'middle_name']
|
336
|
+
end
|
337
|
+
|
338
|
+
if attributes.has_key?(:'password')
|
339
|
+
self.password = attributes[:'password']
|
340
|
+
end
|
341
|
+
|
342
|
+
if attributes.has_key?(:'phone_number')
|
343
|
+
self.phone_number = attributes[:'phone_number']
|
344
|
+
end
|
345
|
+
|
346
|
+
if attributes.has_key?(:'secondary_id')
|
347
|
+
self.secondary_id = attributes[:'secondary_id']
|
348
|
+
end
|
349
|
+
|
350
|
+
if attributes.has_key?(:'status')
|
351
|
+
self.status = attributes[:'status']
|
352
|
+
end
|
353
|
+
|
354
|
+
if attributes.has_key?(:'suffix')
|
355
|
+
self.suffix = attributes[:'suffix']
|
356
|
+
end
|
357
|
+
|
358
|
+
if attributes.has_key?(:'title')
|
359
|
+
self.title = attributes[:'title']
|
360
|
+
end
|
361
|
+
|
362
|
+
if attributes.has_key?(:'total_net_worth')
|
363
|
+
self.total_net_worth = attributes[:'total_net_worth']
|
364
|
+
end
|
365
|
+
|
366
|
+
if attributes.has_key?(:'update_date')
|
367
|
+
self.update_date = attributes[:'update_date']
|
368
|
+
end
|
369
|
+
|
370
|
+
if attributes.has_key?(:'username')
|
371
|
+
self.username = attributes[:'username']
|
372
|
+
end
|
373
|
+
end
|
374
|
+
|
375
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
376
|
+
# @return Array for valid properties with the reasons
|
377
|
+
def list_invalid_properties
|
378
|
+
invalid_properties = Array.new
|
379
|
+
if @client_type.nil?
|
380
|
+
invalid_properties.push('invalid value for "client_type", client_type cannot be nil.')
|
381
|
+
end
|
382
|
+
|
383
|
+
if @username.nil?
|
384
|
+
invalid_properties.push('invalid value for "username", username cannot be nil.')
|
385
|
+
end
|
386
|
+
|
387
|
+
invalid_properties
|
388
|
+
end
|
389
|
+
|
390
|
+
# Check to see if the all the properties in the model are valid
|
391
|
+
# @return true if the model is valid
|
392
|
+
def valid?
|
393
|
+
return false if @client_type.nil?
|
394
|
+
return false if @username.nil?
|
395
|
+
true
|
396
|
+
end
|
397
|
+
|
398
|
+
# Checks equality by comparing each attribute.
|
399
|
+
# @param [Object] Object to be compared
|
400
|
+
def ==(o)
|
401
|
+
return true if self.equal?(o)
|
402
|
+
self.class == o.class &&
|
403
|
+
address == o.address &&
|
404
|
+
authorities == o.authorities &&
|
405
|
+
business_id == o.business_id &&
|
406
|
+
citizenship_status == o.citizenship_status &&
|
407
|
+
client_type == o.client_type &&
|
408
|
+
country_of_citizenship == o.country_of_citizenship &&
|
409
|
+
country_of_residence == o.country_of_residence &&
|
410
|
+
create_date == o.create_date &&
|
411
|
+
date_of_birth == o.date_of_birth &&
|
412
|
+
email == o.email &&
|
413
|
+
employment == o.employment &&
|
414
|
+
firm_name == o.firm_name &&
|
415
|
+
firm_type == o.firm_type &&
|
416
|
+
first_name == o.first_name &&
|
417
|
+
gender == o.gender &&
|
418
|
+
group == o.group &&
|
419
|
+
hydro_id == o.hydro_id &&
|
420
|
+
id == o.id &&
|
421
|
+
identification_number == o.identification_number &&
|
422
|
+
identification_number_type == o.identification_number_type &&
|
423
|
+
image == o.image &&
|
424
|
+
income == o.income &&
|
425
|
+
is_active == o.is_active &&
|
426
|
+
is_verified == o.is_verified &&
|
427
|
+
last_name == o.last_name &&
|
428
|
+
liquid_net_worth == o.liquid_net_worth &&
|
429
|
+
metadata == o.metadata &&
|
430
|
+
middle_name == o.middle_name &&
|
431
|
+
password == o.password &&
|
432
|
+
phone_number == o.phone_number &&
|
433
|
+
secondary_id == o.secondary_id &&
|
434
|
+
status == o.status &&
|
435
|
+
suffix == o.suffix &&
|
436
|
+
title == o.title &&
|
437
|
+
total_net_worth == o.total_net_worth &&
|
438
|
+
update_date == o.update_date &&
|
439
|
+
username == o.username
|
440
|
+
end
|
441
|
+
|
442
|
+
# @see the `==` method
|
443
|
+
# @param [Object] Object to be compared
|
444
|
+
def eql?(o)
|
445
|
+
self == o
|
446
|
+
end
|
447
|
+
|
448
|
+
# Calculates hash code according to all attributes.
|
449
|
+
# @return [Fixnum] Hash code
|
450
|
+
def hash
|
451
|
+
[address, authorities, business_id, citizenship_status, client_type, country_of_citizenship, country_of_residence, create_date, date_of_birth, email, employment, firm_name, firm_type, first_name, gender, group, hydro_id, id, identification_number, identification_number_type, image, income, is_active, is_verified, last_name, liquid_net_worth, metadata, middle_name, password, phone_number, secondary_id, status, suffix, title, total_net_worth, update_date, username].hash
|
452
|
+
end
|
453
|
+
|
454
|
+
# Builds the object from hash
|
455
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
456
|
+
# @return [Object] Returns the model itself
|
457
|
+
def build_from_hash(attributes)
|
458
|
+
self.class.swagger_types.each_pair do |key, type|
|
459
|
+
if type =~ /\AArray<(.*)>/i
|
460
|
+
# check to ensure the input is an array given that the attribute
|
461
|
+
# is documented as an array but the input is not
|
462
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
463
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
464
|
+
end
|
465
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
466
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
467
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
468
|
+
end
|
469
|
+
|
470
|
+
self
|
471
|
+
end
|
472
|
+
|
473
|
+
# Deserializes the data based on type
|
474
|
+
# @param string type Data type
|
475
|
+
# @param string value Value to be deserialized
|
476
|
+
# @return [Object] Deserialized data
|
477
|
+
def _deserialize(type, value)
|
478
|
+
case type.to_sym
|
479
|
+
when :DateTime
|
480
|
+
(value)
|
481
|
+
when :Date
|
482
|
+
(value)
|
483
|
+
when :String
|
484
|
+
value.to_s
|
485
|
+
when :Integer
|
486
|
+
value.to_i
|
487
|
+
when :Float
|
488
|
+
value.to_f
|
489
|
+
when :BOOLEAN
|
490
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
491
|
+
true
|
492
|
+
else
|
493
|
+
false
|
494
|
+
end
|
495
|
+
when :Object
|
496
|
+
# generic object (usually a Hash), return directly
|
497
|
+
value
|
498
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
499
|
+
inner_type = Regexp.last_match[:inner_type]
|
500
|
+
value.map { |v| _deserialize(inner_type, v) }
|
501
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
502
|
+
k_type = Regexp.last_match[:k_type]
|
503
|
+
v_type = Regexp.last_match[:v_type]
|
504
|
+
{}.tap do |hash|
|
505
|
+
value.each do |k, v|
|
506
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
507
|
+
end
|
508
|
+
end
|
509
|
+
else # model
|
510
|
+
temp_model = AdminApi.const_get(type).new
|
511
|
+
temp_model.build_from_hash(value)
|
512
|
+
end
|
513
|
+
end
|
514
|
+
|
515
|
+
# Returns the string representation of the object
|
516
|
+
# @return [String] String presentation of the object
|
517
|
+
def to_s
|
518
|
+
to_hash.to_s
|
519
|
+
end
|
520
|
+
|
521
|
+
# to_body is an alias to to_hash (backward compatibility)
|
522
|
+
# @return [Hash] Returns the object in the form of hash
|
523
|
+
def to_body
|
524
|
+
to_hash
|
525
|
+
end
|
526
|
+
|
527
|
+
# Returns the object in the form of hash
|
528
|
+
# @return [Hash] Returns the object in the form of hash
|
529
|
+
def to_hash
|
530
|
+
hash = {}
|
531
|
+
self.class.attribute_map.each_pair do |attr, param|
|
532
|
+
value = self.send(attr)
|
533
|
+
hash[param] = _to_hash(value)
|
534
|
+
end
|
535
|
+
hash
|
536
|
+
end
|
537
|
+
|
538
|
+
# Outputs non-array value in the form of hash
|
539
|
+
# For object, use to_hash. Otherwise, just return the value
|
540
|
+
# @param [Object] value Any valid value
|
541
|
+
# @return [Hash] Returns the value in the form of hash
|
542
|
+
def _to_hash(value)
|
543
|
+
if value.is_a?(Array)
|
544
|
+
value.compact.map { |v| _to_hash(v) }
|
545
|
+
elsif value.is_a?(Hash)
|
546
|
+
{}.tap do |hash|
|
547
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
548
|
+
end
|
549
|
+
elsif value.respond_to? :to_hash
|
550
|
+
value.to_hash
|
551
|
+
else
|
552
|
+
value
|
553
|
+
end
|
554
|
+
end
|
555
|
+
|
556
|
+
end
|
557
|
+
end
|