wire4_client 0.0.1.pre.SNAPSHOT

Sign up to get free protection for your applications and to get access to all the features.
Files changed (187) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/Gemfile.lock +69 -0
  4. data/README.md +188 -0
  5. data/Rakefile +8 -0
  6. data/docs/Account.md +18 -0
  7. data/docs/AccountRequest.md +10 -0
  8. data/docs/AccountResponse.md +18 -0
  9. data/docs/AccountSpid.md +19 -0
  10. data/docs/AmountRequest.md +10 -0
  11. data/docs/Balance.md +10 -0
  12. data/docs/BalanceListResponse.md +8 -0
  13. data/docs/BeneficiariesResponse.md +8 -0
  14. data/docs/BeneficiaryInstitution.md +8 -0
  15. data/docs/Billing.md +16 -0
  16. data/docs/BillingTransaction.md +15 -0
  17. data/docs/CepResponse.md +28 -0
  18. data/docs/CepSearchBanxico.md +15 -0
  19. data/docs/ComprobanteElectrnicoDePagoCEPApi.md +61 -0
  20. data/docs/ContactRequest.md +12 -0
  21. data/docs/ContactoApi.md +60 -0
  22. data/docs/CuentasDeBeneficiariosSPEIApi.md +342 -0
  23. data/docs/CuentasDeBeneficiariosSPIDApi.md +62 -0
  24. data/docs/Deposit.md +27 -0
  25. data/docs/Depositant.md +12 -0
  26. data/docs/DepositantesApi.md +117 -0
  27. data/docs/DepositantsRegister.md +11 -0
  28. data/docs/DepositantsResponse.md +8 -0
  29. data/docs/ErrorResponse.md +9 -0
  30. data/docs/FacturasApi.md +115 -0
  31. data/docs/GetDepositants.md +8 -0
  32. data/docs/InstitucionesApi.md +53 -0
  33. data/docs/Institution.md +11 -0
  34. data/docs/InstitutionsList.md +8 -0
  35. data/docs/MessageAccountBeneficiary.md +10 -0
  36. data/docs/MessageCEP.md +28 -0
  37. data/docs/MessageDepositReceived.md +27 -0
  38. data/docs/MessageInstitution.md +11 -0
  39. data/docs/MessagePayment.md +25 -0
  40. data/docs/MessageSubscription.md +12 -0
  41. data/docs/MessageWebHook.md +16 -0
  42. data/docs/Payment.md +24 -0
  43. data/docs/Person.md +10 -0
  44. data/docs/PreEnrollmentData.md +9 -0
  45. data/docs/PreEnrollmentResponse.md +9 -0
  46. data/docs/Relationship.md +9 -0
  47. data/docs/RelationshipsResponse.md +8 -0
  48. data/docs/SaldoApi.md +61 -0
  49. data/docs/SpidClassificationDTO.md +9 -0
  50. data/docs/SpidClassificationsResponseDTO.md +8 -0
  51. data/docs/SuscripcionesApi.md +165 -0
  52. data/docs/Timestamp.md +17 -0
  53. data/docs/TokenRequiredResponse.md +9 -0
  54. data/docs/TransactionOutgoing.md +14 -0
  55. data/docs/TransactionOutgoingSpid.md +17 -0
  56. data/docs/TransactionsOutgoingRegister.md +10 -0
  57. data/docs/TransferenciasSPEIApi.md +229 -0
  58. data/docs/TransferenciasSPIDApi.md +117 -0
  59. data/docs/WebhookRequest.md +10 -0
  60. data/docs/WebhookResponse.md +13 -0
  61. data/docs/WebhooksApi.md +161 -0
  62. data/docs/WebhooksList.md +8 -0
  63. data/git_push.sh +55 -0
  64. data/lib/wire4_client.rb +96 -0
  65. data/lib/wire4_client/api/comprobante_electrnico_de_pago_cep_api.rb +77 -0
  66. data/lib/wire4_client/api/contacto_api.rb +76 -0
  67. data/lib/wire4_client/api/cuentas_de_beneficiarios_spei_api.rb +453 -0
  68. data/lib/wire4_client/api/cuentas_de_beneficiarios_spid_api.rb +93 -0
  69. data/lib/wire4_client/api/depositantes_api.rb +159 -0
  70. data/lib/wire4_client/api/facturas_api.rb +124 -0
  71. data/lib/wire4_client/api/instituciones_api.rb +67 -0
  72. data/lib/wire4_client/api/saldo_api.rb +87 -0
  73. data/lib/wire4_client/api/suscripciones_api.rb +203 -0
  74. data/lib/wire4_client/api/transferencias_spei_api.rb +307 -0
  75. data/lib/wire4_client/api/transferencias_spid_api.rb +155 -0
  76. data/lib/wire4_client/api/webhooks_api.rb +175 -0
  77. data/lib/wire4_client/api_client.rb +389 -0
  78. data/lib/wire4_client/api_error.rb +38 -0
  79. data/lib/wire4_client/configuration.rb +223 -0
  80. data/lib/wire4_client/models/account.rb +345 -0
  81. data/lib/wire4_client/models/account_request.rb +217 -0
  82. data/lib/wire4_client/models/account_response.rb +345 -0
  83. data/lib/wire4_client/models/account_spid.rb +388 -0
  84. data/lib/wire4_client/models/amount_request.rb +258 -0
  85. data/lib/wire4_client/models/balance.rb +205 -0
  86. data/lib/wire4_client/models/balance_list_response.rb +187 -0
  87. data/lib/wire4_client/models/beneficiaries_response.rb +186 -0
  88. data/lib/wire4_client/models/beneficiary_institution.rb +185 -0
  89. data/lib/wire4_client/models/billing.rb +300 -0
  90. data/lib/wire4_client/models/billing_transaction.rb +289 -0
  91. data/lib/wire4_client/models/cep_response.rb +384 -0
  92. data/lib/wire4_client/models/cep_search_banxico.rb +373 -0
  93. data/lib/wire4_client/models/contact_request.rb +272 -0
  94. data/lib/wire4_client/models/deposit.rb +374 -0
  95. data/lib/wire4_client/models/depositant.rb +227 -0
  96. data/lib/wire4_client/models/depositants_register.rb +315 -0
  97. data/lib/wire4_client/models/depositants_response.rb +184 -0
  98. data/lib/wire4_client/models/error_response.rb +192 -0
  99. data/lib/wire4_client/models/get_depositants.rb +192 -0
  100. data/lib/wire4_client/models/institution.rb +215 -0
  101. data/lib/wire4_client/models/institutions_list.rb +186 -0
  102. data/lib/wire4_client/models/message_account_beneficiary.rb +205 -0
  103. data/lib/wire4_client/models/message_cep.rb +385 -0
  104. data/lib/wire4_client/models/message_deposit_received.rb +375 -0
  105. data/lib/wire4_client/models/message_institution.rb +215 -0
  106. data/lib/wire4_client/models/message_payment.rb +354 -0
  107. data/lib/wire4_client/models/message_subscription.rb +225 -0
  108. data/lib/wire4_client/models/message_web_hook.rb +265 -0
  109. data/lib/wire4_client/models/payment.rb +344 -0
  110. data/lib/wire4_client/models/person.rb +220 -0
  111. data/lib/wire4_client/models/pre_enrollment_data.rb +260 -0
  112. data/lib/wire4_client/models/pre_enrollment_response.rb +194 -0
  113. data/lib/wire4_client/models/relationship.rb +194 -0
  114. data/lib/wire4_client/models/relationships_response.rb +186 -0
  115. data/lib/wire4_client/models/spid_classification_dto.rb +195 -0
  116. data/lib/wire4_client/models/spid_classifications_response_dto.rb +186 -0
  117. data/lib/wire4_client/models/timestamp.rb +264 -0
  118. data/lib/wire4_client/models/token_required_response.rb +195 -0
  119. data/lib/wire4_client/models/transaction_outgoing.rb +380 -0
  120. data/lib/wire4_client/models/transaction_outgoing_spid.rb +425 -0
  121. data/lib/wire4_client/models/transactions_outgoing_register.rb +222 -0
  122. data/lib/wire4_client/models/webhook_request.rb +222 -0
  123. data/lib/wire4_client/models/webhook_response.rb +271 -0
  124. data/lib/wire4_client/models/webhooks_list.rb +186 -0
  125. data/lib/wire4_client/version.rb +15 -0
  126. data/spec/api/comprobante_electrnico_de_pago_cep_api_spec.rb +47 -0
  127. data/spec/api/contacto_api_spec.rb +47 -0
  128. data/spec/api/cuentas_de_beneficiarios_spei_api_spec.rb +113 -0
  129. data/spec/api/cuentas_de_beneficiarios_spid_api_spec.rb +47 -0
  130. data/spec/api/depositantes_api_spec.rb +60 -0
  131. data/spec/api/facturas_api_spec.rb +59 -0
  132. data/spec/api/instituciones_api_spec.rb +45 -0
  133. data/spec/api/saldo_api_spec.rb +47 -0
  134. data/spec/api/suscripciones_api_spec.rb +71 -0
  135. data/spec/api/transferencias_spei_api_spec.rb +86 -0
  136. data/spec/api/transferencias_spid_api_spec.rb +60 -0
  137. data/spec/api/webhooks_api_spec.rb +70 -0
  138. data/spec/api_client_spec.rb +226 -0
  139. data/spec/configuration_spec.rb +42 -0
  140. data/spec/models/account_request_spec.rb +53 -0
  141. data/spec/models/account_response_spec.rb +101 -0
  142. data/spec/models/account_spec.rb +101 -0
  143. data/spec/models/account_spid_spec.rb +107 -0
  144. data/spec/models/amount_request_spec.rb +53 -0
  145. data/spec/models/balance_list_response_spec.rb +41 -0
  146. data/spec/models/balance_spec.rb +53 -0
  147. data/spec/models/beneficiaries_response_spec.rb +41 -0
  148. data/spec/models/beneficiary_institution_spec.rb +41 -0
  149. data/spec/models/billing_spec.rb +93 -0
  150. data/spec/models/billing_transaction_spec.rb +87 -0
  151. data/spec/models/cep_response_spec.rb +161 -0
  152. data/spec/models/cep_search_banxico_spec.rb +83 -0
  153. data/spec/models/contact_request_spec.rb +65 -0
  154. data/spec/models/deposit_spec.rb +155 -0
  155. data/spec/models/depositant_spec.rb +65 -0
  156. data/spec/models/depositants_register_spec.rb +59 -0
  157. data/spec/models/depositants_response_spec.rb +41 -0
  158. data/spec/models/error_response_spec.rb +47 -0
  159. data/spec/models/get_depositants_spec.rb +41 -0
  160. data/spec/models/institution_spec.rb +59 -0
  161. data/spec/models/institutions_list_spec.rb +41 -0
  162. data/spec/models/message_account_beneficiary_spec.rb +53 -0
  163. data/spec/models/message_cep_spec.rb +161 -0
  164. data/spec/models/message_deposit_received_spec.rb +155 -0
  165. data/spec/models/message_institution_spec.rb +59 -0
  166. data/spec/models/message_payment_spec.rb +143 -0
  167. data/spec/models/message_subscription_spec.rb +65 -0
  168. data/spec/models/message_web_hook_spec.rb +89 -0
  169. data/spec/models/payment_spec.rb +137 -0
  170. data/spec/models/person_spec.rb +53 -0
  171. data/spec/models/pre_enrollment_data_spec.rb +47 -0
  172. data/spec/models/pre_enrollment_response_spec.rb +47 -0
  173. data/spec/models/relationship_spec.rb +47 -0
  174. data/spec/models/relationships_response_spec.rb +41 -0
  175. data/spec/models/spid_classification_dto_spec.rb +47 -0
  176. data/spec/models/spid_classifications_response_dto_spec.rb +41 -0
  177. data/spec/models/timestamp_spec.rb +95 -0
  178. data/spec/models/token_required_response_spec.rb +47 -0
  179. data/spec/models/transaction_outgoing_spec.rb +77 -0
  180. data/spec/models/transaction_outgoing_spid_spec.rb +95 -0
  181. data/spec/models/transactions_outgoing_register_spec.rb +53 -0
  182. data/spec/models/webhook_request_spec.rb +53 -0
  183. data/spec/models/webhook_response_spec.rb +75 -0
  184. data/spec/models/webhooks_list_spec.rb +41 -0
  185. data/spec/spec_helper.rb +111 -0
  186. data/wire4_client.gemspec +45 -0
  187. metadata +468 -0
