transferzero-sdk 1.14.0 → 1.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -5
- data/docs/AccountValidationRequest.md +2 -0
- data/docs/PayoutMethod.md +1 -1
- data/docs/{PayoutMethodEntityTypeEnum.md → PayoutMethodCountryEnumUSDBank.md} +2 -2
- data/docs/PayoutMethodDetails.md +12 -8
- data/docs/PayoutMethodDetailsKESBank.md +37 -0
- data/docs/PayoutMethodDetailsKESMobile.md +31 -0
- data/docs/PayoutMethodDetailsUSDBank.md +27 -0
- data/docs/PayoutMethodDetailsXOFBank.md +5 -3
- data/docs/PayoutMethodDetailsZARBank.md +3 -3
- data/docs/PayoutMethodLegalEntityTypeEnum.md +16 -0
- data/docs/PayoutMethodNatureOfBusinessEnum.md +16 -0
- data/docs/TransactionsApi.md +2 -0
- data/lib/transferzero-sdk.rb +6 -1
- data/lib/transferzero-sdk/api/transactions_api.rb +6 -0
- data/lib/transferzero-sdk/api_client.rb +2 -2
- data/lib/transferzero-sdk/models/account_validation_request.rb +15 -5
- data/lib/transferzero-sdk/models/payout_method.rb +1 -1
- data/lib/transferzero-sdk/models/payout_method_country_enum.rb +234 -8
- data/lib/transferzero-sdk/models/payout_method_country_enum_usd_bank.rb +269 -0
- data/lib/transferzero-sdk/models/payout_method_details.rb +55 -14
- data/lib/transferzero-sdk/models/payout_method_details_kes_bank.rb +343 -0
- data/lib/transferzero-sdk/models/payout_method_details_kes_mobile.rb +306 -0
- data/lib/transferzero-sdk/models/payout_method_details_usd_bank.rb +278 -0
- data/lib/transferzero-sdk/models/payout_method_details_xof_bank.rb +14 -15
- data/lib/transferzero-sdk/models/payout_method_details_zar_bank.rb +9 -9
- data/lib/transferzero-sdk/models/{payout_method_entity_type_enum.rb → payout_method_legal_entity_type_enum.rb} +3 -3
- data/lib/transferzero-sdk/models/payout_method_mobile_provider_enum.rb +1 -0
- data/lib/transferzero-sdk/models/payout_method_nature_of_business_enum.rb +65 -0
- data/lib/transferzero-sdk/version.rb +1 -1
- data/spec/models/payout_method_country_enum_usd_bank_spec.rb +35 -0
- data/spec/models/payout_method_details_kes_bank_spec.rb +101 -0
- data/spec/models/payout_method_details_kes_mobile_spec.rb +83 -0
- data/spec/models/payout_method_details_usd_bank_spec.rb +71 -0
- data/spec/models/{payout_method_entity_type_enum_spec.rb → payout_method_legal_entity_type_enum_spec.rb} +6 -6
- data/spec/models/payout_method_nature_of_business_enum_spec.rb +35 -0
- metadata +36 -20
- data/Gemfile.lock +0 -93
- data/transferzero-sdk-1.10.0.gem +0 -0
- data/transferzero-sdk-1.11.0.gem +0 -0
- data/transferzero-sdk-1.12.0.gem +0 -0
@@ -0,0 +1,306 @@
|
|
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\", \"street\": \"Main Street\", \"phone_number\": \"+254997853134\", \"mobile_provider\": \"mpesa\", \"transfer_reason_code\": \"185\", \"identity_card_type\": \"ID\", \"identity_card_id\": \"AB12345678\" } ``` See [KES Mobile](https://docs.transferzero.com/docs/payout-details/#kesmobile) documentation for transfer_reason_code lists
|
17
|
+
class PayoutMethodDetailsKESMobile
|
18
|
+
attr_accessor :first_name
|
19
|
+
|
20
|
+
attr_accessor :last_name
|
21
|
+
|
22
|
+
attr_accessor :street
|
23
|
+
|
24
|
+
attr_accessor :phone_number
|
25
|
+
|
26
|
+
attr_accessor :mobile_provider
|
27
|
+
|
28
|
+
attr_accessor :transfer_reason_code
|
29
|
+
|
30
|
+
attr_accessor :identity_card_type
|
31
|
+
|
32
|
+
attr_accessor :identity_card_id
|
33
|
+
|
34
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
35
|
+
def self.attribute_map
|
36
|
+
{
|
37
|
+
:'first_name' => :'first_name',
|
38
|
+
:'last_name' => :'last_name',
|
39
|
+
:'street' => :'street',
|
40
|
+
:'phone_number' => :'phone_number',
|
41
|
+
:'mobile_provider' => :'mobile_provider',
|
42
|
+
:'transfer_reason_code' => :'transfer_reason_code',
|
43
|
+
:'identity_card_type' => :'identity_card_type',
|
44
|
+
:'identity_card_id' => :'identity_card_id'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Attribute type mapping.
|
49
|
+
def self.openapi_types
|
50
|
+
{
|
51
|
+
:'first_name' => :'String',
|
52
|
+
:'last_name' => :'String',
|
53
|
+
:'street' => :'String',
|
54
|
+
:'phone_number' => :'String',
|
55
|
+
:'mobile_provider' => :'PayoutMethodMobileProviderEnum',
|
56
|
+
:'transfer_reason_code' => :'String',
|
57
|
+
:'identity_card_type' => :'PayoutMethodIdentityCardTypeEnum',
|
58
|
+
:'identity_card_id' => :'String'
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
# Initializes the object
|
63
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
64
|
+
def initialize(attributes = {})
|
65
|
+
if (!attributes.is_a?(Hash))
|
66
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::PayoutMethodDetailsKESMobile` initialize method"
|
67
|
+
end
|
68
|
+
|
69
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
70
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
71
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
72
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::PayoutMethodDetailsKESMobile`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
73
|
+
end
|
74
|
+
h[k.to_sym] = v
|
75
|
+
}
|
76
|
+
|
77
|
+
if attributes.key?(:'first_name')
|
78
|
+
self.first_name = attributes[:'first_name']
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes.key?(:'last_name')
|
82
|
+
self.last_name = attributes[:'last_name']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.key?(:'street')
|
86
|
+
self.street = attributes[:'street']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.key?(:'phone_number')
|
90
|
+
self.phone_number = attributes[:'phone_number']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.key?(:'mobile_provider')
|
94
|
+
self.mobile_provider = attributes[:'mobile_provider']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.key?(:'transfer_reason_code')
|
98
|
+
self.transfer_reason_code = attributes[:'transfer_reason_code']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.key?(:'identity_card_type')
|
102
|
+
self.identity_card_type = attributes[:'identity_card_type']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'identity_card_id')
|
106
|
+
self.identity_card_id = attributes[:'identity_card_id']
|
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 @first_name.nil?
|
115
|
+
invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
|
116
|
+
end
|
117
|
+
|
118
|
+
if @last_name.nil?
|
119
|
+
invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
|
120
|
+
end
|
121
|
+
|
122
|
+
if @street.nil?
|
123
|
+
invalid_properties.push('invalid value for "street", street cannot be nil.')
|
124
|
+
end
|
125
|
+
|
126
|
+
if @phone_number.nil?
|
127
|
+
invalid_properties.push('invalid value for "phone_number", phone_number cannot be nil.')
|
128
|
+
end
|
129
|
+
|
130
|
+
if @mobile_provider.nil?
|
131
|
+
invalid_properties.push('invalid value for "mobile_provider", mobile_provider cannot be nil.')
|
132
|
+
end
|
133
|
+
|
134
|
+
if @transfer_reason_code.nil?
|
135
|
+
invalid_properties.push('invalid value for "transfer_reason_code", transfer_reason_code cannot be nil.')
|
136
|
+
end
|
137
|
+
|
138
|
+
if @identity_card_type.nil?
|
139
|
+
invalid_properties.push('invalid value for "identity_card_type", identity_card_type cannot be nil.')
|
140
|
+
end
|
141
|
+
|
142
|
+
if @identity_card_id.nil?
|
143
|
+
invalid_properties.push('invalid value for "identity_card_id", identity_card_id cannot be nil.')
|
144
|
+
end
|
145
|
+
|
146
|
+
invalid_properties
|
147
|
+
end
|
148
|
+
|
149
|
+
# Check to see if the all the properties in the model are valid
|
150
|
+
# @return true if the model is valid
|
151
|
+
def valid?
|
152
|
+
return false if @first_name.nil?
|
153
|
+
return false if @last_name.nil?
|
154
|
+
return false if @street.nil?
|
155
|
+
return false if @phone_number.nil?
|
156
|
+
return false if @mobile_provider.nil?
|
157
|
+
return false if @transfer_reason_code.nil?
|
158
|
+
return false if @identity_card_type.nil?
|
159
|
+
return false if @identity_card_id.nil?
|
160
|
+
true
|
161
|
+
end
|
162
|
+
|
163
|
+
# Checks equality by comparing each attribute.
|
164
|
+
# @param [Object] Object to be compared
|
165
|
+
def ==(o)
|
166
|
+
return true if self.equal?(o)
|
167
|
+
self.class == o.class &&
|
168
|
+
first_name == o.first_name &&
|
169
|
+
last_name == o.last_name &&
|
170
|
+
street == o.street &&
|
171
|
+
phone_number == o.phone_number &&
|
172
|
+
mobile_provider == o.mobile_provider &&
|
173
|
+
transfer_reason_code == o.transfer_reason_code &&
|
174
|
+
identity_card_type == o.identity_card_type &&
|
175
|
+
identity_card_id == o.identity_card_id
|
176
|
+
end
|
177
|
+
|
178
|
+
# @see the `==` method
|
179
|
+
# @param [Object] Object to be compared
|
180
|
+
def eql?(o)
|
181
|
+
self == o
|
182
|
+
end
|
183
|
+
|
184
|
+
# Calculates hash code according to all attributes.
|
185
|
+
# @return [Integer] Hash code
|
186
|
+
def hash
|
187
|
+
[first_name, last_name, street, phone_number, mobile_provider, transfer_reason_code, identity_card_type, identity_card_id].hash
|
188
|
+
end
|
189
|
+
|
190
|
+
require 'active_support/core_ext/hash'
|
191
|
+
require 'active_support/hash_with_indifferent_access.rb'
|
192
|
+
# Builds the object from hash
|
193
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
194
|
+
# @return [Object] Returns the model itself
|
195
|
+
def build_from_hash(attributes)
|
196
|
+
return nil unless attributes.is_a?(Hash)
|
197
|
+
self.class.openapi_types.each_pair do |key, type|
|
198
|
+
if type =~ /\AArray<(.*)>/i
|
199
|
+
# check to ensure the input is an array given that the the attribute
|
200
|
+
# is documented as an array but the input is not
|
201
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
202
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
203
|
+
end
|
204
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
205
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
206
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
207
|
+
end
|
208
|
+
|
209
|
+
self
|
210
|
+
end
|
211
|
+
|
212
|
+
# Deserializes the data based on type
|
213
|
+
# @param string type Data type
|
214
|
+
# @param string value Value to be deserialized
|
215
|
+
# @return [Object] Deserialized data
|
216
|
+
def _deserialize(type, value)
|
217
|
+
case type.to_sym
|
218
|
+
when :DateTime
|
219
|
+
DateTime.parse(value)
|
220
|
+
when :Date
|
221
|
+
Date.parse(value)
|
222
|
+
when :String
|
223
|
+
value.to_s
|
224
|
+
when :Integer
|
225
|
+
value.to_i
|
226
|
+
when :Float
|
227
|
+
value.to_f
|
228
|
+
when :Boolean
|
229
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
230
|
+
true
|
231
|
+
else
|
232
|
+
false
|
233
|
+
end
|
234
|
+
when :Object
|
235
|
+
# generic object (usually a Hash), return directly
|
236
|
+
value
|
237
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
238
|
+
inner_type = Regexp.last_match[:inner_type]
|
239
|
+
value.map { |v| _deserialize(inner_type, v) }
|
240
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
241
|
+
k_type = Regexp.last_match[:k_type]
|
242
|
+
v_type = Regexp.last_match[:v_type]
|
243
|
+
{}.tap do |hash|
|
244
|
+
value.each do |k, v|
|
245
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
246
|
+
end
|
247
|
+
end
|
248
|
+
else # model
|
249
|
+
temp_model = TransferZero.const_get(type).new
|
250
|
+
temp_model.build_from_hash(value)
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
# Returns the string representation of the object
|
255
|
+
# @return [String] String presentation of the object
|
256
|
+
def to_s
|
257
|
+
to_hash.to_s
|
258
|
+
end
|
259
|
+
|
260
|
+
# to_body is an alias to to_hash (backward compatibility)
|
261
|
+
# @return [Hash] Returns the object in the form of hash
|
262
|
+
def to_body
|
263
|
+
to_hash
|
264
|
+
end
|
265
|
+
|
266
|
+
# Returns the object in the form of hash
|
267
|
+
# @return [Hash] Returns the object in the form of hash
|
268
|
+
def to_hash
|
269
|
+
hash = {}
|
270
|
+
self.class.attribute_map.each_pair do |attr, param|
|
271
|
+
value = self.send(attr)
|
272
|
+
next if value.nil?
|
273
|
+
hash[param] = _to_hash(value)
|
274
|
+
end
|
275
|
+
::ActiveSupport::HashWithIndifferentAccess.new(hash)
|
276
|
+
end
|
277
|
+
|
278
|
+
def [](key)
|
279
|
+
to_hash[key]
|
280
|
+
end
|
281
|
+
|
282
|
+
def dig(*args)
|
283
|
+
to_hash.dig(*args)
|
284
|
+
end
|
285
|
+
|
286
|
+
# Outputs non-array value in the form of hash
|
287
|
+
# For object, use to_hash. Otherwise, just return the value
|
288
|
+
# @param [Object] value Any valid value
|
289
|
+
# @return [Hash] Returns the value in the form of hash
|
290
|
+
def _to_hash(value)
|
291
|
+
if value.is_a?(Array)
|
292
|
+
value.compact.map { |v| _to_hash(v) }
|
293
|
+
elsif value.is_a?(Hash)
|
294
|
+
{}.tap do |hash|
|
295
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
296
|
+
end
|
297
|
+
elsif value.respond_to? :to_hash
|
298
|
+
value.to_hash
|
299
|
+
else
|
300
|
+
value
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
end
|
305
|
+
|
306
|
+
end
|
@@ -0,0 +1,278 @@
|
|
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\": \"Jane\", \"last_name\": \"Doe\", \"phone_number\": \"+2341234567\", \"bank_code\": \"057\", \"bank_account\": \"1234567890\", \"country\": \"NG\" } ``` See [USD Bank](https://docs.transferzero.com/docs/payout-details/#usdbank) documentation for the bank_code list
|
17
|
+
class PayoutMethodDetailsUSDBank
|
18
|
+
attr_accessor :first_name
|
19
|
+
|
20
|
+
attr_accessor :last_name
|
21
|
+
|
22
|
+
attr_accessor :phone_number
|
23
|
+
|
24
|
+
attr_accessor :bank_code
|
25
|
+
|
26
|
+
attr_accessor :bank_account
|
27
|
+
|
28
|
+
attr_accessor :country
|
29
|
+
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
31
|
+
def self.attribute_map
|
32
|
+
{
|
33
|
+
:'first_name' => :'first_name',
|
34
|
+
:'last_name' => :'last_name',
|
35
|
+
:'phone_number' => :'phone_number',
|
36
|
+
:'bank_code' => :'bank_code',
|
37
|
+
:'bank_account' => :'bank_account',
|
38
|
+
:'country' => :'country'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Attribute type mapping.
|
43
|
+
def self.openapi_types
|
44
|
+
{
|
45
|
+
:'first_name' => :'String',
|
46
|
+
:'last_name' => :'String',
|
47
|
+
:'phone_number' => :'String',
|
48
|
+
:'bank_code' => :'String',
|
49
|
+
:'bank_account' => :'String',
|
50
|
+
:'country' => :'PayoutMethodCountryEnumUSDBank'
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
# Initializes the object
|
55
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
56
|
+
def initialize(attributes = {})
|
57
|
+
if (!attributes.is_a?(Hash))
|
58
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::PayoutMethodDetailsUSDBank` initialize method"
|
59
|
+
end
|
60
|
+
|
61
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
62
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
63
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
64
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::PayoutMethodDetailsUSDBank`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
65
|
+
end
|
66
|
+
h[k.to_sym] = v
|
67
|
+
}
|
68
|
+
|
69
|
+
if attributes.key?(:'first_name')
|
70
|
+
self.first_name = attributes[:'first_name']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.key?(:'last_name')
|
74
|
+
self.last_name = attributes[:'last_name']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.key?(:'phone_number')
|
78
|
+
self.phone_number = attributes[:'phone_number']
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes.key?(:'bank_code')
|
82
|
+
self.bank_code = attributes[:'bank_code']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.key?(:'bank_account')
|
86
|
+
self.bank_account = attributes[:'bank_account']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.key?(:'country')
|
90
|
+
self.country = attributes[:'country']
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
95
|
+
# @return Array for valid properties with the reasons
|
96
|
+
def list_invalid_properties
|
97
|
+
invalid_properties = Array.new
|
98
|
+
if @first_name.nil?
|
99
|
+
invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
|
100
|
+
end
|
101
|
+
|
102
|
+
if @last_name.nil?
|
103
|
+
invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
|
104
|
+
end
|
105
|
+
|
106
|
+
if @phone_number.nil?
|
107
|
+
invalid_properties.push('invalid value for "phone_number", phone_number cannot be nil.')
|
108
|
+
end
|
109
|
+
|
110
|
+
if @bank_code.nil?
|
111
|
+
invalid_properties.push('invalid value for "bank_code", bank_code cannot be nil.')
|
112
|
+
end
|
113
|
+
|
114
|
+
if @bank_account.nil?
|
115
|
+
invalid_properties.push('invalid value for "bank_account", bank_account cannot be nil.')
|
116
|
+
end
|
117
|
+
|
118
|
+
if @country.nil?
|
119
|
+
invalid_properties.push('invalid value for "country", country cannot be nil.')
|
120
|
+
end
|
121
|
+
|
122
|
+
invalid_properties
|
123
|
+
end
|
124
|
+
|
125
|
+
# Check to see if the all the properties in the model are valid
|
126
|
+
# @return true if the model is valid
|
127
|
+
def valid?
|
128
|
+
return false if @first_name.nil?
|
129
|
+
return false if @last_name.nil?
|
130
|
+
return false if @phone_number.nil?
|
131
|
+
return false if @bank_code.nil?
|
132
|
+
return false if @bank_account.nil?
|
133
|
+
return false if @country.nil?
|
134
|
+
true
|
135
|
+
end
|
136
|
+
|
137
|
+
# Checks equality by comparing each attribute.
|
138
|
+
# @param [Object] Object to be compared
|
139
|
+
def ==(o)
|
140
|
+
return true if self.equal?(o)
|
141
|
+
self.class == o.class &&
|
142
|
+
first_name == o.first_name &&
|
143
|
+
last_name == o.last_name &&
|
144
|
+
phone_number == o.phone_number &&
|
145
|
+
bank_code == o.bank_code &&
|
146
|
+
bank_account == o.bank_account &&
|
147
|
+
country == o.country
|
148
|
+
end
|
149
|
+
|
150
|
+
# @see the `==` method
|
151
|
+
# @param [Object] Object to be compared
|
152
|
+
def eql?(o)
|
153
|
+
self == o
|
154
|
+
end
|
155
|
+
|
156
|
+
# Calculates hash code according to all attributes.
|
157
|
+
# @return [Integer] Hash code
|
158
|
+
def hash
|
159
|
+
[first_name, last_name, phone_number, bank_code, bank_account, country].hash
|
160
|
+
end
|
161
|
+
|
162
|
+
require 'active_support/core_ext/hash'
|
163
|
+
require 'active_support/hash_with_indifferent_access.rb'
|
164
|
+
# Builds the object from hash
|
165
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
166
|
+
# @return [Object] Returns the model itself
|
167
|
+
def build_from_hash(attributes)
|
168
|
+
return nil unless attributes.is_a?(Hash)
|
169
|
+
self.class.openapi_types.each_pair do |key, type|
|
170
|
+
if type =~ /\AArray<(.*)>/i
|
171
|
+
# check to ensure the input is an array given that the the attribute
|
172
|
+
# is documented as an array but the input is not
|
173
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
174
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
175
|
+
end
|
176
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
177
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
178
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
179
|
+
end
|
180
|
+
|
181
|
+
self
|
182
|
+
end
|
183
|
+
|
184
|
+
# Deserializes the data based on type
|
185
|
+
# @param string type Data type
|
186
|
+
# @param string value Value to be deserialized
|
187
|
+
# @return [Object] Deserialized data
|
188
|
+
def _deserialize(type, value)
|
189
|
+
case type.to_sym
|
190
|
+
when :DateTime
|
191
|
+
DateTime.parse(value)
|
192
|
+
when :Date
|
193
|
+
Date.parse(value)
|
194
|
+
when :String
|
195
|
+
value.to_s
|
196
|
+
when :Integer
|
197
|
+
value.to_i
|
198
|
+
when :Float
|
199
|
+
value.to_f
|
200
|
+
when :Boolean
|
201
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
202
|
+
true
|
203
|
+
else
|
204
|
+
false
|
205
|
+
end
|
206
|
+
when :Object
|
207
|
+
# generic object (usually a Hash), return directly
|
208
|
+
value
|
209
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
210
|
+
inner_type = Regexp.last_match[:inner_type]
|
211
|
+
value.map { |v| _deserialize(inner_type, v) }
|
212
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
213
|
+
k_type = Regexp.last_match[:k_type]
|
214
|
+
v_type = Regexp.last_match[:v_type]
|
215
|
+
{}.tap do |hash|
|
216
|
+
value.each do |k, v|
|
217
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
else # model
|
221
|
+
temp_model = TransferZero.const_get(type).new
|
222
|
+
temp_model.build_from_hash(value)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
# Returns the string representation of the object
|
227
|
+
# @return [String] String presentation of the object
|
228
|
+
def to_s
|
229
|
+
to_hash.to_s
|
230
|
+
end
|
231
|
+
|
232
|
+
# to_body is an alias to to_hash (backward compatibility)
|
233
|
+
# @return [Hash] Returns the object in the form of hash
|
234
|
+
def to_body
|
235
|
+
to_hash
|
236
|
+
end
|
237
|
+
|
238
|
+
# Returns the object in the form of hash
|
239
|
+
# @return [Hash] Returns the object in the form of hash
|
240
|
+
def to_hash
|
241
|
+
hash = {}
|
242
|
+
self.class.attribute_map.each_pair do |attr, param|
|
243
|
+
value = self.send(attr)
|
244
|
+
next if value.nil?
|
245
|
+
hash[param] = _to_hash(value)
|
246
|
+
end
|
247
|
+
::ActiveSupport::HashWithIndifferentAccess.new(hash)
|
248
|
+
end
|
249
|
+
|
250
|
+
def [](key)
|
251
|
+
to_hash[key]
|
252
|
+
end
|
253
|
+
|
254
|
+
def dig(*args)
|
255
|
+
to_hash.dig(*args)
|
256
|
+
end
|
257
|
+
|
258
|
+
# Outputs non-array value in the form of hash
|
259
|
+
# For object, use to_hash. Otherwise, just return the value
|
260
|
+
# @param [Object] value Any valid value
|
261
|
+
# @return [Hash] Returns the value in the form of hash
|
262
|
+
def _to_hash(value)
|
263
|
+
if value.is_a?(Array)
|
264
|
+
value.compact.map { |v| _to_hash(v) }
|
265
|
+
elsif value.is_a?(Hash)
|
266
|
+
{}.tap do |hash|
|
267
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
268
|
+
end
|
269
|
+
elsif value.respond_to? :to_hash
|
270
|
+
value.to_hash
|
271
|
+
else
|
272
|
+
value
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
end
|
277
|
+
|
278
|
+
end
|