transferzero-sdk 1.11.0 → 1.14.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -4
  3. data/docs/AccountValidationRequest.md +2 -0
  4. data/docs/PayoutMethod.md +1 -1
  5. data/docs/PayoutMethodCountryEnum.md +16 -0
  6. data/docs/PayoutMethodDetails.md +16 -4
  7. data/docs/PayoutMethodDetailsGHSCash.md +21 -0
  8. data/docs/PayoutMethodDetailsMADCash.md +3 -3
  9. data/docs/PayoutMethodDetailsXOFCash.md +3 -1
  10. data/docs/PayoutMethodDetailsXOFMobile.md +3 -1
  11. data/docs/PayoutMethodDetailsZARBank.md +13 -1
  12. data/docs/PayoutMethodLegalEntityTypeEnum.md +16 -0
  13. data/docs/PayoutMethodNatureOfBusinessEnum.md +16 -0
  14. data/docs/TransactionsApi.md +2 -0
  15. data/example/client.rb +18 -55
  16. data/lib/transferzero-sdk.rb +4 -0
  17. data/lib/transferzero-sdk/api/transactions_api.rb +6 -0
  18. data/lib/transferzero-sdk/api_client.rb +1 -1
  19. data/lib/transferzero-sdk/models/account_validation_request.rb +10 -1
  20. data/lib/transferzero-sdk/models/payout_method.rb +1 -1
  21. data/lib/transferzero-sdk/models/payout_method_country_enum.rb +43 -0
  22. data/lib/transferzero-sdk/models/payout_method_details.rb +59 -19
  23. data/lib/transferzero-sdk/models/payout_method_details_ghs_cash.rb +236 -0
  24. data/lib/transferzero-sdk/models/payout_method_details_mad_cash.rb +1 -16
  25. data/lib/transferzero-sdk/models/payout_method_details_xof_cash.rb +14 -5
  26. data/lib/transferzero-sdk/models/payout_method_details_xof_mobile.rb +14 -5
  27. data/lib/transferzero-sdk/models/payout_method_details_zar_bank.rb +59 -5
  28. data/lib/transferzero-sdk/models/payout_method_identity_card_type_enum.rb +1 -1
  29. data/lib/transferzero-sdk/models/payout_method_legal_entity_type_enum.rb +37 -0
  30. data/lib/transferzero-sdk/models/payout_method_mobile_provider_enum.rb +1 -0
  31. data/lib/transferzero-sdk/models/payout_method_nature_of_business_enum.rb +65 -0
  32. data/lib/transferzero-sdk/version.rb +1 -1
  33. data/spec/models/payout_method_country_enum_spec.rb +35 -0
  34. data/spec/models/payout_method_details_ghs_cash_spec.rb +53 -0
  35. data/spec/models/payout_method_legal_entity_type_enum_spec.rb +35 -0
  36. data/spec/models/payout_method_nature_of_business_enum_spec.rb +35 -0
  37. data/transferzero-sdk-1.11.0.gem +0 -0
  38. data/transferzero-sdk-1.12.0.gem +0 -0
  39. data/transferzero-sdk-1.14.0.gem +0 -0
  40. metadata +21 -2
@@ -204,6 +204,7 @@ module TransferZero
204
204
  # @option opts [Integer] :per The number of results to load per page (defaults to 10)
205
205
  # @option opts [String] :external_id Allows filtering results by `external_id`. Example: `/v1/senders?external_id=26ec8517-2f0d-48c0-b74f-0bccb9ab3a87`
206
206
  # @option opts [String] :sender_id Allows filtering results by `sender_id`. Example: `/v1/transactions?sender_id=b41d3cb7-6c54-4245-85fc-8e30690eb0f7`
207
+ # @option opts [String] :transactions_type Allows filtering results by `transactions_type`. Example: `/v1/transactions?transactions_type=automated`
207
208
  # @return [TransactionListResponse]
208
209
  def get_transactions(opts = {})
209
210
  data, _status_code, _headers = get_transactions_with_http_info(opts)
@@ -217,11 +218,15 @@ module TransferZero
217
218
  # @option opts [Integer] :per The number of results to load per page (defaults to 10)
218
219
  # @option opts [String] :external_id Allows filtering results by `external_id`. Example: `/v1/senders?external_id=26ec8517-2f0d-48c0-b74f-0bccb9ab3a87`
