pier-sdk-ruby 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +141 -0
- data/docs/AuthToken.md +12 -0
- data/docs/BodyAccessToken.md +10 -0
- data/docs/CancelarCartaoResponse.md +11 -0
- data/docs/CartaoApi.md +252 -0
- data/docs/CartaoResponse.md +29 -0
- data/docs/ConsultarCartaoResponse.md +10 -0
- data/docs/ConsultarContaCartaoResponse.md +18 -0
- data/docs/ConsultarContaResponse.md +11 -0
- data/docs/ConsultarExtratoContaResponse.md +23 -0
- data/docs/ConsultarSaldoLimitesResponse.md +23 -0
- data/docs/ContaApi.md +238 -0
- data/docs/ContaCartaoResponse.md +21 -0
- data/docs/ContaResponse.md +41 -0
- data/docs/DesbloquearCartaoResponse.md +9 -0
- data/docs/ExtraInfo.md +8 -0
- data/docs/ExtratoResponse.md +35 -0
- data/docs/PessoaFisicaResponse.md +26 -0
- data/docs/SaldoLimiteResponse.md +39 -0
- data/docs/TokenApi.md +114 -0
- data/git_push.sh +52 -0
- data/lib/pier-sdk-ruby.rb +62 -0
- data/lib/pier-sdk-ruby/api/cartao_api.rb +355 -0
- data/lib/pier-sdk-ruby/api/conta_api.rb +324 -0
- data/lib/pier-sdk-ruby/api/token_api.rb +157 -0
- data/lib/pier-sdk-ruby/api_client.rb +368 -0
- data/lib/pier-sdk-ruby/api_error.rb +40 -0
- data/lib/pier-sdk-ruby/configuration.rb +177 -0
- data/lib/pier-sdk-ruby/models/auth_token.rb +325 -0
- data/lib/pier-sdk-ruby/models/body_access_token.rb +275 -0
- data/lib/pier-sdk-ruby/models/cancelar_cartao_response.rb +286 -0
- data/lib/pier-sdk-ruby/models/cartao_response.rb +736 -0
- data/lib/pier-sdk-ruby/models/consultar_cartao_response.rb +263 -0
- data/lib/pier-sdk-ruby/models/consultar_conta_cartao_response.rb +461 -0
- data/lib/pier-sdk-ruby/models/consultar_conta_response.rb +288 -0
- data/lib/pier-sdk-ruby/models/consultar_extrato_conta_response.rb +588 -0
- data/lib/pier-sdk-ruby/models/consultar_saldo_limites_response.rb +586 -0
- data/lib/pier-sdk-ruby/models/conta_cartao_response.rb +536 -0
- data/lib/pier-sdk-ruby/models/conta_response.rb +1036 -0
- data/lib/pier-sdk-ruby/models/desbloquear_cartao_response.rb +236 -0
- data/lib/pier-sdk-ruby/models/extra_info.rb +211 -0
- data/lib/pier-sdk-ruby/models/extrato_response.rb +886 -0
- data/lib/pier-sdk-ruby/models/pessoa_fisica_response.rb +661 -0
- data/lib/pier-sdk-ruby/models/saldo_limite_response.rb +986 -0
- data/lib/pier-sdk-ruby/version.rb +19 -0
- data/pier-sdk-ruby.gemspec +33 -0
- data/spec/api/cartao_api_spec.rb +110 -0
- data/spec/api/conta_api_spec.rb +107 -0
- data/spec/api/token_api_spec.rb +71 -0
- data/spec/models/auth_token_spec.rb +90 -0
- data/spec/models/body_access_token_spec.rb +70 -0
- data/spec/models/cancelar_cartao_response_spec.rb +80 -0
- data/spec/models/cartao_response_spec.rb +260 -0
- data/spec/models/consultar_cartao_response_spec.rb +70 -0
- data/spec/models/consultar_conta_cartao_response_spec.rb +150 -0
- data/spec/models/consultar_conta_response_spec.rb +80 -0
- data/spec/models/consultar_extrato_conta_response_spec.rb +200 -0
- data/spec/models/consultar_saldo_limites_response_spec.rb +200 -0
- data/spec/models/conta_cartao_response_spec.rb +180 -0
- data/spec/models/conta_response_spec.rb +380 -0
- data/spec/models/desbloquear_cartao_response_spec.rb +60 -0
- data/spec/models/extra_info_spec.rb +50 -0
- data/spec/models/extrato_response_spec.rb +320 -0
- data/spec/models/pessoa_fisica_response_spec.rb +230 -0
- data/spec/models/saldo_limite_response_spec.rb +360 -0
- metadata +310 -0
@@ -0,0 +1,661 @@
|
|
1
|
+
=begin
|
2
|
+
CaaS - Conductor as a Service
|
3
|
+
|
4
|
+
Gest\u00C3\u00A3o de pagamento eletr\u00C3\u00B4nicos como servi\u00C3\u00A7o
|
5
|
+
|
6
|
+
OpenAPI spec version: 0.0.1
|
7
|
+
Contact: contato@conductor.com.br
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
License: Apache 2.0
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0.html
|
12
|
+
|
13
|
+
Terms of Service: http://dev.conductor.com.br/terms/
|
14
|
+
|
15
|
+
=end
|
16
|
+
|
17
|
+
require 'date'
|
18
|
+
|
19
|
+
module Pier
|
20
|
+
class PessoaFisicaResponse
|
21
|
+
attr_accessor :bairro
|
22
|
+
|
23
|
+
attr_accessor :cep
|
24
|
+
|
25
|
+
attr_accessor :cidade
|
26
|
+
|
27
|
+
attr_accessor :complemento_logradouro
|
28
|
+
|
29
|
+
attr_accessor :cpf
|
30
|
+
|
31
|
+
attr_accessor :data_emissao_identidade
|
32
|
+
|
33
|
+
attr_accessor :data_nascimento
|
34
|
+
|
35
|
+
attr_accessor :dddcelular
|
36
|
+
|
37
|
+
attr_accessor :dddtelefone
|
38
|
+
|
39
|
+
attr_accessor :endereco
|
40
|
+
|
41
|
+
attr_accessor :id_pessoa_fisica
|
42
|
+
|
43
|
+
attr_accessor :identidade
|
44
|
+
|
45
|
+
attr_accessor :nome
|
46
|
+
|
47
|
+
attr_accessor :numero_celular
|
48
|
+
|
49
|
+
attr_accessor :numero_logradouro
|
50
|
+
|
51
|
+
attr_accessor :numero_telefone
|
52
|
+
|
53
|
+
attr_accessor :orgao_emissor
|
54
|
+
|
55
|
+
attr_accessor :sexo
|
56
|
+
|
57
|
+
attr_accessor :uf
|
58
|
+
|
59
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
60
|
+
def self.attribute_map
|
61
|
+
{
|
62
|
+
|
63
|
+
:'bairro' => :'bairro',
|
64
|
+
|
65
|
+
:'cep' => :'cep',
|
66
|
+
|
67
|
+
:'cidade' => :'cidade',
|
68
|
+
|
69
|
+
:'complemento_logradouro' => :'complementoLogradouro',
|
70
|
+
|
71
|
+
:'cpf' => :'cpf',
|
72
|
+
|
73
|
+
:'data_emissao_identidade' => :'dataEmissaoIdentidade',
|
74
|
+
|
75
|
+
:'data_nascimento' => :'dataNascimento',
|
76
|
+
|
77
|
+
:'dddcelular' => :'dddcelular',
|
78
|
+
|
79
|
+
:'dddtelefone' => :'dddtelefone',
|
80
|
+
|
81
|
+
:'endereco' => :'endereco',
|
82
|
+
|
83
|
+
:'id_pessoa_fisica' => :'idPessoaFisica',
|
84
|
+
|
85
|
+
:'identidade' => :'identidade',
|
86
|
+
|
87
|
+
:'nome' => :'nome',
|
88
|
+
|
89
|
+
:'numero_celular' => :'numeroCelular',
|
90
|
+
|
91
|
+
:'numero_logradouro' => :'numeroLogradouro',
|
92
|
+
|
93
|
+
:'numero_telefone' => :'numeroTelefone',
|
94
|
+
|
95
|
+
:'orgao_emissor' => :'orgaoEmissor',
|
96
|
+
|
97
|
+
:'sexo' => :'sexo',
|
98
|
+
|
99
|
+
:'uf' => :'uf'
|
100
|
+
|
101
|
+
}
|
102
|
+
end
|
103
|
+
|
104
|
+
# Attribute type mapping.
|
105
|
+
def self.swagger_types
|
106
|
+
{
|
107
|
+
|
108
|
+
:'bairro' => :'String',
|
109
|
+
|
110
|
+
:'cep' => :'String',
|
111
|
+
|
112
|
+
:'cidade' => :'String',
|
113
|
+
|
114
|
+
:'complemento_logradouro' => :'String',
|
115
|
+
|
116
|
+
:'cpf' => :'String',
|
117
|
+
|
118
|
+
:'data_emissao_identidade' => :'String',
|
119
|
+
|
120
|
+
:'data_nascimento' => :'String',
|
121
|
+
|
122
|
+
:'dddcelular' => :'String',
|
123
|
+
|
124
|
+
:'dddtelefone' => :'String',
|
125
|
+
|
126
|
+
:'endereco' => :'String',
|
127
|
+
|
128
|
+
:'id_pessoa_fisica' => :'Integer',
|
129
|
+
|
130
|
+
:'identidade' => :'String',
|
131
|
+
|
132
|
+
:'nome' => :'String',
|
133
|
+
|
134
|
+
:'numero_celular' => :'String',
|
135
|
+
|
136
|
+
:'numero_logradouro' => :'Integer',
|
137
|
+
|
138
|
+
:'numero_telefone' => :'String',
|
139
|
+
|
140
|
+
:'orgao_emissor' => :'String',
|
141
|
+
|
142
|
+
:'sexo' => :'String',
|
143
|
+
|
144
|
+
:'uf' => :'String'
|
145
|
+
|
146
|
+
}
|
147
|
+
end
|
148
|
+
|
149
|
+
# Initializes the object
|
150
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
151
|
+
def initialize(attributes = {})
|
152
|
+
return unless attributes.is_a?(Hash)
|
153
|
+
|
154
|
+
# convert string to symbol for hash key
|
155
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
156
|
+
|
157
|
+
|
158
|
+
if attributes[:'bairro']
|
159
|
+
|
160
|
+
|
161
|
+
self.bairro = attributes[:'bairro']
|
162
|
+
|
163
|
+
|
164
|
+
end
|
165
|
+
|
166
|
+
|
167
|
+
if attributes[:'cep']
|
168
|
+
|
169
|
+
|
170
|
+
self.cep = attributes[:'cep']
|
171
|
+
|
172
|
+
|
173
|
+
end
|
174
|
+
|
175
|
+
|
176
|
+
if attributes[:'cidade']
|
177
|
+
|
178
|
+
|
179
|
+
self.cidade = attributes[:'cidade']
|
180
|
+
|
181
|
+
|
182
|
+
end
|
183
|
+
|
184
|
+
|
185
|
+
if attributes[:'complementoLogradouro']
|
186
|
+
|
187
|
+
|
188
|
+
self.complemento_logradouro = attributes[:'complementoLogradouro']
|
189
|
+
|
190
|
+
|
191
|
+
end
|
192
|
+
|
193
|
+
|
194
|
+
if attributes[:'cpf']
|
195
|
+
|
196
|
+
|
197
|
+
self.cpf = attributes[:'cpf']
|
198
|
+
|
199
|
+
|
200
|
+
end
|
201
|
+
|
202
|
+
|
203
|
+
if attributes[:'dataEmissaoIdentidade']
|
204
|
+
|
205
|
+
|
206
|
+
self.data_emissao_identidade = attributes[:'dataEmissaoIdentidade']
|
207
|
+
|
208
|
+
|
209
|
+
end
|
210
|
+
|
211
|
+
|
212
|
+
if attributes[:'dataNascimento']
|
213
|
+
|
214
|
+
|
215
|
+
self.data_nascimento = attributes[:'dataNascimento']
|
216
|
+
|
217
|
+
|
218
|
+
end
|
219
|
+
|
220
|
+
|
221
|
+
if attributes[:'dddcelular']
|
222
|
+
|
223
|
+
|
224
|
+
self.dddcelular = attributes[:'dddcelular']
|
225
|
+
|
226
|
+
|
227
|
+
end
|
228
|
+
|
229
|
+
|
230
|
+
if attributes[:'dddtelefone']
|
231
|
+
|
232
|
+
|
233
|
+
self.dddtelefone = attributes[:'dddtelefone']
|
234
|
+
|
235
|
+
|
236
|
+
end
|
237
|
+
|
238
|
+
|
239
|
+
if attributes[:'endereco']
|
240
|
+
|
241
|
+
|
242
|
+
self.endereco = attributes[:'endereco']
|
243
|
+
|
244
|
+
|
245
|
+
end
|
246
|
+
|
247
|
+
|
248
|
+
if attributes[:'idPessoaFisica']
|
249
|
+
|
250
|
+
|
251
|
+
self.id_pessoa_fisica = attributes[:'idPessoaFisica']
|
252
|
+
|
253
|
+
|
254
|
+
end
|
255
|
+
|
256
|
+
|
257
|
+
if attributes[:'identidade']
|
258
|
+
|
259
|
+
|
260
|
+
self.identidade = attributes[:'identidade']
|
261
|
+
|
262
|
+
|
263
|
+
end
|
264
|
+
|
265
|
+
|
266
|
+
if attributes[:'nome']
|
267
|
+
|
268
|
+
|
269
|
+
self.nome = attributes[:'nome']
|
270
|
+
|
271
|
+
|
272
|
+
end
|
273
|
+
|
274
|
+
|
275
|
+
if attributes[:'numeroCelular']
|
276
|
+
|
277
|
+
|
278
|
+
self.numero_celular = attributes[:'numeroCelular']
|
279
|
+
|
280
|
+
|
281
|
+
end
|
282
|
+
|
283
|
+
|
284
|
+
if attributes[:'numeroLogradouro']
|
285
|
+
|
286
|
+
|
287
|
+
self.numero_logradouro = attributes[:'numeroLogradouro']
|
288
|
+
|
289
|
+
|
290
|
+
end
|
291
|
+
|
292
|
+
|
293
|
+
if attributes[:'numeroTelefone']
|
294
|
+
|
295
|
+
|
296
|
+
self.numero_telefone = attributes[:'numeroTelefone']
|
297
|
+
|
298
|
+
|
299
|
+
end
|
300
|
+
|
301
|
+
|
302
|
+
if attributes[:'orgaoEmissor']
|
303
|
+
|
304
|
+
|
305
|
+
self.orgao_emissor = attributes[:'orgaoEmissor']
|
306
|
+
|
307
|
+
|
308
|
+
end
|
309
|
+
|
310
|
+
|
311
|
+
if attributes[:'sexo']
|
312
|
+
|
313
|
+
|
314
|
+
self.sexo = attributes[:'sexo']
|
315
|
+
|
316
|
+
|
317
|
+
end
|
318
|
+
|
319
|
+
|
320
|
+
if attributes[:'uf']
|
321
|
+
|
322
|
+
|
323
|
+
self.uf = attributes[:'uf']
|
324
|
+
|
325
|
+
|
326
|
+
end
|
327
|
+
|
328
|
+
|
329
|
+
end
|
330
|
+
|
331
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
332
|
+
# @return Array for valid properies with the reasons
|
333
|
+
def list_invalid_properties
|
334
|
+
invalid_properties = Array.new
|
335
|
+
|
336
|
+
|
337
|
+
return invalid_properties
|
338
|
+
end
|
339
|
+
|
340
|
+
# Check to see if the all the properties in the model are valid
|
341
|
+
# @return true if the model is valid
|
342
|
+
def valid?
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
end
|
421
|
+
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
|
504
|
+
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
|
518
|
+
# Checks equality by comparing each attribute.
|
519
|
+
# @param [Object] Object to be compared
|
520
|
+
def ==(o)
|
521
|
+
return true if self.equal?(o)
|
522
|
+
self.class == o.class &&
|
523
|
+
bairro == o.bairro &&
|
524
|
+
cep == o.cep &&
|
525
|
+
cidade == o.cidade &&
|
526
|
+
complemento_logradouro == o.complemento_logradouro &&
|
527
|
+
cpf == o.cpf &&
|
528
|
+
data_emissao_identidade == o.data_emissao_identidade &&
|
529
|
+
data_nascimento == o.data_nascimento &&
|
530
|
+
dddcelular == o.dddcelular &&
|
531
|
+
dddtelefone == o.dddtelefone &&
|
532
|
+
endereco == o.endereco &&
|
533
|
+
id_pessoa_fisica == o.id_pessoa_fisica &&
|
534
|
+
identidade == o.identidade &&
|
535
|
+
nome == o.nome &&
|
536
|
+
numero_celular == o.numero_celular &&
|
537
|
+
numero_logradouro == o.numero_logradouro &&
|
538
|
+
numero_telefone == o.numero_telefone &&
|
539
|
+
orgao_emissor == o.orgao_emissor &&
|
540
|
+
sexo == o.sexo &&
|
541
|
+
uf == o.uf
|
542
|
+
end
|
543
|
+
|
544
|
+
# @see the `==` method
|
545
|
+
# @param [Object] Object to be compared
|
546
|
+
def eql?(o)
|
547
|
+
self == o
|
548
|
+
end
|
549
|
+
|
550
|
+
# Calculates hash code according to all attributes.
|
551
|
+
# @return [Fixnum] Hash code
|
552
|
+
def hash
|
553
|
+
[bairro, cep, cidade, complemento_logradouro, cpf, data_emissao_identidade, data_nascimento, dddcelular, dddtelefone, endereco, id_pessoa_fisica, identidade, nome, numero_celular, numero_logradouro, numero_telefone, orgao_emissor, sexo, uf].hash
|
554
|
+
end
|
555
|
+
|
556
|
+
# Builds the object from hash
|
557
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
558
|
+
# @return [Object] Returns the model itself
|
559
|
+
def build_from_hash(attributes)
|
560
|
+
return nil unless attributes.is_a?(Hash)
|
561
|
+
self.class.swagger_types.each_pair do |key, type|
|
562
|
+
if type =~ /^Array<(.*)>/i
|
563
|
+
# check to ensure the input is an array given that the the attribute
|
564
|
+
# is documented as an array but the input is not
|
565
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
566
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
567
|
+
end
|
568
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
569
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
570
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
571
|
+
end
|
572
|
+
|
573
|
+
self
|
574
|
+
end
|
575
|
+
|
576
|
+
# Deserializes the data based on type
|
577
|
+
# @param string type Data type
|
578
|
+
# @param string value Value to be deserialized
|
579
|
+
# @return [Object] Deserialized data
|
580
|
+
def _deserialize(type, value)
|
581
|
+
case type.to_sym
|
582
|
+
when :DateTime
|
583
|
+
DateTime.parse(value)
|
584
|
+
when :Date
|
585
|
+
Date.parse(value)
|
586
|
+
when :String
|
587
|
+
value.to_s
|
588
|
+
when :Integer
|
589
|
+
value.to_i
|
590
|
+
when :Float
|
591
|
+
value.to_f
|
592
|
+
when :BOOLEAN
|
593
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
594
|
+
true
|
595
|
+
else
|
596
|
+
false
|
597
|
+
end
|
598
|
+
when :Object
|
599
|
+
# generic object (usually a Hash), return directly
|
600
|
+
value
|
601
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
602
|
+
inner_type = Regexp.last_match[:inner_type]
|
603
|
+
value.map { |v| _deserialize(inner_type, v) }
|
604
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
605
|
+
k_type = Regexp.last_match[:k_type]
|
606
|
+
v_type = Regexp.last_match[:v_type]
|
607
|
+
{}.tap do |hash|
|
608
|
+
value.each do |k, v|
|
609
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
610
|
+
end
|
611
|
+
end
|
612
|
+
else # model
|
613
|
+
temp_model = Pier.const_get(type).new
|
614
|
+
temp_model.build_from_hash(value)
|
615
|
+
end
|
616
|
+
end
|
617
|
+
|
618
|
+
# Returns the string representation of the object
|
619
|
+
# @return [String] String presentation of the object
|
620
|
+
def to_s
|
621
|
+
to_hash.to_s
|
622
|
+
end
|
623
|
+
|
624
|
+
# to_body is an alias to to_hash (backward compatibility)
|
625
|
+
# @return [Hash] Returns the object in the form of hash
|
626
|
+
def to_body
|
627
|
+
to_hash
|
628
|
+
end
|
629
|
+
|
630
|
+
# Returns the object in the form of hash
|
631
|
+
# @return [Hash] Returns the object in the form of hash
|
632
|
+
def to_hash
|
633
|
+
hash = {}
|
634
|
+
self.class.attribute_map.each_pair do |attr, param|
|
635
|
+
value = self.send(attr)
|
636
|
+
next if value.nil?
|
637
|
+
hash[param] = _to_hash(value)
|
638
|
+
end
|
639
|
+
hash
|
640
|
+
end
|
641
|
+
|
642
|
+
# Outputs non-array value in the form of hash
|
643
|
+
# For object, use to_hash. Otherwise, just return the value
|
644
|
+
# @param [Object] value Any valid value
|
645
|
+
# @return [Hash] Returns the value in the form of hash
|
646
|
+
def _to_hash(value)
|
647
|
+
if value.is_a?(Array)
|
648
|
+
value.compact.map{ |v| _to_hash(v) }
|
649
|
+
elsif value.is_a?(Hash)
|
650
|
+
{}.tap do |hash|
|
651
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
652
|
+
end
|
653
|
+
elsif value.respond_to? :to_hash
|
654
|
+
value.to_hash
|
655
|
+
else
|
656
|
+
value
|
657
|
+
end
|
658
|
+
end
|
659
|
+
|
660
|
+
end
|
661
|
+
end
|