wire4_client 1.1.3 → 1.1.4

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 (119) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +28 -1
  4. data/docs/AccountReassigned.md +1 -1
  5. data/docs/AccountResponse.md +1 -0
  6. data/docs/BeneficiaryDTO.md +10 -0
  7. data/docs/CargosRecurrentesApi.md +110 -0
  8. data/docs/CepResponse.md +1 -0
  9. data/docs/CepSearchBanxico.md +1 -0
  10. data/docs/CertificateRequest.md +1 -1
  11. data/docs/CodiCodeQrResponseDTO.md +1 -0
  12. data/docs/CodiCodeRequestDTO.md +6 -3
  13. data/docs/ConfirmRecurringCharge.md +9 -0
  14. data/docs/CuentasDeBeneficiariosSPEIApi.md +4 -0
  15. data/docs/CuentasDeBeneficiariosSPIDApi.md +4 -0
  16. data/docs/Customer.md +9 -0
  17. data/docs/Deposit.md +1 -0
  18. data/docs/Depositant.md +1 -0
  19. data/docs/DepositantCountResponse.md +8 -0
  20. data/docs/DepositantesApi.md +164 -1
  21. data/docs/FailedChargesDataDTO.md +13 -0
  22. data/docs/MessageDepositReceived.md +3 -0
  23. data/docs/PaymentRequestReportDTO.md +17 -0
  24. data/docs/PaymentRequestReq.md +18 -0
  25. data/docs/PaymentRequestResponse.md +10 -0
  26. data/docs/PaymentsSpeiAndSpidOrderId.md +9 -0
  27. data/docs/PaymentsSpeiAndSpidRequestId.md +12 -0
  28. data/docs/Person.md +1 -1
  29. data/docs/Product.md +11 -0
  30. data/docs/RecurringChargeRequest.md +14 -0
  31. data/docs/ReporteDeSolicitudesDePagosApi.md +107 -0
  32. data/docs/SolicitudDePagosApi.md +59 -0
  33. data/docs/SpidBeneficiaryResponse.md +1 -0
  34. data/docs/SuccessChargesDataDTO.md +12 -0
  35. data/docs/SuccessDataDTO.md +9 -0
  36. data/docs/TransactionSpeiSpid.md +15 -0
  37. data/docs/TransactionsRegister.md +11 -0
  38. data/docs/TransferenciasSPEIApi.md +163 -0
  39. data/lib/wire4_client/api/cargos_recurrentes_api.rb +143 -0
  40. data/lib/wire4_client/api/cuentas_de_beneficiarios_spei_api.rb +6 -0
  41. data/lib/wire4_client/api/cuentas_de_beneficiarios_spid_api.rb +6 -0
  42. data/lib/wire4_client/api/depositantes_api.rb +138 -4
  43. data/lib/wire4_client/api/reporte_de_solicitudes_de_pagos_api.rb +134 -0
  44. data/lib/wire4_client/api/solicitud_de_pagos_api.rb +84 -0
  45. data/lib/wire4_client/api/transferencias_spei_api.rb +234 -4
  46. data/lib/wire4_client/models/account_reassigned.rb +11 -11
  47. data/lib/wire4_client/models/account_response.rb +11 -1
  48. data/lib/wire4_client/models/amount_request.rb +10 -10
  49. data/lib/wire4_client/models/beneficiary_dto.rb +201 -0
  50. data/lib/wire4_client/models/cep_response.rb +45 -1
  51. data/lib/wire4_client/models/cep_search_banxico.rb +48 -4
  52. data/lib/wire4_client/models/certificate_request.rb +6 -15
  53. data/lib/wire4_client/models/codi_code_qr_response_dto.rb +15 -5
  54. data/lib/wire4_client/models/codi_code_request_dto.rb +94 -20
  55. data/lib/wire4_client/models/codi_operations_filters_request_dto.rb +2 -2
  56. data/lib/wire4_client/models/confirm_recurring_charge.rb +194 -0
  57. data/lib/wire4_client/models/customer.rb +205 -0
  58. data/lib/wire4_client/models/deposit.rb +48 -4
  59. data/lib/wire4_client/models/depositant.rb +14 -4
  60. data/lib/wire4_client/models/failed_charges_data_dto.rb +228 -0
  61. data/lib/wire4_client/models/message_deposit_received.rb +31 -1
  62. data/lib/wire4_client/models/operations.rb +4 -4
  63. data/lib/wire4_client/models/payment_codi.rb +2 -2
  64. data/lib/wire4_client/models/payment_request_report_dto.rb +300 -0
  65. data/lib/wire4_client/models/payment_request_req.rb +401 -0
  66. data/lib/wire4_client/models/payment_request_response.rb +204 -0
  67. data/lib/wire4_client/models/payments_spei_and_spid_order_id.rb +199 -0
  68. data/lib/wire4_client/models/payments_spei_and_spid_request_id.rb +229 -0
  69. data/lib/wire4_client/models/person.rb +0 -5
  70. data/lib/wire4_client/models/product.rb +288 -0
  71. data/lib/wire4_client/models/recurring_charge_request.rb +278 -0
  72. data/lib/wire4_client/models/sales_point_request.rb +5 -5
  73. data/lib/wire4_client/models/spid_beneficiary_response.rb +11 -1
  74. data/lib/wire4_client/models/success_charges_data_dto.rb +219 -0
  75. data/lib/wire4_client/models/success_data_dto.rb +226 -0
  76. data/lib/wire4_client/models/transaction_outgoing.rb +5 -5
  77. data/lib/wire4_client/models/transaction_spei_spid.rb +390 -0
  78. data/lib/wire4_client/models/transactions_register.rb +229 -0
  79. data/lib/wire4_client/version.rb +1 -1
  80. data/lib/wire4_client.rb +18 -0
  81. data/spec/api/cargos_recurrentes_api_spec.rb +61 -0
  82. data/spec/api/cuentas_de_beneficiarios_spei_api_spec.rb +2 -0
  83. data/spec/api/cuentas_de_beneficiarios_spid_api_spec.rb +2 -0
  84. data/spec/api/depositantes_api_spec.rb +42 -1
  85. data/spec/api/reporte_de_solicitudes_de_pagos_api_spec.rb +59 -0
  86. data/spec/api/solicitud_de_pagos_api_spec.rb +48 -0
  87. data/spec/api/transferencias_spei_api_spec.rb +42 -0
  88. data/spec/models/account_reassigned_spec.rb +3 -3
  89. data/spec/models/account_response_spec.rb +6 -0
  90. data/spec/models/beneficiary_dto_spec.rb +53 -0
  91. data/spec/models/cep_response_spec.rb +10 -0
  92. data/spec/models/cep_search_banxico_spec.rb +10 -0
  93. data/spec/models/codi_code_qr_response_dto_spec.rb +8 -2
  94. data/spec/models/codi_code_request_dto_spec.rb +23 -1
  95. data/spec/models/codi_operations_filters_request_dto_spec.rb +1 -1
  96. data/spec/models/confirm_recurring_charge_spec.rb +47 -0
  97. data/spec/models/customer_spec.rb +47 -0
  98. data/spec/models/deposit_spec.rb +10 -0
  99. data/spec/models/depositant_count_response_spec.rb +41 -0
  100. data/spec/models/depositant_spec.rb +6 -0
  101. data/spec/models/failed_charges_data_dto_spec.rb +71 -0
  102. data/spec/models/message_deposit_received_spec.rb +18 -0
  103. data/spec/models/operations_spec.rb +2 -2
  104. data/spec/models/payment_codi_spec.rb +1 -1
  105. data/spec/models/payment_request_report_dto_spec.rb +99 -0
  106. data/spec/models/payment_request_req_spec.rb +109 -0
  107. data/spec/models/payment_request_response_spec.rb +53 -0
  108. data/spec/models/payments_spei_and_spid_order_id_spec.rb +47 -0
  109. data/spec/models/payments_spei_and_spid_request_id_spec.rb +65 -0
  110. data/spec/models/product_spec.rb +63 -0
  111. data/spec/models/recurring_charge_request_spec.rb +77 -0
  112. data/spec/models/spid_beneficiary_response_spec.rb +6 -0
  113. data/spec/models/success_charges_data_dto_spec.rb +65 -0
  114. data/spec/models/success_data_dto_spec.rb +51 -0
  115. data/spec/models/transaction_spei_spid_spec.rb +83 -0
  116. data/spec/models/transactions_register_spec.rb +59 -0
  117. data/wire4_client-1.1.3.gem +0 -0
  118. data/wire4_client.gemspec +7 -7
  119. metadata +107 -55