219
220
  # @option opts [String] :sender_id Allows filtering results by `sender_id`. Example: `/v1/transactions?sender_id=b41d3cb7-6c54-4245-85fc-8e30690eb0f7`
221
+ # @option opts [String] :transactions_type Allows filtering results by `transactions_type`. Example: `/v1/transactions?transactions_type=automated`
220
222
  # @return [Array<(TransactionListResponse, Fixnum, Hash)>] TransactionListResponse data, response status code and response headers
221
223
  def get_transactions_with_http_info(opts = {})
222
224
  if @api_client.config.debugging
223
225
  @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions ...'
224
226
  end
227
+ if @api_client.config.client_side_validation && opts[:'transactions_type'] && !['automated', 'manual'].include?(opts[:'transactions_type'])
228
+ fail ArgumentError, 'invalid value for "transactions_type", must be one of automated, manual'
229
+ end
225
230
  # resource path
226
231
  local_var_path = '/transactions'
227
232
 
@@ -231,6 +236,7 @@ module TransferZero
231
236
  query_params[:'per'] = opts[:'per'] if !opts[:'per'].nil?
232
237
  query_params[:'external_id'] = opts[:'external_id'] if !opts[:'external_id'].nil?
233
238
  query_params[:'sender_id'] = opts[:'sender_id'] if !opts[:'sender_id'].nil?
239
+ query_params[:'transactions_type'] = opts[:'transactions_type'] if !opts[:'transactions_type'].nil?
234
240
 
235
241
  # header parameters
236
242
  header_params = {}
@@ -35,7 +35,7 @@ module TransferZero
35
35
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
36
36
  def initialize(config = Configuration.default)
37
37
  @config = config
