pier-sdk-ruby 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. data/README.md +141 -0
  2. data/docs/AuthToken.md +12 -0
  3. data/docs/BodyAccessToken.md +10 -0
  4. data/docs/CancelarCartaoResponse.md +11 -0
  5. data/docs/CartaoApi.md +252 -0
  6. data/docs/CartaoResponse.md +29 -0
  7. data/docs/ConsultarCartaoResponse.md +10 -0
  8. data/docs/ConsultarContaCartaoResponse.md +18 -0
  9. data/docs/ConsultarContaResponse.md +11 -0
  10. data/docs/ConsultarExtratoContaResponse.md +23 -0
  11. data/docs/ConsultarSaldoLimitesResponse.md +23 -0
  12. data/docs/ContaApi.md +238 -0
  13. data/docs/ContaCartaoResponse.md +21 -0
  14. data/docs/ContaResponse.md +41 -0
  15. data/docs/DesbloquearCartaoResponse.md +9 -0
  16. data/docs/ExtraInfo.md +8 -0
  17. data/docs/ExtratoResponse.md +35 -0
  18. data/docs/PessoaFisicaResponse.md +26 -0
  19. data/docs/SaldoLimiteResponse.md +39 -0
  20. data/docs/TokenApi.md +114 -0
  21. data/git_push.sh +52 -0
  22. data/lib/pier-sdk-ruby.rb +62 -0
  23. data/lib/pier-sdk-ruby/api/cartao_api.rb +355 -0
  24. data/lib/pier-sdk-ruby/api/conta_api.rb +324 -0
  25. data/lib/pier-sdk-ruby/api/token_api.rb +157 -0
  26. data/lib/pier-sdk-ruby/api_client.rb +368 -0
  27. data/lib/pier-sdk-ruby/api_error.rb +40 -0
  28. data/lib/pier-sdk-ruby/configuration.rb +177 -0
  29. data/lib/pier-sdk-ruby/models/auth_token.rb +325 -0
  30. data/lib/pier-sdk-ruby/models/body_access_token.rb +275 -0
  31. data/lib/pier-sdk-ruby/models/cancelar_cartao_response.rb +286 -0
  32. data/lib/pier-sdk-ruby/models/cartao_response.rb +736 -0
  33. data/lib/pier-sdk-ruby/models/consultar_cartao_response.rb +263 -0
  34. data/lib/pier-sdk-ruby/models/consultar_conta_cartao_response.rb +461 -0
  35. data/lib/pier-sdk-ruby/models/consultar_conta_response.rb +288 -0
  36. data/lib/pier-sdk-ruby/models/consultar_extrato_conta_response.rb +588 -0
  37. data/lib/pier-sdk-ruby/models/consultar_saldo_limites_response.rb +586 -0
  38. data/lib/pier-sdk-ruby/models/conta_cartao_response.rb +536 -0
  39. data/lib/pier-sdk-ruby/models/conta_response.rb +1036 -0
  40. data/lib/pier-sdk-ruby/models/desbloquear_cartao_response.rb +236 -0
  41. data/lib/pier-sdk-ruby/models/extra_info.rb +211 -0
  42. data/lib/pier-sdk-ruby/models/extrato_response.rb +886 -0
  43. data/lib/pier-sdk-ruby/models/pessoa_fisica_response.rb +661 -0
  44. data/lib/pier-sdk-ruby/models/saldo_limite_response.rb +986 -0
  45. data/lib/pier-sdk-ruby/version.rb +19 -0
  46. data/pier-sdk-ruby.gemspec +33 -0
  47. data/spec/api/cartao_api_spec.rb +110 -0
  48. data/spec/api/conta_api_spec.rb +107 -0
  49. data/spec/api/token_api_spec.rb +71 -0
  50. data/spec/models/auth_token_spec.rb +90 -0
  51. data/spec/models/body_access_token_spec.rb +70 -0
  52. data/spec/models/cancelar_cartao_response_spec.rb +80 -0
  53. data/spec/models/cartao_response_spec.rb +260 -0
  54. data/spec/models/consultar_cartao_response_spec.rb +70 -0
  55. data/spec/models/consultar_conta_cartao_response_spec.rb +150 -0
  56. data/spec/models/consultar_conta_response_spec.rb +80 -0
  57. data/spec/models/consultar_extrato_conta_response_spec.rb +200 -0
  58. data/spec/models/consultar_saldo_limites_response_spec.rb +200 -0
  59. data/spec/models/conta_cartao_response_spec.rb +180 -0
  60. data/spec/models/conta_response_spec.rb +380 -0
  61. data/spec/models/desbloquear_cartao_response_spec.rb +60 -0
  62. data/spec/models/extra_info_spec.rb +50 -0
  63. data/spec/models/extrato_response_spec.rb +320 -0
  64. data/spec/models/pessoa_fisica_response_spec.rb +230 -0
  65. data/spec/models/saldo_limite_response_spec.rb +360 -0
  66. metadata +310 -0