@@ -0,0 +1,373 @@
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 CepSearchBanxico
17
+ # Monto de la transferencia
18
+ attr_accessor :amount
19
+
20
+ # Cuenta de beneficiario
21
+ attr_accessor :beneficiary_account
22
+
23
+ # Clave del banco beneficiario, se puede obtener este valor del listado de institucines '/institutions'. Si este valor no esta presente se obtiene de la cuenta del beneficiario, si la cuenta de beneficiario es un número celular este campo es requerido
24
+ attr_accessor :beneficiary_bank_key
25
+
26
+ # Clave de rastreo de la transferencia
27
+ attr_accessor :clave_rastreo
28
+
29
+ # Fecha de operación de la transferencia, formato: dd-MM-yyyy
30
+ attr_accessor :operation_date
31
+
32
+ # Referencia numérica de la transferencia
33
+ attr_accessor :reference
34
+
35
+ # Cuenta ordenante, es requerida cuando se no se envía la clave del banco ordenante
36
+ attr_accessor :sender_account
37
+
38
+ # Clave del banco ordenante, se puede obtener este valor del listado de institucines '/institutions'. Es requerida cuando no se envía la cuenta ordenante
39
+ attr_accessor :sender_bank_key
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'amount' => :'amount',
45
+ :'beneficiary_account' => :'beneficiary_account',
46
+ :'beneficiary_bank_key' => :'beneficiary_bank_key',
47
+ :'clave_rastreo' => :'clave_rastreo',
48
+ :'operation_date' => :'operation_date',
49
+ :'reference' => :'reference',
50
+ :'sender_account' => :'sender_account',
51
+ :'sender_bank_key' => :'sender_bank_key'
52
+ }
53
+ end
54
+
55
+ # Attribute type mapping.
56
+ def self.swagger_types
57
+ {
58
+ :'amount' => :'Float',
59
+ :'beneficiary_account' => :'String',
60
+ :'beneficiary_bank_key' => :'String',
61
+ :'clave_rastreo' => :'String',
62
+ :'operation_date' => :'String',
63
+ :'reference' => :'String',
64
+ :'sender_account' => :'String',
65
+ :'sender_bank_key' => :'String'
66
+ }
67
+ end
68
+
69
+ # Initializes the object
70
+ # @param [Hash] attributes Model attributes in the form of hash
71
+ def initialize(attributes = {})
72
+ return unless attributes.is_a?(Hash)
73
+
74
+ # convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
76
+
77
+ if attributes.has_key?(:'amount')
78
+ self.amount = attributes[:'amount']
79
+ end
80
+
81
+ if attributes.has_key?(:'beneficiary_account')
82
+ self.beneficiary_account = attributes[:'beneficiary_account']
83
+ end
84
+
85
+ if attributes.has_key?(:'beneficiary_bank_key')
86
+ self.beneficiary_bank_key = attributes[:'beneficiary_bank_key']
87
+ end
88
+
89
+ if attributes.has_key?(:'clave_rastreo')
90
+ self.clave_rastreo = attributes[:'clave_rastreo']
91
+ end
92
+
93
+ if attributes.has_key?(:'operation_date')
94
+ self.operation_date = attributes[:'operation_date']
95
+ end
96
+
97
+ if attributes.has_key?(:'reference')
98
+ self.reference = attributes[:'reference']
99
+ end
100
+
101
+ if attributes.has_key?(:'sender_account')
102
+ self.sender_account = attributes[:'sender_account']
103
+ end
104
+
105
+ if attributes.has_key?(:'sender_bank_key')
106
+ self.sender_bank_key = attributes[:'sender_bank_key']
107
+ end
108
+ end
109
+
110
+ # Show invalid properties with the reasons. Usually used together with valid?
111
+ # @return Array for valid properties with the reasons
112
+ def list_invalid_properties
113
+ invalid_properties = Array.new
114
+ if @amount.nil?
115
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
116
+ end
117
+
118
+ if @beneficiary_account.nil?
119
+ invalid_properties.push('invalid value for "beneficiary_account", beneficiary_account cannot be nil.')
120
+ end
121
+
122
+ if !@beneficiary_bank_key.nil? && @beneficiary_bank_key.to_s.length > 5
123
+ invalid_properties.push('invalid value for "beneficiary_bank_key", the character length must be smaller than or equal to 5.')
124
+ end
125
+
126
+ if !@beneficiary_bank_key.nil? && @beneficiary_bank_key.to_s.length < 1
127
+ invalid_properties.push('invalid value for "beneficiary_bank_key", the character length must be great than or equal to 1.')
128
+ end
129
+
130
+ if !@beneficiary_bank_key.nil? && @beneficiary_bank_key !~ Regexp.new(/[0-9][0-9]*/)
131
+ invalid_properties.push('invalid value for "beneficiary_bank_key", must conform to the pattern /[0-9][0-9]*/.')
132
+ end
133
+
134
+ if @clave_rastreo.nil?
135
+ invalid_properties.push('invalid value for "clave_rastreo", clave_rastreo cannot be nil.')
136
+ end
137
+
138
+ if @operation_date.nil?
139
+ invalid_properties.push('invalid value for "operation_date", operation_date cannot be nil.')
140
+ end
141
+
142
+ if !@reference.nil? && @reference.to_s.length > 7
143
+ invalid_properties.push('invalid value for "reference", the character length must be smaller than or equal to 7.')
144
+ end
145
+
146
+ if !@reference.nil? && @reference.to_s.length < 1
147
+ invalid_properties.push('invalid value for "reference", the character length must be great than or equal to 1.')
148
+ end
149
+
150
+ if !@reference.nil? && @reference !~ Regexp.new(/[0-9][0-9]*/)
151
+ invalid_properties.push('invalid value for "reference", must conform to the pattern /[0-9][0-9]*/.')
152
+ end
153
+
154
+ if !@sender_bank_key.nil? && @sender_bank_key.to_s.length > 5
155
+ invalid_properties.push('invalid value for "sender_bank_key", the character length must be smaller than or equal to 5.')
156
+ end
157
+
158
+ if !@sender_bank_key.nil? && @sender_bank_key.to_s.length < 1
159
+ invalid_properties.push('invalid value for "sender_bank_key", the character length must be great than or equal to 1.')
160
+ end
161
+
162
+ if !@sender_bank_key.nil? && @sender_bank_key !~ Regexp.new(/[0-9][0-9]*/)
163
+ invalid_properties.push('invalid value for "sender_bank_key", must conform to the pattern /[0-9][0-9]*/.')
164
+ end
165
+
166
+ invalid_properties
167
+ end
168
+
169
+ # Check to see if the all the properties in the model are valid
170
+ # @return true if the model is valid
171
+ def valid?
172
+ return false if @amount.nil?
173
+ return false if @beneficiary_account.nil?
174
+ return false if !@beneficiary_bank_key.nil? && @beneficiary_bank_key.to_s.length > 5
175
+ return false if !@beneficiary_bank_key.nil? && @beneficiary_bank_key.to_s.length < 1
176
+ return false if !@beneficiary_bank_key.nil? && @beneficiary_bank_key !~ Regexp.new(/[0-9][0-9]*/)
177
+ return false if @clave_rastreo.nil?
178
+ return false if @operation_date.nil?
179
+ return false if !@reference.nil? && @reference.to_s.length > 7
180
+ return false if !@reference.nil? && @reference.to_s.length < 1
181
+ return false if !@reference.nil? && @reference !~ Regexp.new(/[0-9][0-9]*/)
182
+ return false if !@sender_bank_key.nil? && @sender_bank_key.to_s.length > 5
183
+ return false if !@sender_bank_key.nil? && @sender_bank_key.to_s.length < 1
184
+ return false if !@sender_bank_key.nil? && @sender_bank_key !~ Regexp.new(/[0-9][0-9]*/)
185
+ true
186
+ end
187
+
188
+ # Custom attribute writer method with validation
189
+ # @param [Object] beneficiary_bank_key Value to be assigned
190
+ def beneficiary_bank_key=(beneficiary_bank_key)
191
+ if !beneficiary_bank_key.nil? && beneficiary_bank_key.to_s.length > 5
192
+ fail ArgumentError, 'invalid value for "beneficiary_bank_key", the character length must be smaller than or equal to 5.'
193
+ end
194
+
195
+ if !beneficiary_bank_key.nil? && beneficiary_bank_key.to_s.length < 1
196
+ fail ArgumentError, 'invalid value for "beneficiary_bank_key", the character length must be great than or equal to 1.'
197
+ end
198
+
199
+ if !beneficiary_bank_key.nil? && beneficiary_bank_key !~ Regexp.new(/[0-9][0-9]*/)
200
+ fail ArgumentError, 'invalid value for "beneficiary_bank_key", must conform to the pattern /[0-9][0-9]*/.'
201
+ end
202
+
203
+ @beneficiary_bank_key = beneficiary_bank_key
204
+ end
205
+
206
+ # Custom attribute writer method with validation
207
+ # @param [Object] reference Value to be assigned
208
+ def reference=(reference)
209
+ if !reference.nil? && reference.to_s.length > 7
210
+ fail ArgumentError, 'invalid value for "reference", the character length must be smaller than or equal to 7.'
211
+ end
212
+
213
+ if !reference.nil? && reference.to_s.length < 1
214
+ fail ArgumentError, 'invalid value for "reference", the character length must be great than or equal to 1.'
215
+ end
216
+
217
+ if !reference.nil? && reference !~ Regexp.new(/[0-9][0-9]*/)
218
+ fail ArgumentError, 'invalid value for "reference", must conform to the pattern /[0-9][0-9]*/.'
219
+ end
220
+
221
+ @reference = reference
222
+ end
223
+
224
+ # Custom attribute writer method with validation
225
+ # @param [Object] sender_bank_key Value to be assigned
226
+ def sender_bank_key=(sender_bank_key)
227
+ if !sender_bank_key.nil? && sender_bank_key.to_s.length > 5
228
+ fail ArgumentError, 'invalid value for "sender_bank_key", the character length must be smaller than or equal to 5.'
229
+ end
230
+
231
+ if !sender_bank_key.nil? && sender_bank_key.to_s.length < 1
232
+ fail ArgumentError, 'invalid value for "sender_bank_key", the character length must be great than or equal to 1.'
233
+ end
234
+
235
+ if !sender_bank_key.nil? && sender_bank_key !~ Regexp.new(/[0-9][0-9]*/)
236
+ fail ArgumentError, 'invalid value for "sender_bank_key", must conform to the pattern /[0-9][0-9]*/.'
237
+ end
238
+
239
+ @sender_bank_key = sender_bank_key
240
+ end
241
+
242
+ # Checks equality by comparing each attribute.
243
+ # @param [Object] Object to be compared
244
+ def ==(o)
245
+ return true if self.equal?(o)
246
+ self.class == o.class &&
247
+ amount == o.amount &&
248
+ beneficiary_account == o.beneficiary_account &&
249
+ beneficiary_bank_key == o.beneficiary_bank_key &&
250
+ clave_rastreo == o.clave_rastreo &&
251
+ operation_date == o.operation_date &&
252
+ reference == o.reference &&
253
+ sender_account == o.sender_account &&
254
+ sender_bank_key == o.sender_bank_key
255
+ end
256
+
257
+ # @see the `==` method
258
+ # @param [Object] Object to be compared
259
+ def eql?(o)
260
+ self == o
261
+ end
262
+
263
+ # Calculates hash code according to all attributes.
264
+ # @return [Fixnum] Hash code
265
+ def hash
266
+ [amount, beneficiary_account, beneficiary_bank_key, clave_rastreo, operation_date, reference, sender_account, sender_bank_key].hash
267
+ end
268
+
269
+ # Builds the object from hash
270
+ # @param [Hash] attributes Model attributes in the form of hash
271
+ # @return [Object] Returns the model itself
272
+ def build_from_hash(attributes)
273
+ return nil unless attributes.is_a?(Hash)
274
+ self.class.swagger_types.each_pair do |key, type|
275
+ if type =~ /\AArray<(.*)>/i
276
+ # check to ensure the input is an array given that the the attribute
277
+ # is documented as an array but the input is not
278
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
279
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
280
+ end
281
+ elsif !attributes[self.class.attribute_map[key]].nil?
282
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
283
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
284
+ end
285
+
286
+ self
287
+ end
288
+
289
+ # Deserializes the data based on type
290
+ # @param string type Data type
291
+ # @param string value Value to be deserialized
292
+ # @return [Object] Deserialized data
293
+ def _deserialize(type, value)
294
+ case type.to_sym
295
+ when :DateTime
296
+ DateTime.parse(value)
297
+ when :Date
298
+ Date.parse(value)
299
+ when :String
300
+ value.to_s
301
+ when :Integer
302
+ value.to_i
303
+ when :Float
304
+ value.to_f
305
+ when :BOOLEAN
306
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
307
+ true
308
+ else
309
+ false
310
+ end
311
+ when :Object
312
+ # generic object (usually a Hash), return directly
313
+ value
314
+ when /\AArray<(?<inner_type>.+)>\z/
315
+ inner_type = Regexp.last_match[:inner_type]
316
+ value.map { |v| _deserialize(inner_type, v) }
317
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
318
+ k_type = Regexp.last_match[:k_type]
319
+ v_type = Regexp.last_match[:v_type]
320
+ {}.tap do |hash|
321
+ value.each do |k, v|
322
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
323
+ end
324
+ end
325
+ else # model
326
+ temp_model = Wire4Client.const_get(type).new
327
+ temp_model.build_from_hash(value)
328
+ end
329
+ end
330
+
331
+ # Returns the string representation of the object
332
+ # @return [String] String presentation of the object
333
+ def to_s
334
+ to_hash.to_s
335
+ end
336
+
337
+ # to_body is an alias to to_hash (backward compatibility)
338
+ # @return [Hash] Returns the object in the form of hash
339
+ def to_body
340
+ to_hash
341
+ end
342
+
343
+ # Returns the object in the form of hash
344
+ # @return [Hash] Returns the object in the form of hash
345
+ def to_hash
346
+ hash = {}
347
+ self.class.attribute_map.each_pair do |attr, param|
348
+ value = self.send(attr)
349
+ next if value.nil?
350
+ hash[param] = _to_hash(value)
351
+ end
352
+ hash
353
+ end
354
+
355
+ # Outputs non-array value in the form of hash
356
+ # For object, use to_hash. Otherwise, just return the value
357
+ # @param [Object] value Any valid value
358
+ # @return [Hash] Returns the value in the form of hash
359
+ def _to_hash(value)
360
+ if value.is_a?(Array)
361
+ value.compact.map { |v| _to_hash(v) }
362
+ elsif value.is_a?(Hash)
363
+ {}.tap do |hash|
364
+ value.each { |k, v| hash[k] = _to_hash(v) }
365
+ end
366
+ elsif value.respond_to? :to_hash
367
+ value.to_hash
368
+ else
369
+ value
370
+ end
371
+ end
372
+ end
373
+ end
@@ -0,0 +1,272 @@
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 que contiene información básica de un posible cliente
17
+ class ContactRequest
18
+ # Dirección del contacto
19
+ attr_accessor :address
20
+
21
+ # Nombre de la empresa
22
+ attr_accessor :company
23
+
24
+ # Nombre de la persona quién será contactada
25
+ attr_accessor :contact_person
26
+
27
+ # Email de la persona
28
+ attr_accessor :email
29
+
30
+ # Número de teléfono de la persona
31
+ attr_accessor :phone_number
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'address' => :'address',
37
+ :'company' => :'company',
38
+ :'contact_person' => :'contact_person',
39
+ :'email' => :'email',
40
+ :'phone_number' => :'phone_number'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.swagger_types
46
+ {
47
+ :'address' => :'String',
48
+ :'company' => :'String',
49
+ :'contact_person' => :'String',
50
+ :'email' => :'String',
51
+ :'phone_number' => :'String'
52
+ }
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ return unless attributes.is_a?(Hash)
59
+
60
+ # convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
62
+
63
+ if attributes.has_key?(:'address')
64
+ self.address = attributes[:'address']
65
+ end
66
+
67
+ if attributes.has_key?(:'company')
68
+ self.company = attributes[:'company']
69
+ end
70
+
71
+ if attributes.has_key?(:'contact_person')
72
+ self.contact_person = attributes[:'contact_person']
73
+ end
74
+
75
+ if attributes.has_key?(:'email')
76
+ self.email = attributes[:'email']
77
+ end
78
+
79
+ if attributes.has_key?(:'phone_number')
80
+ self.phone_number = attributes[:'phone_number']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ if @email.nil?
89
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
90
+ end
91
+
92
+ if @phone_number.nil?
93
+ invalid_properties.push('invalid value for "phone_number", phone_number cannot be nil.')
94
+ end
95
+
96
+ if @phone_number.to_s.length > 10
97
+ invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 10.')
98
+ end
99
+
100
+ if @phone_number.to_s.length < 10
101
+ invalid_properties.push('invalid value for "phone_number", the character length must be great than or equal to 10.')
102
+ end
103
+
104
+ if @phone_number !~ Regexp.new(/[1-9][0-9]*/)
105
+ invalid_properties.push('invalid value for "phone_number", must conform to the pattern /[1-9][0-9]*/.')
106
+ end
107
+
108
+ invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ return false if @email.nil?
115
+ return false if @phone_number.nil?
116
+ return false if @phone_number.to_s.length > 10
117
+ return false if @phone_number.to_s.length < 10
118
+ return false if @phone_number !~ Regexp.new(/[1-9][0-9]*/)
119
+ true
120
+ end
121
+
122
+ # Custom attribute writer method with validation
123
+ # @param [Object] phone_number Value to be assigned
124
+ def phone_number=(phone_number)
125
+ if phone_number.nil?
126
+ fail ArgumentError, 'phone_number cannot be nil'
127
+ end
128
+
129
+ if phone_number.to_s.length > 10
130
+ fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 10.'
131
+ end
132
+
133
+ if phone_number.to_s.length < 10
134
+ fail ArgumentError, 'invalid value for "phone_number", the character length must be great than or equal to 10.'
135
+ end
136
+
137
+ if phone_number !~ Regexp.new(/[1-9][0-9]*/)
138
+ fail ArgumentError, 'invalid value for "phone_number", must conform to the pattern /[1-9][0-9]*/.'
139
+ end
140
+
141
+ @phone_number = phone_number
142
+ end
143
+
144
+ # Checks equality by comparing each attribute.
145
+ # @param [Object] Object to be compared
146
+ def ==(o)
147
+ return true if self.equal?(o)
148
+ self.class == o.class &&
149
+ address == o.address &&
150
+ company == o.company &&
151
+ contact_person == o.contact_person &&
152
+ email == o.email &&
153
+ phone_number == o.phone_number
154
+ end
155
+
156
+ # @see the `==` method
157
+ # @param [Object] Object to be compared
158
+ def eql?(o)
159
+ self == o
160
+ end
161
+
162
+ # Calculates hash code according to all attributes.
163
+ # @return [Fixnum] Hash code
164
+ def hash
165
+ [address, company, contact_person, email, phone_number].hash
166
+ end
167
+
168
+ # Builds the object from hash
169
+ # @param [Hash] attributes Model attributes in the form of hash
170
+ # @return [Object] Returns the model itself
171
+ def build_from_hash(attributes)
172
+ return nil unless attributes.is_a?(Hash)
173
+ self.class.swagger_types.each_pair do |key, type|
174
+ if type =~ /\AArray<(.*)>/i
175
+ # check to ensure the input is an array given that the the attribute
176
+ # is documented as an array but the input is not
177
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
178
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
179
+ end
180
+ elsif !attributes[self.class.attribute_map[key]].nil?
181
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
182
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
183
+ end
184
+
185
+ self
186
+ end
187
+
188
+ # Deserializes the data based on type
189
+ # @param string type Data type
190
+ # @param string value Value to be deserialized
191
+ # @return [Object] Deserialized data
192
+ def _deserialize(type, value)
193
+ case type.to_sym
194
+ when :DateTime
195
+ DateTime.parse(value)
196
+ when :Date
197
+ Date.parse(value)
198
+ when :String
199
+ value.to_s
200
+ when :Integer
201
+ value.to_i
202
+ when :Float
203
+ value.to_f
204
+ when :BOOLEAN
205
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
206
+ true
207
+ else
208
+ false
209
+ end
210
+ when :Object
211
+ # generic object (usually a Hash), return directly
212
+ value
213
+ when /\AArray<(?<inner_type>.+)>\z/
214
+ inner_type = Regexp.last_match[:inner_type]
215
+ value.map { |v| _deserialize(inner_type, v) }
216
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
217
+ k_type = Regexp.last_match[:k_type]
218
+ v_type = Regexp.last_match[:v_type]
219
+ {}.tap do |hash|
220
+ value.each do |k, v|
221
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
222
+ end
223
+ end
224
+ else # model
225
+ temp_model = Wire4Client.const_get(type).new
226
+ temp_model.build_from_hash(value)
227
+ end
228
+ end
229
+
230
+ # Returns the string representation of the object
231
+ # @return [String] String presentation of the object
232
+ def to_s
233
+ to_hash.to_s
234
+ end
235
+
236
+ # to_body is an alias to to_hash (backward compatibility)
237
+ # @return [Hash] Returns the object in the form of hash
238
+ def to_body
239
+ to_hash
240
+ end
241
+
242
+ # Returns the object in the form of hash
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_hash
245
+ hash = {}
246
+ self.class.attribute_map.each_pair do |attr, param|
247
+ value = self.send(attr)
248
+ next if value.nil?
249
+ hash[param] = _to_hash(value)
250
+ end
251
+ hash
252
+ end
253
+
254
+ # Outputs non-array value in the form of hash
255
+ # For object, use to_hash. Otherwise, just return the value
256
+ # @param [Object] value Any valid value
257
+ # @return [Hash] Returns the value in the form of hash
258
+ def _to_hash(value)
259
+ if value.is_a?(Array)
260
+ value.compact.map { |v| _to_hash(v) }
261
+ elsif value.is_a?(Hash)
262
+ {}.tap do |hash|
263
+ value.each { |k, v| hash[k] = _to_hash(v) }
264
+ end
265
+ elsif value.respond_to? :to_hash
266
+ value.to_hash
267
+ else
268
+ value
269
+ end
270
+ end
271
+ end
272
+ end