38
- @user_agent = "TransferZero-SDK/Ruby/1.11.0"
38
+ @user_agent = "TransferZero-SDK/Ruby/1.14.1"
39
39
  @default_headers = {
40
40
  'Content-Type' => 'application/json',
41
41
  'User-Agent' => @user_agent
@@ -23,6 +23,8 @@ class AccountValidationRequest
23
23
  # Phone number to query
24
24
  attr_accessor :phone_number
25
25
 
26
+ attr_accessor :mobile_provider
27
+
26
28
  # Country of account in 2-character alpha ISO 3166-2 country format
27
29
  attr_accessor :country
28
30
 
@@ -60,6 +62,7 @@ class AccountValidationRequest
60
62
  :'bank_account' => :'bank_account',
61
63
  :'bank_code' => :'bank_code',
62
64
  :'phone_number' => :'phone_number',
65
+ :'mobile_provider' => :'mobile_provider',
63
66
  :'country' => :'country',
64
67
  :'currency' => :'currency',
65
68
  :'method' => :'method'
@@ -72,6 +75,7 @@ class AccountValidationRequest
72
75
  :'bank_account' => :'String',
73
76
  :'bank_code' => :'String',
74
77
  :'phone_number' => :'String',
78
+ :'mobile_provider' => :'PayoutMethodMobileProviderEnum',
75
79
  :'country' => :'String',
76
80
  :'currency' => :'String',
77
81
  :'method' => :'String'
@@ -105,6 +109,10 @@ class AccountValidationRequest
105
109
  self.phone_number = attributes[:'phone_number']
106
110
  end
107
111
 
112
+ if attributes.key?(:'mobile_provider')
113
+ self.mobile_provider = attributes[:'mobile_provider']
114
+ end
115
+
108
116
  if attributes.key?(:'country')
109
117
  self.country = attributes[:'country']
110
118
  end
@@ -190,6 +198,7 @@ class AccountValidationRequest
190
198
  bank_account == o.bank_account &&
191
199
  bank_code == o.bank_code &&
192
200
  phone_number == o.phone_number &&
201
+ mobile_provider == o.mobile_provider &&
193
202
  country == o.country &&
194
203
  currency == o.currency &&
195
204
  method == o.method
@@ -204,7 +213,7 @@ class AccountValidationRequest
204
213
  # Calculates hash code according to all attributes.
205
214
  # @return [Integer] Hash code
206
215
  def hash
207
- [bank_account, bank_code, phone_number, country, currency, method].hash
216
+ [bank_account, bank_code, phone_number, mobile_provider, country, currency, method].hash
208
217
  end
209
218
 
210
219
  require 'active_support/core_ext/hash'
@@ -15,7 +15,7 @@ require 'date'
15
15
  module TransferZero
16
16
  # This describes the specific details on how the payment has to be routed to the recipient.
17
17
  class PayoutMethod
18
- # Contains the currency to send the money to, and the type of the money movement Commonly used payout types are: - `NGN::Bank` - for Nigerian bank account payments. - `NGN::Mobile` - for Nigerian mobile money payments. - `GHS::Bank` - for Ghanaian bank account payments. - `GHS::Mobile` - for Ghanaian mobile money payments. - `UGX::Mobile` - for Ugandan mobile money payments. - `TZS::Mobile` - for Tanzanian mobile money payments. - `XOF::Mobile` - for Senegalese mobile money payments. - `XOF::Bank` - for Senegalese bank account payments. - `XOF::Cash` - for Senegalese cash remittance payments. - `MAD::Cash` - for Moroccan cash remittance payments. - `EUR::Bank` - for IBAN bank transfers in EUR. - `GBP::Bank` - for IBAN bank and FP accounts transfers in GBP. - `ZAR::Bank` - for South Africa bank account payments. You can also send funds to the internal balance using `CCY::Balance`, where `CCY` is the appropriate currency. See [Collection from senders](https://docs.transferzero.com/docs/additional-features/#collections-from-senders) for more info on how to collect money into internal balance
18
+ # Contains the currency to send the money to, and the type of the money movement Commonly used payout types are: - `NGN::Bank` - for Nigerian bank account payments. - `NGN::Mobile` - for Nigerian mobile money payments. - `GHS::Bank` - for Ghanaian bank account payments. - `GHS::Mobile` - for Ghanaian mobile money payments. - `GHS::Cash` - for Ghanaian cash remittance payments. - `UGX::Mobile` - for Ugandan mobile money payments. - `TZS::Mobile` - for Tanzanian mobile money payments. - `XOF::Mobile` - for mobile money payments to West-Africa. - `XOF::Bank` - for Senegalese bank account payments. - `XOF::Cash` - for Senegalese cash remittance payments. - `MAD::Cash` - for Moroccan cash remittance payments. - `EUR::Bank` - for IBAN bank transfers in EUR. - `GBP::Bank` - for IBAN bank and FP accounts transfers in GBP. - `ZAR::Bank` - for South Africa bank account payments. You can also send funds to the internal balance using `CCY::Balance`, where `CCY` is the appropriate currency. See [Collection from senders](https://docs.transferzero.com/docs/additional-features/#collections-from-senders) for more info on how to collect money into internal balance
19
19
  attr_accessor :type
20
20
 
21
21
  attr_accessor :details
@@ -0,0 +1,43 @@
1
+ =begin
2
+ #TransferZero API
3
+
4
+ #Reference documentation for the TransferZero API V1
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0-beta3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module TransferZero
16
+ class PayoutMethodCountryEnum
17
+
18
+ CI = "CI".freeze
19
+ ML = "ML".freeze
20
+ SN = "SN".freeze
21
+ NG = "NG".freeze
22
+ MA = "MA".freeze
23
+ TZ = "TZ".freeze
24
+ GH = "GH".freeze
25
+ UG = "UG".freeze
26
+ KE = "KE".freeze
27
+ NJ = "NJ".freeze
28
+ EU = "EU".freeze
29
+ GB = "GB".freeze
30
+ ZA = "ZA".freeze
31
+ EG = "EG".freeze
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ constantValues = PayoutMethodCountryEnum.constants.select { |c| PayoutMethodCountryEnum::const_get(c) == value }
38
+ raise "Invalid ENUM value #{value} for class #PayoutMethodCountryEnum" if constantValues.empty? && !value.empty?
39
+ value
40
+ end
41
+ end
42
+
43
+ end
@@ -28,6 +28,8 @@ class PayoutMethodDetails
28
28
 
29
29
  attr_accessor :mobile_provider
30
30
 
31
+ attr_accessor :country
32
+
31
33
  attr_accessor :iban
32
34
 
33
35
  attr_accessor :bank_name
@@ -72,6 +74,16 @@ class PayoutMethodDetails
72
74
 
73
75
  attr_accessor :transfer_reason_code
74
76
 
77
+ attr_accessor :contact_first_name
78
+
79
+ attr_accessor :contact_last_name
80
+
81
+ attr_accessor :registration_number
82
+
83
+ attr_accessor :nature_of_business
84
+
85
+ attr_accessor :legal_entity_type
86
+
75
87
  # Attribute mapping from ruby-style variable name to JSON key.
76
88
  def self.attribute_map
77
89
  {
@@ -82,6 +94,7 @@ class PayoutMethodDetails
82
94
  :'bank_account_type' => :'bank_account_type',
83
95
  :'phone_number' => :'phone_number',
84
96
  :'mobile_provider' => :'mobile_provider',
97
+ :'country' => :'country',
85
98
  :'iban' => :'iban',
86
99
  :'bank_name' => :'bank_name',
87
100
  :'bank_country' => :'bank_country',
@@ -103,7 +116,12 @@ class PayoutMethodDetails
103
116
  :'postal_code' => :'postal_code',
104
117
  :'city' => :'city',
105
118
  :'email' => :'email',
106
- :'transfer_reason_code' => :'transfer_reason_code'
119
+ :'transfer_reason_code' => :'transfer_reason_code',
120
+ :'contact_first_name' => :'contact_first_name',
121
+ :'contact_last_name' => :'contact_last_name',
122
+ :'registration_number' => :'registration_number',
123
+ :'nature_of_business' => :'nature_of_business',
124
+ :'legal_entity_type' => :'legal_entity_type'
107
125
  }
108
126
  end
109
127
 
@@ -117,6 +135,7 @@ class PayoutMethodDetails
117
135
  :'bank_account_type' => :'PayoutMethodBankAccountTypeEnum',
118
136
  :'phone_number' => :'String',
119
137
  :'mobile_provider' => :'PayoutMethodMobileProviderEnum',
138
+ :'country' => :'PayoutMethodCountryEnum',
120
139
  :'iban' => :'String',
121
140
  :'bank_name' => :'String',
122
141
  :'bank_country' => :'String',
@@ -138,7 +157,12 @@ class PayoutMethodDetails
138
157
  :'postal_code' => :'String',
139
158
  :'city' => :'String',
140
159
  :'email' => :'String',
141
- :'transfer_reason_code' => :'String'
160
+ :'transfer_reason_code' => :'String',
161
+ :'contact_first_name' => :'String',
162
+ :'contact_last_name' => :'String',
163
+ :'registration_number' => :'String',
164
+ :'nature_of_business' => :'PayoutMethodNatureOfBusinessEnum',
165
+ :'legal_entity_type' => :'PayoutMethodLegalEntityTypeEnum'
142
166
  }