@@ -0,0 +1,286 @@
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 CancelarCartaoResponse
21
+ attr_accessor :codigo_retorno
22
+
23
+ attr_accessor :descricao_retorno
24
+
25
+ attr_accessor :id_cartao
26
+
27
+ attr_accessor :id_conta
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+
33
+ :'codigo_retorno' => :'codigoRetorno',
34
+
35
+ :'descricao_retorno' => :'descricaoRetorno',
36
+
37
+ :'id_cartao' => :'idCartao',
38
+
39
+ :'id_conta' => :'idConta'
40
+
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.swagger_types
46
+ {
47
+
48
+ :'codigo_retorno' => :'Integer',
49
+
50
+ :'descricao_retorno' => :'String',
51
+
52
+ :'id_cartao' => :'Integer',
53
+
54
+ :'id_conta' => :'Integer'
55
+
56
+ }
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ return unless attributes.is_a?(Hash)
63
+
64
+ # convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
66
+
67
+
68
+ if attributes[:'codigoRetorno']
69
+
70
+
71
+ self.codigo_retorno = attributes[:'codigoRetorno']
72
+
73
+
74
+ end
75
+
76
+
77
+ if attributes[:'descricaoRetorno']
78
+
79
+
80
+ self.descricao_retorno = attributes[:'descricaoRetorno']
81
+
82
+
83
+ end
84
+
85
+
86
+ if attributes[:'idCartao']
87
+
88
+
89
+ self.id_cartao = attributes[:'idCartao']
90
+
91
+
92
+ end
93
+
94
+
95
+ if attributes[:'idConta']
96
+
97
+
98
+ self.id_conta = attributes[:'idConta']
99
+
100
+
101
+ end
102
+
103
+
104
+ end
105
+
106
+ # Show invalid properties with the reasons. Usually used together with valid?
107
+ # @return Array for valid properies with the reasons
108
+ def list_invalid_properties
109
+ invalid_properties = Array.new
110
+
111
+
112
+ return invalid_properties
113
+ end
114
+
115
+ # Check to see if the all the properties in the model are valid
116
+ # @return true if the model is valid
117
+ def valid?
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+ end
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+ # Checks equality by comparing each attribute.
159
+ # @param [Object] Object to be compared
160
+ def ==(o)
161
+ return true if self.equal?(o)
162
+ self.class == o.class &&
163
+ codigo_retorno == o.codigo_retorno &&
164
+ descricao_retorno == o.descricao_retorno &&
165
+ id_cartao == o.id_cartao &&
166
+ id_conta == o.id_conta
167
+ end
168
+
169
+ # @see the `==` method
170
+ # @param [Object] Object to be compared
171
+ def eql?(o)
172
+ self == o
173
+ end
174
+
175
+ # Calculates hash code according to all attributes.
176
+ # @return [Fixnum] Hash code
177
+ def hash
178
+ [codigo_retorno, descricao_retorno, id_cartao, id_conta].hash
179
+ end
180
+
181
+ # Builds the object from hash
182
+ # @param [Hash] attributes Model attributes in the form of hash
183
+ # @return [Object] Returns the model itself
184
+ def build_from_hash(attributes)
185
+ return nil unless attributes.is_a?(Hash)
186
+ self.class.swagger_types.each_pair do |key, type|
187
+ if type =~ /^Array<(.*)>/i
188
+ # check to ensure the input is an array given that the the attribute
189
+ # is documented as an array but the input is not
190
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
191
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
192
+ end
193
+ elsif !attributes[self.class.attribute_map[key]].nil?
194
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
195
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
196
+ end
197
+
198
+ self
199
+ end
200
+
201
+ # Deserializes the data based on type
202
+ # @param string type Data type
203
+ # @param string value Value to be deserialized
204
+ # @return [Object] Deserialized data
205
+ def _deserialize(type, value)
206
+ case type.to_sym
207
+ when :DateTime
208
+ DateTime.parse(value)
209
+ when :Date
210
+ Date.parse(value)
211
+ when :String
212
+ value.to_s
213
+ when :Integer
214
+ value.to_i
215
+ when :Float
216
+ value.to_f
217
+ when :BOOLEAN
218
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
219
+ true
220
+ else
221
+ false
222
+ end
223
+ when :Object
224
+ # generic object (usually a Hash), return directly
225
+ value
226
+ when /\AArray<(?<inner_type>.+)>\z/
227
+ inner_type = Regexp.last_match[:inner_type]
228
+ value.map { |v| _deserialize(inner_type, v) }
229
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
230
+ k_type = Regexp.last_match[:k_type]
231
+ v_type = Regexp.last_match[:v_type]
232
+ {}.tap do |hash|
233
+ value.each do |k, v|
234
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
235
+ end
236
+ end
237
+ else # model
238
+ temp_model = Pier.const_get(type).new
239
+ temp_model.build_from_hash(value)
240
+ end
241
+ end
242
+
243
+ # Returns the string representation of the object
244
+ # @return [String] String presentation of the object
245
+ def to_s
246
+ to_hash.to_s
247
+ end
248
+
249
+ # to_body is an alias to to_hash (backward compatibility)
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_body
252
+ to_hash
253
+ end
254
+
255
+ # Returns the object in the form of hash
256
+ # @return [Hash] Returns 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
+ # Outputs non-array value in the form of hash
268
+ # For object, use to_hash. Otherwise, just return the value
269
+ # @param [Object] value Any valid value
270
+ # @return [Hash] Returns the value in the form of hash
271
+ def _to_hash(value)
272
+ if value.is_a?(Array)
273
+ value.compact.map{ |v| _to_hash(v) }
274
+ elsif value.is_a?(Hash)
275
+ {}.tap do |hash|
276
+ value.each { |k, v| hash[k] = _to_hash(v) }
277
+ end
278
+ elsif value.respond_to? :to_hash
279
+ value.to_hash
280
+ else
281
+ value
282
+ end
283
+ end
284
+
285
+ end
286
+ end
@@ -0,0 +1,736 @@
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 CartaoResponse
21
+ attr_accessor :bin
22
+
23
+ attr_accessor :cod_retorno
24
+
25
+ attr_accessor :codigo_desbloqueio
26
+
27
+ attr_accessor :criptografia_hsm
28
+
29
+ attr_accessor :data_emissao
30
+
31
+ attr_accessor :data_validade
32
+
33
+ attr_accessor :data_vencimento_padrao
34
+
35
+ attr_accessor :descricao_retorno
36
+
37
+ attr_accessor :estagio_cartao
38
+
39
+ attr_accessor :estagio_data
40
+
41
+ attr_accessor :flag_reversao
42
+
43
+ attr_accessor :flag_senha
44
+
45
+ attr_accessor :id_cartao
46
+
47
+ attr_accessor :id_conta
48
+
49
+ attr_accessor :id_emissor
50
+
51
+ attr_accessor :id_log
52
+
53
+ attr_accessor :id_pessoa_fisica
54
+
55
+ attr_accessor :id_produto
56
+
57
+ attr_accessor :numero_cartao
58
+
59
+ attr_accessor :numero_cartao_real
60
+
61
+ attr_accessor :status_cartao
62
+
63
+ attr_accessor :status_data
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+
69
+ :'bin' => :'bin',
70
+
71
+ :'cod_retorno' => :'codRetorno',
72
+
73
+ :'codigo_desbloqueio' => :'codigoDesbloqueio',
74
+
75
+ :'criptografia_hsm' => :'criptografiaHSM',
76
+
77
+ :'data_emissao' => :'dataEmissao',
78
+
79
+ :'data_validade' => :'dataValidade',
80
+
81
+ :'data_vencimento_padrao' => :'dataVencimentoPadrao',
82
+
83
+ :'descricao_retorno' => :'descricaoRetorno',
84
+
85
+ :'estagio_cartao' => :'estagioCartao',
86
+
87
+ :'estagio_data' => :'estagioData',
88
+
89
+ :'flag_reversao' => :'flagReversao',
90
+
91
+ :'flag_senha' => :'flagSenha',
92
+
93
+ :'id_cartao' => :'idCartao',
94
+
95
+ :'id_conta' => :'idConta',
96
+
97
+ :'id_emissor' => :'idEmissor',
98
+
99
+ :'id_log' => :'idLog',
100
+
101
+ :'id_pessoa_fisica' => :'idPessoaFisica',
102
+
103
+ :'id_produto' => :'idProduto',
104
+
105
+ :'numero_cartao' => :'numeroCartao',
106
+
107
+ :'numero_cartao_real' => :'numeroCartaoReal',
108
+
109
+ :'status_cartao' => :'statusCartao',
110
+
111
+ :'status_data' => :'statusData'
112
+
113
+ }
114
+ end
115
+
116
+ # Attribute type mapping.
117
+ def self.swagger_types
118
+ {
119
+
120
+ :'bin' => :'Integer',
121
+
122
+ :'cod_retorno' => :'Integer',
123
+
124
+ :'codigo_desbloqueio' => :'String',
125
+
126
+ :'criptografia_hsm' => :'String',
127
+
128
+ :'data_emissao' => :'DateTime',
129
+
130
+ :'data_validade' => :'DateTime',
131
+
132
+ :'data_vencimento_padrao' => :'String',
133
+
134
+ :'descricao_retorno' => :'String',
135
+
136
+ :'estagio_cartao' => :'Integer',
137
+
138
+ :'estagio_data' => :'DateTime',
139
+
140
+ :'flag_reversao' => :'BOOLEAN',
141
+
142
+ :'flag_senha' => :'BOOLEAN',
143
+
144
+ :'id_cartao' => :'Integer',
145
+
146
+ :'id_conta' => :'Integer',
147
+
148
+ :'id_emissor' => :'Integer',
149
+
150
+ :'id_log' => :'String',
151
+
152
+ :'id_pessoa_fisica' => :'Integer',
153
+
154
+ :'id_produto' => :'Integer',
155
+
156
+ :'numero_cartao' => :'String',
157
+
158
+ :'numero_cartao_real' => :'String',
159
+
160
+ :'status_cartao' => :'Integer',
161
+
162
+ :'status_data' => :'DateTime'
163
+
164
+ }
165
+ end
166
+
167
+ # Initializes the object
168
+ # @param [Hash] attributes Model attributes in the form of hash
169
+ def initialize(attributes = {})
170
+ return unless attributes.is_a?(Hash)
171
+
172
+ # convert string to symbol for hash key
173
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
174
+
175
+
176
+ if attributes[:'bin']
177
+
178
+
179
+ self.bin = attributes[:'bin']
180
+
181
+
182
+ end
183
+
184
+
185
+ if attributes[:'codRetorno']
186
+
187
+
188
+ self.cod_retorno = attributes[:'codRetorno']
189
+
190
+
191
+ end
192
+
193
+
194
+ if attributes[:'codigoDesbloqueio']
195
+
196
+
197
+ self.codigo_desbloqueio = attributes[:'codigoDesbloqueio']
198
+
199
+
200
+ end
201
+
202
+
203
+ if attributes[:'criptografiaHSM']
204
+
205
+
206
+ self.criptografia_hsm = attributes[:'criptografiaHSM']
207
+
208
+
209
+ end
210
+
211
+
212
+ if attributes[:'dataEmissao']
213
+
214
+
215
+ self.data_emissao = attributes[:'dataEmissao']
216
+
217
+
218
+ end
219
+
220
+
221
+ if attributes[:'dataValidade']
222
+
223
+
224
+ self.data_validade = attributes[:'dataValidade']
225
+
226
+
227
+ end
228
+
229
+
230
+ if attributes[:'dataVencimentoPadrao']
231
+
232
+
233
+ self.data_vencimento_padrao = attributes[:'dataVencimentoPadrao']
234
+
235
+
236
+ end
237
+
238
+
239
+ if attributes[:'descricaoRetorno']
240
+
241
+
242
+ self.descricao_retorno = attributes[:'descricaoRetorno']
243
+
244
+
245
+ end
246
+
247
+
248
+ if attributes[:'estagioCartao']
249
+
250
+
251
+ self.estagio_cartao = attributes[:'estagioCartao']
252
+
253
+
254
+ end
255
+
256
+
257
+ if attributes[:'estagioData']
258
+
259
+
260
+ self.estagio_data = attributes[:'estagioData']
261
+
262
+
263
+ end
264
+
265
+
266
+ if attributes[:'flagReversao']
267
+
268
+
269
+ self.flag_reversao = attributes[:'flagReversao']
270
+
271
+
272
+ end
273
+
274
+
275
+ if attributes[:'flagSenha']
276
+
277
+
278
+ self.flag_senha = attributes[:'flagSenha']
279
+
280
+
281
+ end
282
+
283
+
284
+ if attributes[:'idCartao']
285
+
286
+
287
+ self.id_cartao = attributes[:'idCartao']
288
+
289
+
290
+ end
291
+
292
+
293
+ if attributes[:'idConta']
294
+
295
+
296
+ self.id_conta = attributes[:'idConta']
297
+
298
+
299
+ end
300
+
301
+
302
+ if attributes[:'idEmissor']
303
+
304
+
305
+ self.id_emissor = attributes[:'idEmissor']
306
+
307
+
308
+ end
309
+
310
+
311
+ if attributes[:'idLog']
312
+
313
+
314
+ self.id_log = attributes[:'idLog']
315
+
316
+
317
+ end
318
+
319
+
320
+ if attributes[:'idPessoaFisica']
321
+
322
+
323
+ self.id_pessoa_fisica = attributes[:'idPessoaFisica']
324
+
325
+
326
+ end
327
+
328
+
329
+ if attributes[:'idProduto']
330
+
331
+
332
+ self.id_produto = attributes[:'idProduto']
333
+
334
+
335
+ end
336
+
337
+
338
+ if attributes[:'numeroCartao']
339
+
340
+
341
+ self.numero_cartao = attributes[:'numeroCartao']
342
+
343
+
344
+ end
345
+
346
+
347
+ if attributes[:'numeroCartaoReal']
348
+
349
+
350
+ self.numero_cartao_real = attributes[:'numeroCartaoReal']
351
+
352
+
353
+ end
354
+
355
+
356
+ if attributes[:'statusCartao']
357
+
358
+
359
+ self.status_cartao = attributes[:'statusCartao']
360
+
361
+
362
+ end
363
+
364
+
365
+ if attributes[:'statusData']
366
+
367
+
368
+ self.status_data = attributes[:'statusData']
369
+
370
+
371
+ end
372
+
373
+
374
+ end
375
+
376
+ # Show invalid properties with the reasons. Usually used together with valid?
377
+ # @return Array for valid properies with the reasons
378
+ def list_invalid_properties
379
+ invalid_properties = Array.new
380
+
381
+
382
+ return invalid_properties
383
+ end
384
+
385
+ # Check to see if the all the properties in the model are valid
386
+ # @return true if the model is valid
387
+ def valid?
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
+
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
+ end
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
+
519
+
520
+
521
+
522
+
523
+
524
+
525
+
526
+
527
+
528
+
529
+
530
+
531
+
532
+
533
+
534
+
535
+
536
+
537
+
538
+
539
+
540
+
541
+
542
+
543
+
544
+
545
+
546
+
547
+
548
+
549
+
550
+
551
+
552
+
553
+
554
+
555
+
556
+
557
+
558
+
559
+
560
+
561
+
562
+
563
+
564
+
565
+
566
+
567
+
568
+
569
+
570
+
571
+
572
+
573
+
574
+
575
+
576
+
577
+
578
+
579
+
580
+
581
+
582
+
583
+
584
+
585
+
586
+
587
+
588
+
589
+
590
+ # Checks equality by comparing each attribute.
591
+ # @param [Object] Object to be compared
592
+ def ==(o)
593
+ return true if self.equal?(o)
594
+ self.class == o.class &&
595
+ bin == o.bin &&
596
+ cod_retorno == o.cod_retorno &&
597
+ codigo_desbloqueio == o.codigo_desbloqueio &&
598
+ criptografia_hsm == o.criptografia_hsm &&
599
+ data_emissao == o.data_emissao &&
600
+ data_validade == o.data_validade &&
601
+ data_vencimento_padrao == o.data_vencimento_padrao &&
602
+ descricao_retorno == o.descricao_retorno &&
603
+ estagio_cartao == o.estagio_cartao &&
604
+ estagio_data == o.estagio_data &&
605
+ flag_reversao == o.flag_reversao &&
606
+ flag_senha == o.flag_senha &&
607
+ id_cartao == o.id_cartao &&
608
+ id_conta == o.id_conta &&
609
+ id_emissor == o.id_emissor &&
610
+ id_log == o.id_log &&
611
+ id_pessoa_fisica == o.id_pessoa_fisica &&
612
+ id_produto == o.id_produto &&
613
+ numero_cartao == o.numero_cartao &&
614
+ numero_cartao_real == o.numero_cartao_real &&
615
+ status_cartao == o.status_cartao &&
616
+ status_data == o.status_data
617
+ end
618
+
619
+ # @see the `==` method
620
+ # @param [Object] Object to be compared
621
+ def eql?(o)
622
+ self == o
623
+ end
624
+
625
+ # Calculates hash code according to all attributes.
626
+ # @return [Fixnum] Hash code
627
+ def hash
628
+ [bin, cod_retorno, codigo_desbloqueio, criptografia_hsm, data_emissao, data_validade, data_vencimento_padrao, descricao_retorno, estagio_cartao, estagio_data, flag_reversao, flag_senha, id_cartao, id_conta, id_emissor, id_log, id_pessoa_fisica, id_produto, numero_cartao, numero_cartao_real, status_cartao, status_data].hash
629
+ end
630
+
631
+ # Builds the object from hash
632
+ # @param [Hash] attributes Model attributes in the form of hash
633
+ # @return [Object] Returns the model itself
634
+ def build_from_hash(attributes)
635
+ return nil unless attributes.is_a?(Hash)
636
+ self.class.swagger_types.each_pair do |key, type|
637
+ if type =~ /^Array<(.*)>/i
638
+ # check to ensure the input is an array given that the the attribute
639
+ # is documented as an array but the input is not
640
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
641
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
642
+ end
643
+ elsif !attributes[self.class.attribute_map[key]].nil?
644
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
645
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
646
+ end
647
+
648
+ self
649
+ end
650
+
651
+ # Deserializes the data based on type
652
+ # @param string type Data type
653
+ # @param string value Value to be deserialized
654
+ # @return [Object] Deserialized data
655
+ def _deserialize(type, value)
656
+ case type.to_sym
657
+ when :DateTime
658
+ DateTime.parse(value)
659
+ when :Date
660
+ Date.parse(value)
661
+ when :String
662
+ value.to_s
663
+ when :Integer
664
+ value.to_i
665
+ when :Float
666
+ value.to_f
667
+ when :BOOLEAN
668
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
669
+ true
670
+ else
671
+ false
672
+ end
673
+ when :Object
674
+ # generic object (usually a Hash), return directly
675
+ value
676
+ when /\AArray<(?<inner_type>.+)>\z/
677
+ inner_type = Regexp.last_match[:inner_type]
678
+ value.map { |v| _deserialize(inner_type, v) }
679
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
680
+ k_type = Regexp.last_match[:k_type]
681
+ v_type = Regexp.last_match[:v_type]
682
+ {}.tap do |hash|
683
+ value.each do |k, v|
684
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
685
+ end
686
+ end
687
+ else # model
688
+ temp_model = Pier.const_get(type).new
689
+ temp_model.build_from_hash(value)
690
+ end
691
+ end
692
+
693
+ # Returns the string representation of the object
694
+ # @return [String] String presentation of the object
695
+ def to_s
696
+ to_hash.to_s
697
+ end
698
+
699
+ # to_body is an alias to to_hash (backward compatibility)
700
+ # @return [Hash] Returns the object in the form of hash
701
+ def to_body
702
+ to_hash
703
+ end
704
+
705
+ # Returns the object in the form of hash
706
+ # @return [Hash] Returns the object in the form of hash
707
+ def to_hash
708
+ hash = {}
709
+ self.class.attribute_map.each_pair do |attr, param|
710
+ value = self.send(attr)
711
+ next if value.nil?
712
+ hash[param] = _to_hash(value)
713
+ end
714
+ hash
715
+ end
716
+
717
+ # Outputs non-array value in the form of hash
718
+ # For object, use to_hash. Otherwise, just return the value
719
+ # @param [Object] value Any valid value
720
+ # @return [Hash] Returns the value in the form of hash
721
+ def _to_hash(value)
722
+ if value.is_a?(Array)
723
+ value.compact.map{ |v| _to_hash(v) }
724
+ elsif value.is_a?(Hash)
725
+ {}.tap do |hash|
726
+ value.each { |k, v| hash[k] = _to_hash(v) }
727
+ end
728
+ elsif value.respond_to? :to_hash
729
+ value.to_hash
730
+ else
731
+ value
732
+ end
733
+ end
734
+
735
+ end
736
+ end