@@ -0,0 +1,401 @@
1
+ =begin
2
+ #Wire4RestAPI
3
+
4
+ #Referencia de la API de Wire4
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.10
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Wire4Client
16
+ # Objeto request para solicitud de pago
17
+ class PaymentRequestReq
18
+ # Es el monto de la solicitud de pago
19
+ attr_accessor :amount
20
+
21
+ # Es la dirección URL a la que se redirigirá en caso de que el usuario cancele.
22
+ attr_accessor :cancel_return_url
23
+
24
+ # Datos del cliente
25
+ attr_accessor :customer
26
+
27
+ # Es el número de cuenta CLABE donde se realizará el deposito.
28
+ attr_accessor :depositant_account
29
+
30
+ # Es la descripción de la solicitud de pago.
31
+ attr_accessor :description
32
+
33
+ # Es la fecha de operación de la solicitud de pago.
34
+ attr_accessor :due_date
35
+
36
+ # Es la fecha de inicio de la solicitud de pago.
37
+ attr_accessor :from_date
38
+
39
+ attr_accessor :method
40
+
41
+ # Número de orden asignado por el cliente de Wire4
42
+ attr_accessor :order_id
43
+
44
+ # Es la dirección URL a la que se redirigirá en caso de éxito.
45
+ attr_accessor :return_url
46
+
47
+ # Tipo de pago por paycash
48
+ attr_accessor :type
49
+
50
+ class EnumAttributeValidator
51
+ attr_reader :datatype
52
+ attr_reader :allowable_values
53
+
54
+ def initialize(datatype, allowable_values)
55
+ @allowable_values = allowable_values.map do |value|
56
+ case datatype.to_s
57
+ when /Integer/i
58
+ value.to_i
59
+ when /Float/i
60
+ value.to_f
61
+ else
62
+ value
63
+ end
64
+ end
65
+ end
66
+
67
+ def valid?(value)
68
+ !value || allowable_values.include?(value)
69
+ end
70
+ end
71
+
72
+ # Attribute mapping from ruby-style variable name to JSON key.
73
+ def self.attribute_map
74
+ {
75
+ :'amount' => :'amount',
76
+ :'cancel_return_url' => :'cancel_return_url',
77
+ :'customer' => :'customer',
78
+ :'depositant_account' => :'depositant_account',
79
+ :'description' => :'description',
80
+ :'due_date' => :'due_date',
81
+ :'from_date' => :'from_date',
82
+ :'method' => :'method',
83
+ :'order_id' => :'order_id',
84
+ :'return_url' => :'return_url',
85
+ :'type' => :'type'
86
+ }
87
+ end
88
+
89
+ # Attribute type mapping.
90
+ def self.swagger_types
91
+ {
92
+ :'amount' => :'Float',
93
+ :'cancel_return_url' => :'String',
94
+ :'customer' => :'Customer',
95
+ :'depositant_account' => :'String',
96
+ :'description' => :'String',
97
+ :'due_date' => :'Date',
98
+ :'from_date' => :'Date',
99
+ :'method' => :'String',
100
+ :'order_id' => :'String',
101
+ :'return_url' => :'String',
102
+ :'type' => :'String'
103
+ }
104
+ end
105
+
106
+ # Initializes the object
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ def initialize(attributes = {})
109
+ return unless attributes.is_a?(Hash)
110
+
111
+ # convert string to symbol for hash key
112
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
113
+
114
+ if attributes.has_key?(:'amount')
115
+ self.amount = attributes[:'amount']
116
+ end
117
+
118
+ if attributes.has_key?(:'cancel_return_url')
119
+ self.cancel_return_url = attributes[:'cancel_return_url']
120
+ end
121
+
122
+ if attributes.has_key?(:'customer')
123
+ self.customer = attributes[:'customer']
124
+ end
125
+
126
+ if attributes.has_key?(:'depositant_account')
127
+ self.depositant_account = attributes[:'depositant_account']
128
+ end
129
+
130
+ if attributes.has_key?(:'description')
131
+ self.description = attributes[:'description']
132
+ end
133
+
134
+ if attributes.has_key?(:'due_date')
135
+ self.due_date = attributes[:'due_date']
136
+ end
137
+
138
+ if attributes.has_key?(:'from_date')
139
+ self.from_date = attributes[:'from_date']
140
+ end
141
+
142
+ if attributes.has_key?(:'method')
143
+ self.method = attributes[:'method']
144
+ end
145
+
146
+ if attributes.has_key?(:'order_id')
147
+ self.order_id = attributes[:'order_id']
148
+ end
149
+
150
+ if attributes.has_key?(:'return_url')
151
+ self.return_url = attributes[:'return_url']
152
+ end
153
+
154
+ if attributes.has_key?(:'type')
155
+ self.type = attributes[:'type']
156
+ end
157
+ end
158
+
159
+ # Show invalid properties with the reasons. Usually used together with valid?
160
+ # @return Array for valid properties with the reasons
161
+ def list_invalid_properties
162
+ invalid_properties = Array.new
163
+ if @amount.nil?
164
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
165
+ end
166
+
167
+ if @amount > 100000
168
+ invalid_properties.push('invalid value for "amount", must be smaller than or equal to 100000.')
169
+ end
170
+
171
+ if @amount < 0.01
172
+ invalid_properties.push('invalid value for "amount", must be greater than or equal to 0.01.')
173
+ end
174
+
175
+ if @method.nil?
176
+ invalid_properties.push('invalid value for "method", method cannot be nil.')
177
+ end
178
+
179
+ if @order_id.nil?
180
+ invalid_properties.push('invalid value for "order_id", order_id cannot be nil.')
181
+ end
182
+
183
+ if @order_id.to_s.length > 256
184
+ invalid_properties.push('invalid value for "order_id", the character length must be smaller than or equal to 256.')
185
+ end
186
+
187
+ if @order_id.to_s.length < 1
188
+ invalid_properties.push('invalid value for "order_id", the character length must be great than or equal to 1.')
189
+ end
190
+
191
+ invalid_properties
192
+ end
193
+
194
+ # Check to see if the all the properties in the model are valid
195
+ # @return true if the model is valid
196
+ def valid?
197
+ return false if @amount.nil?
198
+ return false if @amount > 100000
199
+ return false if @amount < 0.01
200
+ return false if @method.nil?
201
+ method_validator = EnumAttributeValidator.new('String', ['CARD', 'CASH', 'SPEI'])
202
+ return false unless method_validator.valid?(@method)
203
+ return false if @order_id.nil?
204
+ return false if @order_id.to_s.length > 256
205
+ return false if @order_id.to_s.length < 1
206
+ type_validator = EnumAttributeValidator.new('String', ['RECURRENT', 'ONE_OCCASION'])
207
+ return false unless type_validator.valid?(@type)
208
+ true
209
+ end
210
+
211
+ # Custom attribute writer method with validation
212
+ # @param [Object] amount Value to be assigned
213
+ def amount=(amount)
214
+ if amount.nil?
215
+ fail ArgumentError, 'amount cannot be nil'
216
+ end
217
+
218
+ if amount > 100000
219
+ fail ArgumentError, 'invalid value for "amount", must be smaller than or equal to 100000.'
220
+ end
221
+
222
+ if amount < 0.01
223
+ fail ArgumentError, 'invalid value for "amount", must be greater than or equal to 0.01.'
224
+ end
225
+
226
+ @amount = amount
227
+ end
228
+
229
+ # Custom attribute writer method checking allowed values (enum).
230
+ # @param [Object] method Object to be assigned
231
+ def method=(method)
232
+ validator = EnumAttributeValidator.new('String', ['CARD', 'CASH', 'SPEI'])
233
+ unless validator.valid?(method)
234
+ fail ArgumentError, 'invalid value for "method", must be one of #{validator.allowable_values}.'
235
+ end
236
+ @method = method
237
+ end
238
+
239
+ # Custom attribute writer method with validation
240
+ # @param [Object] order_id Value to be assigned
241
+ def order_id=(order_id)
242
+ if order_id.nil?
243
+ fail ArgumentError, 'order_id cannot be nil'
244
+ end
245
+
246
+ if order_id.to_s.length > 256
247
+ fail ArgumentError, 'invalid value for "order_id", the character length must be smaller than or equal to 256.'
248
+ end
249
+
250
+ if order_id.to_s.length < 1
251
+ fail ArgumentError, 'invalid value for "order_id", the character length must be great than or equal to 1.'
252
+ end
253
+
254
+ @order_id = order_id
255
+ end
256
+
257
+ # Custom attribute writer method checking allowed values (enum).
258
+ # @param [Object] type Object to be assigned
259
+ def type=(type)
260
+ validator = EnumAttributeValidator.new('String', ['RECURRENT', 'ONE_OCCASION'])
261
+ unless validator.valid?(type)
262
+ fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
263
+ end
264
+ @type = type
265
+ end
266
+
267
+ # Checks equality by comparing each attribute.
268
+ # @param [Object] Object to be compared
269
+ def ==(o)
270
+ return true if self.equal?(o)
271
+ self.class == o.class &&
272
+ amount == o.amount &&
273
+ cancel_return_url == o.cancel_return_url &&
274
+ customer == o.customer &&
275
+ depositant_account == o.depositant_account &&
276
+ description == o.description &&
277
+ due_date == o.due_date &&
278
+ from_date == o.from_date &&
279
+ method == o.method &&
280
+ order_id == o.order_id &&
281
+ return_url == o.return_url &&
282
+ type == o.type
283
+ end
284
+
285
+ # @see the `==` method
286
+ # @param [Object] Object to be compared
287
+ def eql?(o)
288
+ self == o
289
+ end
290
+
291
+ # Calculates hash code according to all attributes.
292
+ # @return [Fixnum] Hash code
293
+ def hash
294
+ [amount, cancel_return_url, customer, depositant_account, description, due_date, from_date, method, order_id, return_url, type].hash
295
+ end
296
+
297
+ # Builds the object from hash
298
+ # @param [Hash] attributes Model attributes in the form of hash
299
+ # @return [Object] Returns the model itself
300
+ def build_from_hash(attributes)
301
+ return nil unless attributes.is_a?(Hash)
302
+ self.class.swagger_types.each_pair do |key, type|
303
+ if type =~ /\AArray<(.*)>/i
304
+ # check to ensure the input is an array given that the the attribute
305
+ # is documented as an array but the input is not
306
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
307
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
308
+ end
309
+ elsif !attributes[self.class.attribute_map[key]].nil?
310
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
311
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
312
+ end
313
+
314
+ self
315
+ end
316
+
317
+ # Deserializes the data based on type
318
+ # @param string type Data type
319
+ # @param string value Value to be deserialized
320
+ # @return [Object] Deserialized data
321
+ def _deserialize(type, value)
322
+ case type.to_sym
323
+ when :DateTime
324
+ DateTime.parse(value)
325
+ when :Date
326
+ Date.parse(value)
327
+ when :String
328
+ value.to_s
329
+ when :Integer
330
+ value.to_i
331
+ when :Float
332
+ value.to_f
333
+ when :BOOLEAN
334
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
335
+ true
336
+ else
337
+ false
338
+ end
339
+ when :Object
340
+ # generic object (usually a Hash), return directly
341
+ value
342
+ when /\AArray<(?<inner_type>.+)>\z/
343
+ inner_type = Regexp.last_match[:inner_type]
344
+ value.map { |v| _deserialize(inner_type, v) }
345
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
346
+ k_type = Regexp.last_match[:k_type]
347
+ v_type = Regexp.last_match[:v_type]
348
+ {}.tap do |hash|
349
+ value.each do |k, v|
350
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
351
+ end
352
+ end
353
+ else # model
354
+ temp_model = Wire4Client.const_get(type).new
355
+ temp_model.build_from_hash(value)
356
+ end
357
+ end
358
+
359
+ # Returns the string representation of the object
360
+ # @return [String] String presentation of the object
361
+ def to_s
362
+ to_hash.to_s
363
+ end
364
+
365
+ # to_body is an alias to to_hash (backward compatibility)
366
+ # @return [Hash] Returns the object in the form of hash
367
+ def to_body
368
+ to_hash
369
+ end
370
+
371
+ # Returns the object in the form of hash
372
+ # @return [Hash] Returns the object in the form of hash
373
+ def to_hash
374
+ hash = {}
375
+ self.class.attribute_map.each_pair do |attr, param|
376
+ value = self.send(attr)
377
+ next if value.nil?
378
+ hash[param] = _to_hash(value)
379
+ end
380
+ hash
381
+ end
382
+
383
+ # Outputs non-array value in the form of hash
384
+ # For object, use to_hash. Otherwise, just return the value
385
+ # @param [Object] value Any valid value
386
+ # @return [Hash] Returns the value in the form of hash
387
+ def _to_hash(value)
388
+ if value.is_a?(Array)
389
+ value.compact.map { |v| _to_hash(v) }
390
+ elsif value.is_a?(Hash)
391
+ {}.tap do |hash|
392
+ value.each { |k, v| hash[k] = _to_hash(v) }
393
+ end
394
+ elsif value.respond_to? :to_hash
395
+ value.to_hash
396
+ else
397
+ value
398
+ end
399
+ end
400
+ end
401
+ end
@@ -0,0 +1,204 @@
1
+ =begin
2
+ #Wire4RestAPI
3
+
4
+ #Referencia de la API de Wire4
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.10
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module Wire4Client
16
+ class PaymentRequestResponse
17
+ # Es la referencia de pago generada para la petición (solicitud).
18
+ attr_accessor :reference
19
+
20
+ # Es el identificador público generado para la petición (solicitud).
21
+ attr_accessor :request_id
22
+
23
+ # Url del portal en donde se debe capturar los datos de la tarjeta para aplicar el cargo
24
+ attr_accessor :url
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'reference' => :'reference',
30
+ :'request_id' => :'request_id',
31
+ :'url' => :'url'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.swagger_types
37
+ {
38
+ :'reference' => :'String',
39
+ :'request_id' => :'String',
40
+ :'url' => :'String'
41
+ }
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ return unless attributes.is_a?(Hash)
48
+
49
+ # convert string to symbol for hash key
50
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
51
+
52
+ if attributes.has_key?(:'reference')
53
+ self.reference = attributes[:'reference']
54
+ end
55
+
56
+ if attributes.has_key?(:'request_id')
57
+ self.request_id = attributes[:'request_id']
58
+ end
59
+
60
+ if attributes.has_key?(:'url')
61
+ self.url = attributes[:'url']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ reference == o.reference &&
84
+ request_id == o.request_id &&
85
+ url == o.url
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Fixnum] Hash code
96
+ def hash
97
+ [reference, request_id, url].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def build_from_hash(attributes)
104
+ return nil unless attributes.is_a?(Hash)
105
+ self.class.swagger_types.each_pair do |key, type|
106
+ if type =~ /\AArray<(.*)>/i
107
+ # check to ensure the input is an array given that the the attribute
108
+ # is documented as an array but the input is not
109
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
110
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
111
+ end
112
+ elsif !attributes[self.class.attribute_map[key]].nil?
113
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
114
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
115
+ end
116
+
117
+ self
118
+ end
119
+
120
+ # Deserializes the data based on type
121
+ # @param string type Data type
122
+ # @param string value Value to be deserialized
123
+ # @return [Object] Deserialized data
124
+ def _deserialize(type, value)
125
+ case type.to_sym
126
+ when :DateTime
127
+ DateTime.parse(value)
128
+ when :Date
129
+ Date.parse(value)
130
+ when :String
131
+ value.to_s
132
+ when :Integer
133
+ value.to_i
134
+ when :Float
135
+ value.to_f
136
+ when :BOOLEAN
137
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
138
+ true
139
+ else
140
+ false
141
+ end
142
+ when :Object
143
+ # generic object (usually a Hash), return directly
144
+ value
145
+ when /\AArray<(?<inner_type>.+)>\z/
146
+ inner_type = Regexp.last_match[:inner_type]
147
+ value.map { |v| _deserialize(inner_type, v) }
148
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
149
+ k_type = Regexp.last_match[:k_type]
150
+ v_type = Regexp.last_match[:v_type]
151
+ {}.tap do |hash|
152
+ value.each do |k, v|
153
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
154
+ end
155
+ end
156
+ else # model
157
+ temp_model = Wire4Client.const_get(type).new
158
+ temp_model.build_from_hash(value)
159
+ end
160
+ end
161
+
162
+ # Returns the string representation of the object
163
+ # @return [String] String presentation of the object
164
+ def to_s
165
+ to_hash.to_s
166
+ end
167
+
168
+ # to_body is an alias to to_hash (backward compatibility)
169
+ # @return [Hash] Returns the object in the form of hash
170
+ def to_body
171
+ to_hash
172
+ end
173
+
174
+ # Returns the object in the form of hash
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_hash
177
+ hash = {}
178
+ self.class.attribute_map.each_pair do |attr, param|
179
+ value = self.send(attr)
180
+ next if value.nil?
181
+ hash[param] = _to_hash(value)
182
+ end
183
+ hash
184
+ end
185
+
186
+ # Outputs non-array value in the form of hash
187
+ # For object, use to_hash. Otherwise, just return the value
188
+ # @param [Object] value Any valid value
189
+ # @return [Hash] Returns the value in the form of hash
190
+ def _to_hash(value)
191
+ if value.is_a?(Array)
192
+ value.compact.map { |v| _to_hash(v) }
193
+ elsif value.is_a?(Hash)
194
+ {}.tap do |hash|
195
+ value.each { |k, v| hash[k] = _to_hash(v) }
196
+ end
197
+ elsif value.respond_to? :to_hash
198
+ value.to_hash
199
+ else
200
+ value
201
+ end
202
+ end
203
+ end
204
+ end