143
167
  end
144
168
 
@@ -149,6 +173,7 @@ class PayoutMethodDetails
149
173
  :'PayoutMethodDetailsBalance',
150
174
  :'PayoutMethodDetailsGBPBank',
151
175
  :'PayoutMethodDetailsGHSBank',
176
+ :'PayoutMethodDetailsGHSCash',
152
177
  :'PayoutMethodDetailsIBAN',
153
178
  :'PayoutMethodDetailsMADCash',
154
179
  :'PayoutMethodDetailsMobile',
@@ -203,6 +228,10 @@ class PayoutMethodDetails
203
228
  self.mobile_provider = attributes[:'mobile_provider']
204
229
  end
205
230
 
231
+ if attributes.key?(:'country')
232
+ self.country = attributes[:'country']
233
+ end
234
+
206
235
  if attributes.key?(:'iban')
207
236
  self.iban = attributes[:'iban']
208
237
  end
@@ -290,6 +319,26 @@ class PayoutMethodDetails
290
319
  if attributes.key?(:'transfer_reason_code')
291
320
  self.transfer_reason_code = attributes[:'transfer_reason_code']
292
321
  end
322
+
323
+ if attributes.key?(:'contact_first_name')
324
+ self.contact_first_name = attributes[:'contact_first_name']
325
+ end
326
+
327
+ if attributes.key?(:'contact_last_name')
328
+ self.contact_last_name = attributes[:'contact_last_name']
329
+ end
330
+
331
+ if attributes.key?(:'registration_number')
332
+ self.registration_number = attributes[:'registration_number']
333
+ end
334
+
335
+ if attributes.key?(:'nature_of_business')
336
+ self.nature_of_business = attributes[:'nature_of_business']
337
+ end
338
+
339
+ if attributes.key?(:'legal_entity_type')
340
+ self.legal_entity_type = attributes[:'legal_entity_type']
341
+ end
293
342
  end
294
343
 
295
344
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -340,18 +389,6 @@ class PayoutMethodDetails
340
389
  invalid_properties.push('invalid value for "sender_identity_card_id", sender_identity_card_id cannot be nil.')
341
390
  end
342
391
 
343
- if @sender_city_of_birth.nil?
344
- invalid_properties.push('invalid value for "sender_city_of_birth", sender_city_of_birth cannot be nil.')
345
- end
346
-
347
- if @sender_country_of_birth.nil?
348
- invalid_properties.push('invalid value for "sender_country_of_birth", sender_country_of_birth cannot be nil.')
349
- end
350
-
351
- if @sender_gender.nil?
352
- invalid_properties.push('invalid value for "sender_gender", sender_gender cannot be nil.')
353
- end
354
-
355
392
  if @name.nil?
356
393
  invalid_properties.push('invalid value for "name", name cannot be nil.')
357
394
  end
@@ -389,9 +426,6 @@ class PayoutMethodDetails
389
426
  return false if @bank_country.nil?
390
427
  return false if @sender_identity_card_type.nil?
391
428
  return false if @sender_identity_card_id.nil?
392
- return false if @sender_city_of_birth.nil?
393
- return false if @sender_country_of_birth.nil?
394
- return false if @sender_gender.nil?
395
429
  return false if @name.nil?
396
430
  return false if @address.nil?
397
431
  return false if @street.nil?
@@ -428,6 +462,7 @@ class PayoutMethodDetails
428
462
  bank_account_type == o.bank_account_type &&
429
463
  phone_number == o.phone_number &&
430
464
  mobile_provider == o.mobile_provider &&
465
+ country == o.country &&
431
466
  iban == o.iban &&
432
467
  bank_name == o.bank_name &&
433
468
  bank_country == o.bank_country &&
@@ -449,7 +484,12 @@ class PayoutMethodDetails
449
484
  postal_code == o.postal_code &&
450
485
  city == o.city &&
451
486
  email == o.email &&
452
- transfer_reason_code == o.transfer_reason_code
487
+ transfer_reason_code == o.transfer_reason_code &&
488
+ contact_first_name == o.contact_first_name &&
489
+ contact_last_name == o.contact_last_name &&
490
+ registration_number == o.registration_number &&
491
+ nature_of_business == o.nature_of_business &&
492
+ legal_entity_type == o.legal_entity_type
453
493
  end
454
494
 
455
495
  # @see the `==` method
@@ -461,7 +501,7 @@ class PayoutMethodDetails
461
501
  # Calculates hash code according to all attributes.
462
502
  # @return [Integer] Hash code
463
503
  def hash
464
- [first_name, last_name, bank_code, bank_account, bank_account_type, phone_number, mobile_provider, iban, bank_name, bank_country, cash_provider, sort_code, bic, sender_identity_card_type, sender_identity_card_id, sender_city_of_birth, sender_country_of_birth, sender_gender, reason, identity_card_type, identity_card_id, reference, name, address, street, postal_code, city, email, transfer_reason_code].hash
504
+ [first_name, last_name, bank_code, bank_account, bank_account_type, phone_number, mobile_provider, country, iban, bank_name, bank_country, cash_provider, sort_code, bic, sender_identity_card_type, sender_identity_card_id, sender_city_of_birth, sender_country_of_birth, sender_gender, reason, identity_card_type, identity_card_id, reference, name, address, street, postal_code, city, email, transfer_reason_code, contact_first_name, contact_last_name, registration_number, nature_of_business, legal_entity_type].hash
465
505
  end
466
506
 
467
507
  require 'active_support/core_ext/hash'
@@ -0,0 +1,236 @@
1
+ =begin
2
+ #TransferZero API
3
+
4
+ #Reference documentation for the TransferZero API V1
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.0-beta3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module TransferZero
16
+ # ```JSON \"details\": { \"first_name\": \"First\", \"last_name\": \"Last\", \"phone_number\": \"0322023144\" } ```
17
+ class PayoutMethodDetailsGHSCash
18
+ attr_accessor :first_name
19
+
20
+ attr_accessor :last_name
21
+
22
+ attr_accessor :phone_number
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'first_name' => :'first_name',
28
+ :'last_name' => :'last_name',
29
+ :'phone_number' => :'phone_number'
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'first_name' => :'String',
37
+ :'last_name' => :'String',
38
+ :'phone_number' => :'String'
39
+ }
40
+ end
41
+
42
+ # Initializes the object
43
+ # @param [Hash] attributes Model attributes in the form of hash
44
+ def initialize(attributes = {})
45
+ if (!attributes.is_a?(Hash))
46
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::PayoutMethodDetailsGHSCash` initialize method"
47
+ end
48
+
49
+ # check to see if the attribute exists and convert string to symbol for hash key
50
+ attributes = attributes.each_with_object({}) { |(k, v), h|
51
+ if (!self.class.attribute_map.key?(k.to_sym))
52
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::PayoutMethodDetailsGHSCash`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
53
+ end
54
+ h[k.to_sym] = v
55
+ }
56
+
57
+ if attributes.key?(:'first_name')
58
+ self.first_name = attributes[:'first_name']
59
+ end
60
+
61
+ if attributes.key?(:'last_name')
62
+ self.last_name = attributes[:'last_name']
63
+ end
64
+
65
+ if attributes.key?(:'phone_number')
66
+ self.phone_number = attributes[:'phone_number']
67
+ end
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ if @first_name.nil?
75
+ invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
76
+ end
77
+
78
+ if @last_name.nil?
79
+ invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
80
+ end
81
+
82
+ if @phone_number.nil?
83
+ invalid_properties.push('invalid value for "phone_number", phone_number cannot be nil.')
84
+ end
85
+
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ return false if @first_name.nil?
93
+ return false if @last_name.nil?
94
+ return false if @phone_number.nil?
95
+ true
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(o)
101
+ return true if self.equal?(o)
102
+ self.class == o.class &&
103
+ first_name == o.first_name &&
104
+ last_name == o.last_name &&
105
+ phone_number == o.phone_number
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Integer] Hash code
116
+ def hash
117
+ [first_name, last_name, phone_number].hash
118
+ end
119
+
120
+ require 'active_support/core_ext/hash'
121
+ require 'active_support/hash_with_indifferent_access.rb'
122
+ # Builds the object from hash
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ # @return [Object] Returns the model itself
125
+ def build_from_hash(attributes)
126
+ return nil unless attributes.is_a?(Hash)
127
+ self.class.openapi_types.each_pair do |key, type|
128
+ if type =~ /\AArray<(.*)>/i
129
+ # check to ensure the input is an array given that the the attribute
130
+ # is documented as an array but the input is not
131
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
132
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
133
+ end
134
+ elsif !attributes[self.class.attribute_map[key]].nil?
135
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
136
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
137
+ end
138
+
139
+ self
140
+ end
141
+
142
+ # Deserializes the data based on type
143
+ # @param string type Data type
144
+ # @param string value Value to be deserialized
145
+ # @return [Object] Deserialized data
146
+ def _deserialize(type, value)
147
+ case type.to_sym
148
+ when :DateTime
149
+ DateTime.parse(value)
150
+ when :Date
151
+ Date.parse(value)
152
+ when :String
153
+ value.to_s
154
+ when :Integer
155
+ value.to_i
156
+ when :Float
157
+ value.to_f
158
+ when :Boolean
159
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
160
+ true
161
+ else
162
+ false
163
+ end
164
+ when :Object
165
+ # generic object (usually a Hash), return directly
166
+ value
167
+ when /\AArray<(?<inner_type>.+)>\z/
168
+ inner_type = Regexp.last_match[:inner_type]
169
+ value.map { |v| _deserialize(inner_type, v) }
170
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
171
+ k_type = Regexp.last_match[:k_type]
172
+ v_type = Regexp.last_match[:v_type]
173
+ {}.tap do |hash|
174
+ value.each do |k, v|
175
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
176
+ end
177
+ end
178
+ else # model
179
+ temp_model = TransferZero.const_get(type).new
180
+ temp_model.build_from_hash(value)
181
+ end
182
+ end
183
+
184
+ # Returns the string representation of the object
185
+ # @return [String] String presentation of the object
186
+ def to_s
187
+ to_hash.to_s
188
+ end
189
+
190
+ # to_body is an alias to to_hash (backward compatibility)
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_body
193
+ to_hash
194
+ end
195
+
196
+ # Returns the object in the form of hash
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_hash
199
+ hash = {}
200
+ self.class.attribute_map.each_pair do |attr, param|
201
+ value = self.send(attr)
202
+ next if value.nil?
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ ::ActiveSupport::HashWithIndifferentAccess.new(hash)
206
+ end
207
+
208
+ def [](key)
209
+ to_hash[key]
210
+ end
211
+
212
+ def dig(*args)
213
+ to_hash.dig(*args)
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map { |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+
234
+ end
235
+
236
+ end