transferzero-sdk 1.5.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -5
  3. data/docs/Currency.md +0 -2
  4. data/docs/CurrencyExchange.md +0 -2
  5. data/docs/CurrencyOpposite.md +3 -3
  6. data/docs/Document.md +3 -3
  7. data/docs/DocumentsApi.md +2 -74
  8. data/docs/PayinMethodDetails.md +3 -1
  9. data/docs/PayinMethodDetailsBTC.md +17 -0
  10. data/docs/PayoutMethod.md +1 -1
  11. data/docs/PayoutMethodDetails.md +17 -1
  12. data/docs/PayoutMethodDetailsBTC.md +23 -0
  13. data/docs/PayoutMethodDetailsGBPBank.md +29 -0
  14. data/docs/PayoutMethodDetailsIBAN.md +1 -1
  15. data/docs/PayoutMethodDetailsMobile.md +3 -1
  16. data/docs/PayoutMethodDetailsZARBank.md +35 -0
  17. data/docs/PoliticallyExposedPerson.md +31 -0
  18. data/docs/Recipient.md +1 -1
  19. data/docs/RecipientsApi.md +1 -1
  20. data/docs/Sender.md +72 -32
  21. data/docs/Transaction.md +3 -3
  22. data/lib/transferzero-sdk.rb +5 -0
  23. data/lib/transferzero-sdk/api/documents_api.rb +0 -63
  24. data/lib/transferzero-sdk/api/recipients_api.rb +2 -2
  25. data/lib/transferzero-sdk/api_client.rb +5 -3
  26. data/lib/transferzero-sdk/models/account.rb +70 -69
  27. data/lib/transferzero-sdk/models/account_list_response.rb +67 -66
  28. data/lib/transferzero-sdk/models/account_meta.rb +61 -60
  29. data/lib/transferzero-sdk/models/account_response.rb +66 -65
  30. data/lib/transferzero-sdk/models/account_validation_error.rb +61 -60
  31. data/lib/transferzero-sdk/models/account_validation_request.rb +164 -163
  32. data/lib/transferzero-sdk/models/account_validation_response.rb +66 -65
  33. data/lib/transferzero-sdk/models/account_validation_result.rb +61 -60
  34. data/lib/transferzero-sdk/models/api_log.rb +136 -135
  35. data/lib/transferzero-sdk/models/api_log_list_response.rb +70 -69
  36. data/lib/transferzero-sdk/models/api_log_response.rb +60 -59
  37. data/lib/transferzero-sdk/models/currency.rb +133 -142
  38. data/lib/transferzero-sdk/models/currency_exchange.rb +149 -158
  39. data/lib/transferzero-sdk/models/currency_exchange_list_response.rb +62 -61
  40. data/lib/transferzero-sdk/models/currency_list_response.rb +62 -61
  41. data/lib/transferzero-sdk/models/currency_opposite.rb +166 -165
  42. data/lib/transferzero-sdk/models/debit.rb +151 -150
  43. data/lib/transferzero-sdk/models/debit_list_request.rb +61 -60
  44. data/lib/transferzero-sdk/models/debit_list_response.rb +67 -66
  45. data/lib/transferzero-sdk/models/debit_request.rb +60 -59
  46. data/lib/transferzero-sdk/models/debit_request_wrapper.rb +80 -79
  47. data/lib/transferzero-sdk/models/debit_response.rb +60 -59
  48. data/lib/transferzero-sdk/models/document.rb +179 -177
  49. data/lib/transferzero-sdk/models/document_list_response.rb +67 -66
  50. data/lib/transferzero-sdk/models/document_request.rb +60 -59
  51. data/lib/transferzero-sdk/models/document_response.rb +60 -59
  52. data/lib/transferzero-sdk/models/document_webhook.rb +96 -95
  53. data/lib/transferzero-sdk/models/error_status.rb +66 -65
  54. data/lib/transferzero-sdk/models/field_description.rb +95 -94
  55. data/lib/transferzero-sdk/models/field_select_validation.rb +70 -69
  56. data/lib/transferzero-sdk/models/field_validation.rb +78 -77
  57. data/lib/transferzero-sdk/models/pagination.rb +97 -96
  58. data/lib/transferzero-sdk/models/pagination_meta.rb +60 -59
  59. data/lib/transferzero-sdk/models/payin_method.rb +97 -96
  60. data/lib/transferzero-sdk/models/payin_method_details.rb +122 -110
  61. data/lib/transferzero-sdk/models/payin_method_details_btc.rb +204 -0
  62. data/lib/transferzero-sdk/models/payin_method_details_mobile.rb +75 -74
  63. data/lib/transferzero-sdk/models/payin_method_details_ngn_bank.rb +71 -70
  64. data/lib/transferzero-sdk/models/payin_method_request.rb +60 -59
  65. data/lib/transferzero-sdk/models/payment_method.rb +109 -108
  66. data/lib/transferzero-sdk/models/payment_method_list_response.rb +61 -60
  67. data/lib/transferzero-sdk/models/payment_method_opposite.rb +124 -123
  68. data/lib/transferzero-sdk/models/payout_method.rb +107 -106
  69. data/lib/transferzero-sdk/models/payout_method_bank_account_type_enum.rb +14 -19
  70. data/lib/transferzero-sdk/models/payout_method_details.rb +398 -297
  71. data/lib/transferzero-sdk/models/payout_method_details_balance.rb +61 -60
  72. data/lib/transferzero-sdk/models/payout_method_details_btc.rb +250 -0
  73. data/lib/transferzero-sdk/models/payout_method_details_gbp_bank.rb +267 -0
  74. data/lib/transferzero-sdk/models/payout_method_details_ghs_bank.rb +97 -96
  75. data/lib/transferzero-sdk/models/payout_method_details_iban.rb +100 -104
  76. data/lib/transferzero-sdk/models/payout_method_details_mad_cash.rb +162 -161
  77. data/lib/transferzero-sdk/models/payout_method_details_mobile.rb +93 -83
  78. data/lib/transferzero-sdk/models/payout_method_details_ngn_bank.rb +104 -103
  79. data/lib/transferzero-sdk/models/payout_method_details_xof_bank.rb +108 -107
  80. data/lib/transferzero-sdk/models/payout_method_details_xof_mobile.rb +97 -96
  81. data/lib/transferzero-sdk/models/payout_method_details_zar_bank.rb +324 -0
  82. data/lib/transferzero-sdk/models/payout_method_gender_enum.rb +14 -19
  83. data/lib/transferzero-sdk/models/payout_method_identity_card_type_enum.rb +15 -20
  84. data/lib/transferzero-sdk/models/payout_method_list_response.rb +67 -66
  85. data/lib/transferzero-sdk/models/payout_method_mobile_provider_enum.rb +17 -19
  86. data/lib/transferzero-sdk/models/payout_method_request.rb +60 -59
  87. data/lib/transferzero-sdk/models/payout_method_response.rb +60 -59
  88. data/lib/transferzero-sdk/models/payout_method_webhook.rb +96 -95
  89. data/lib/transferzero-sdk/models/politically_exposed_person.rb +272 -0
  90. data/lib/transferzero-sdk/models/recipient.rb +230 -229
  91. data/lib/transferzero-sdk/models/recipient_list_response.rb +67 -66
  92. data/lib/transferzero-sdk/models/recipient_request.rb +60 -59
  93. data/lib/transferzero-sdk/models/recipient_response.rb +60 -59
  94. data/lib/transferzero-sdk/models/recipient_state.rb +22 -27
  95. data/lib/transferzero-sdk/models/recipient_webhook.rb +96 -95
  96. data/lib/transferzero-sdk/models/sender.rb +587 -348
  97. data/lib/transferzero-sdk/models/sender_list_response.rb +67 -66
  98. data/lib/transferzero-sdk/models/sender_request.rb +60 -59
  99. data/lib/transferzero-sdk/models/sender_response.rb +66 -65
  100. data/lib/transferzero-sdk/models/sender_response_existing.rb +60 -59
  101. data/lib/transferzero-sdk/models/sender_response_meta.rb +60 -59
  102. data/lib/transferzero-sdk/models/sender_state.rb +19 -24
  103. data/lib/transferzero-sdk/models/sender_webhook.rb +96 -95
  104. data/lib/transferzero-sdk/models/transaction.rb +192 -191
  105. data/lib/transferzero-sdk/models/transaction_list_response.rb +67 -66
  106. data/lib/transferzero-sdk/models/transaction_request.rb +60 -59
  107. data/lib/transferzero-sdk/models/transaction_response.rb +66 -65
  108. data/lib/transferzero-sdk/models/transaction_response_existing.rb +66 -65
  109. data/lib/transferzero-sdk/models/transaction_response_meta.rb +60 -59
  110. data/lib/transferzero-sdk/models/transaction_state.rb +23 -28
  111. data/lib/transferzero-sdk/models/transaction_traits.rb +71 -70
  112. data/lib/transferzero-sdk/models/transaction_webhook.rb +96 -95
  113. data/lib/transferzero-sdk/models/validation_error_description.rb +62 -61
  114. data/lib/transferzero-sdk/models/webhook.rb +92 -91
  115. data/lib/transferzero-sdk/models/webhook_definition.rb +107 -106
  116. data/lib/transferzero-sdk/models/webhook_definition_event_list_response.rb +61 -60
  117. data/lib/transferzero-sdk/models/webhook_definition_list_response.rb +67 -66
  118. data/lib/transferzero-sdk/models/webhook_definition_request.rb +60 -59
  119. data/lib/transferzero-sdk/models/webhook_definition_response.rb +60 -59
  120. data/lib/transferzero-sdk/models/webhook_log.rb +97 -96
  121. data/lib/transferzero-sdk/models/webhook_log_list_response.rb +70 -69
  122. data/lib/transferzero-sdk/models/webhook_log_metadata.rb +129 -128
  123. data/lib/transferzero-sdk/models/webhook_log_metadata_request.rb +80 -79
  124. data/lib/transferzero-sdk/models/webhook_log_metadata_response.rb +81 -80
  125. data/lib/transferzero-sdk/models/webhook_log_response.rb +60 -59
  126. data/lib/transferzero-sdk/version.rb +1 -1
  127. data/spec/models/payin_method_details_btc_spec.rb +41 -0
  128. data/spec/models/payout_method_details_btc_spec.rb +59 -0
  129. data/spec/models/payout_method_details_gbp_bank_spec.rb +77 -0
  130. data/spec/models/payout_method_details_zar_bank_spec.rb +89 -0
  131. data/spec/models/politically_exposed_person_spec.rb +83 -0
  132. metadata +32 -13
  133. data/transferzero-sdk-1.4.0.gem +0 -0
@@ -13,76 +13,76 @@ OpenAPI Generator version: 4.0.0-beta3
13
13
  require 'date'
14
14
 
15
15
  module TransferZero
16
- # ```JSON \"details\": { \"reference\": \"Reference\" // optional } ```
17
- class PayoutMethodDetailsBalance
18
- attr_accessor :reference
19
-
20
- # Attribute mapping from ruby-style variable name to JSON key.
21
- def self.attribute_map
22
- {
23
- :'reference' => :'reference'
24
- }
25
- end
16
+ # ```JSON \"details\": { \"reference\": \"Reference\" // optional } ```
17
+ class PayoutMethodDetailsBalance
18
+ attr_accessor :reference
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'reference' => :'reference'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'reference' => :'String'
31
+ }
32
+ end
26
33
 
27
- # Attribute type mapping.
28
- def self.openapi_types
29
- {
30
- :'reference' => :'String'
31
- }
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ if (!attributes.is_a?(Hash))
38
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::PayoutMethodDetailsBalance` initialize method"
32
39
  end
33
40
 
34
- # Initializes the object
35
- # @param [Hash] attributes Model attributes in the form of hash
36
- def initialize(attributes = {})
37
- if (!attributes.is_a?(Hash))
38
- fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::PayoutMethodDetailsBalance` initialize method"
41
+ # check to see if the attribute exists and convert string to symbol for hash key
42
+ attributes = attributes.each_with_object({}) { |(k, v), h|
43
+ if (!self.class.attribute_map.key?(k.to_sym))
44
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::PayoutMethodDetailsBalance`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
39
45
  end
46
+ h[k.to_sym] = v
47
+ }
40
48
 
41
- # check to see if the attribute exists and convert string to symbol for hash key
42
- attributes = attributes.each_with_object({}) { |(k, v), h|
43
- if (!self.class.attribute_map.key?(k.to_sym))
44
- fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::PayoutMethodDetailsBalance`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
45
- end
46
- h[k.to_sym] = v
47
- }
48
-
49
- if attributes.key?(:'reference')
50
- self.reference = attributes[:'reference']
51
- end
49
+ if attributes.key?(:'reference')
50
+ self.reference = attributes[:'reference']
52
51
  end
52
+ end
53
53
 
54
- # Show invalid properties with the reasons. Usually used together with valid?
55
- # @return Array for valid properties with the reasons
56
- def list_invalid_properties
57
- invalid_properties = Array.new
58
- invalid_properties
59
- end
54
+ # Show invalid properties with the reasons. Usually used together with valid?
55
+ # @return Array for valid properties with the reasons
56
+ def list_invalid_properties
57
+ invalid_properties = Array.new
58
+ invalid_properties
59
+ end
60
60
 
61
- # Check to see if the all the properties in the model are valid
62
- # @return true if the model is valid
63
- def valid?
64
- true
65
- end
61
+ # Check to see if the all the properties in the model are valid
62
+ # @return true if the model is valid
63
+ def valid?
64
+ true
65
+ end
66
66
 
67
- # Checks equality by comparing each attribute.
68
- # @param [Object] Object to be compared
69
- def ==(o)
70
- return true if self.equal?(o)
71
- self.class == o.class &&
72
- reference == o.reference
73
- end
67
+ # Checks equality by comparing each attribute.
68
+ # @param [Object] Object to be compared
69
+ def ==(o)
70
+ return true if self.equal?(o)
71
+ self.class == o.class &&
72
+ reference == o.reference
73
+ end
74
74
 
75
- # @see the `==` method
76
- # @param [Object] Object to be compared
77
- def eql?(o)
78
- self == o
79
- end
75
+ # @see the `==` method
76
+ # @param [Object] Object to be compared
77
+ def eql?(o)
78
+ self == o
79
+ end
80
80
 
81
- # Calculates hash code according to all attributes.
82
- # @return [Integer] Hash code
83
- def hash
84
- [reference].hash
85
- end
81
+ # Calculates hash code according to all attributes.
82
+ # @return [Integer] Hash code
83
+ def hash
84
+ [reference].hash
85
+ end
86
86
 
87
87
  require 'active_support/core_ext/hash'
88
88
  require 'active_support/hash_with_indifferent_access.rb'
@@ -198,5 +198,6 @@ def _to_hash(value)
198
198
  end
199
199
  end
200
200
 
201
- end
201
+ end
202
+
202
203
  end
@@ -0,0 +1,250 @@
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\", \"name\": \"Full Name\" \"address\": \"n4VQ5YdHf7hLQ2gWQYYrcxoE5B7nWuDFNF\" }
17
+ class PayoutMethodDetailsBTC
18
+ attr_accessor :first_name
19
+
20
+ attr_accessor :last_name
21
+
22
+ attr_accessor :name
23
+
24
+ attr_accessor :address
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'first_name' => :'first_name',
30
+ :'last_name' => :'last_name',
31
+ :'name' => :'name',
32
+ :'address' => :'address'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'first_name' => :'String',
40
+ :'last_name' => :'String',
41
+ :'name' => :'String',
42
+ :'address' => :'String'
43
+ }
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::PayoutMethodDetailsBTC` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::PayoutMethodDetailsBTC`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'first_name')
62
+ self.first_name = attributes[:'first_name']
63
+ end
64
+
65
+ if attributes.key?(:'last_name')
66
+ self.last_name = attributes[:'last_name']
67
+ end
68
+
69
+ if attributes.key?(:'name')
70
+ self.name = attributes[:'name']
71
+ end
72
+
73
+ if attributes.key?(:'address')
74
+ self.address = attributes[:'address']
75
+ end
76
+ end
77
+
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properties with the reasons
80
+ def list_invalid_properties
81
+ invalid_properties = Array.new
82
+ if @first_name.nil?
83
+ invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
84
+ end
85
+
86
+ if @last_name.nil?
87
+ invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
88
+ end
89
+
90
+ if @name.nil?
91
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
92
+ end
93
+
94
+ if @address.nil?
95
+ invalid_properties.push('invalid value for "address", address cannot be nil.')
96
+ end
97
+
98
+ invalid_properties
99
+ end
100
+
101
+ # Check to see if the all the properties in the model are valid
102
+ # @return true if the model is valid
103
+ def valid?
104
+ return false if @first_name.nil?
105
+ return false if @last_name.nil?
106
+ return false if @name.nil?
107
+ return false if @address.nil?
108
+ true
109
+ end
110
+
111
+ # Checks equality by comparing each attribute.
112
+ # @param [Object] Object to be compared
113
+ def ==(o)
114
+ return true if self.equal?(o)
115
+ self.class == o.class &&
116
+ first_name == o.first_name &&
117
+ last_name == o.last_name &&
118
+ name == o.name &&
119
+ address == o.address
120
+ end
121
+
122
+ # @see the `==` method
123
+ # @param [Object] Object to be compared
124
+ def eql?(o)
125
+ self == o
126
+ end
127
+
128
+ # Calculates hash code according to all attributes.
129
+ # @return [Integer] Hash code
130
+ def hash
131
+ [first_name, last_name, name, address].hash
132
+ end
133
+
134
+ require 'active_support/core_ext/hash'
135
+ require 'active_support/hash_with_indifferent_access.rb'
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def build_from_hash(attributes)
140
+ return nil unless attributes.is_a?(Hash)
141
+ self.class.openapi_types.each_pair do |key, type|
142
+ if type =~ /\AArray<(.*)>/i
143
+ # check to ensure the input is an array given that the the attribute
144
+ # is documented as an array but the input is not
145
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
146
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
147
+ end
148
+ elsif !attributes[self.class.attribute_map[key]].nil?
149
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
150
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
151
+ end
152
+
153
+ self
154
+ end
155
+
156
+ # Deserializes the data based on type
157
+ # @param string type Data type
158
+ # @param string value Value to be deserialized
159
+ # @return [Object] Deserialized data
160
+ def _deserialize(type, value)
161
+ case type.to_sym
162
+ when :DateTime
163
+ DateTime.parse(value)
164
+ when :Date
165
+ Date.parse(value)
166
+ when :String
167
+ value.to_s
168
+ when :Integer
169
+ value.to_i
170
+ when :Float
171
+ value.to_f
172
+ when :Boolean
173
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
174
+ true
175
+ else
176
+ false
177
+ end
178
+ when :Object
179
+ # generic object (usually a Hash), return directly
180
+ value
181
+ when /\AArray<(?<inner_type>.+)>\z/
182
+ inner_type = Regexp.last_match[:inner_type]
183
+ value.map { |v| _deserialize(inner_type, v) }
184
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
185
+ k_type = Regexp.last_match[:k_type]
186
+ v_type = Regexp.last_match[:v_type]
187
+ {}.tap do |hash|
188
+ value.each do |k, v|
189
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
190
+ end
191
+ end
192
+ else # model
193
+ temp_model = TransferZero.const_get(type).new
194
+ temp_model.build_from_hash(value)
195
+ end
196
+ end
197
+
198
+ # Returns the string representation of the object
199
+ # @return [String] String presentation of the object
200
+ def to_s
201
+ to_hash.to_s
202
+ end
203
+
204
+ # to_body is an alias to to_hash (backward compatibility)
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_body
207
+ to_hash
208
+ end
209
+
210
+ # Returns the object in the form of hash
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_hash
213
+ hash = {}
214
+ self.class.attribute_map.each_pair do |attr, param|
215
+ value = self.send(attr)
216
+ next if value.nil?
217
+ hash[param] = _to_hash(value)
218
+ end
219
+ ::ActiveSupport::HashWithIndifferentAccess.new(hash)
220
+ end
221
+
222
+ def [](key)
223
+ to_hash[key]
224
+ end
225
+
226
+ def dig(*args)
227
+ to_hash.dig(*args)
228
+ end
229
+
230
+ # Outputs non-array value in the form of hash
231
+ # For object, use to_hash. Otherwise, just return the value
232
+ # @param [Object] value Any valid value
233
+ # @return [Hash] Returns the value in the form of hash
234
+ def _to_hash(value)
235
+ if value.is_a?(Array)
236
+ value.compact.map { |v| _to_hash(v) }
237
+ elsif value.is_a?(Hash)
238
+ {}.tap do |hash|
239
+ value.each { |k, v| hash[k] = _to_hash(v) }
240
+ end
241
+ elsif value.respond_to? :to_hash
242
+ value.to_hash
243
+ else
244
+ value
245
+ end
246
+ end
247
+
248
+ end
249
+
250
+ end
@@ -0,0 +1,267 @@
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\", \"bank_name\": \"Deutsche Bank\", \"bank_account\": \"12345678\", // Required if IBAN is not present \"sort_code\": \"123456\", // Required if bank_account is present \"iban\": \"DE89370400440532013000\", // Required if no bank_account & sort_code \"bic\": \"DEUTDEBBXXX\" // Optional } ```
17
+ class PayoutMethodDetailsGBPBank
18
+ attr_accessor :first_name
19
+
20
+ attr_accessor :last_name
21
+
22
+ attr_accessor :bank_name
23
+
24
+ attr_accessor :bank_account
25
+
26
+ attr_accessor :sort_code
27
+
28
+ attr_accessor :iban
29
+
30
+ attr_accessor :bic
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'first_name' => :'first_name',
36
+ :'last_name' => :'last_name',
37
+ :'bank_name' => :'bank_name',
38
+ :'bank_account' => :'bank_account',
39
+ :'sort_code' => :'sort_code',
40
+ :'iban' => :'iban',
41
+ :'bic' => :'bic'
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'first_name' => :'String',
49
+ :'last_name' => :'String',
50
+ :'bank_name' => :'String',
51
+ :'bank_account' => :'String',
52
+ :'sort_code' => :'String',
53
+ :'iban' => :'String',
54
+ :'bic' => :'String'
55
+ }
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::PayoutMethodDetailsGBPBank` initialize method"
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ attributes = attributes.each_with_object({}) { |(k, v), h|
67
+ if (!self.class.attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::PayoutMethodDetailsGBPBank`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
69
+ end
70
+ h[k.to_sym] = v
71
+ }
72
+
73
+ if attributes.key?(:'first_name')
74
+ self.first_name = attributes[:'first_name']
75
+ end
76
+
77
+ if attributes.key?(:'last_name')
78
+ self.last_name = attributes[:'last_name']
79
+ end
80
+
81
+ if attributes.key?(:'bank_name')
82
+ self.bank_name = attributes[:'bank_name']
83
+ end
84
+
85
+ if attributes.key?(:'bank_account')
86
+ self.bank_account = attributes[:'bank_account']
87
+ end
88
+
89
+ if attributes.key?(:'sort_code')
90
+ self.sort_code = attributes[:'sort_code']
91
+ end
92
+
93
+ if attributes.key?(:'iban')
94
+ self.iban = attributes[:'iban']
95
+ end
96
+
97
+ if attributes.key?(:'bic')
98
+ self.bic = attributes[:'bic']
99
+ end
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ invalid_properties = Array.new
106
+ if @first_name.nil?
107
+ invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
108
+ end
109
+
110
+ if @last_name.nil?
111
+ invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
112
+ end
113
+
114
+ invalid_properties
115
+ end
116
+
117
+ # Check to see if the all the properties in the model are valid
118
+ # @return true if the model is valid
119
+ def valid?
120
+ return false if @first_name.nil?
121
+ return false if @last_name.nil?
122
+ true
123
+ end
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] Object to be compared
127
+ def ==(o)
128
+ return true if self.equal?(o)
129
+ self.class == o.class &&
130
+ first_name == o.first_name &&
131
+ last_name == o.last_name &&
132
+ bank_name == o.bank_name &&
133
+ bank_account == o.bank_account &&
134
+ sort_code == o.sort_code &&
135
+ iban == o.iban &&
136
+ bic == o.bic
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] Object to be compared
141
+ def eql?(o)
142
+ self == o
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Integer] Hash code
147
+ def hash
148
+ [first_name, last_name, bank_name, bank_account, sort_code, iban, bic].hash
149
+ end
150
+
151
+ require 'active_support/core_ext/hash'
152
+ require 'active_support/hash_with_indifferent_access.rb'
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def build_from_hash(attributes)
157
+ return nil unless attributes.is_a?(Hash)
158
+ self.class.openapi_types.each_pair do |key, type|
159
+ if type =~ /\AArray<(.*)>/i
160
+ # check to ensure the input is an array given that the the attribute
161
+ # is documented as an array but the input is not
162
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
163
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
164
+ end
165
+ elsif !attributes[self.class.attribute_map[key]].nil?
166
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
167
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
168
+ end
169
+
170
+ self
171
+ end
172
+
173
+ # Deserializes the data based on type
174
+ # @param string type Data type
175
+ # @param string value Value to be deserialized
176
+ # @return [Object] Deserialized data
177
+ def _deserialize(type, value)
178
+ case type.to_sym
179
+ when :DateTime
180
+ DateTime.parse(value)
181
+ when :Date
182
+ Date.parse(value)
183
+ when :String
184
+ value.to_s
185
+ when :Integer
186
+ value.to_i
187
+ when :Float
188
+ value.to_f
189
+ when :Boolean
190
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
191
+ true
192
+ else
193
+ false
194
+ end
195
+ when :Object
196
+ # generic object (usually a Hash), return directly
197
+ value
198
+ when /\AArray<(?<inner_type>.+)>\z/
199
+ inner_type = Regexp.last_match[:inner_type]
200
+ value.map { |v| _deserialize(inner_type, v) }
201
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
202
+ k_type = Regexp.last_match[:k_type]
203
+ v_type = Regexp.last_match[:v_type]
204
+ {}.tap do |hash|
205
+ value.each do |k, v|
206
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
207
+ end
208
+ end
209
+ else # model
210
+ temp_model = TransferZero.const_get(type).new
211
+ temp_model.build_from_hash(value)
212
+ end
213
+ end
214
+
215
+ # Returns the string representation of the object
216
+ # @return [String] String presentation of the object
217
+ def to_s
218
+ to_hash.to_s
219
+ end
220
+
221
+ # to_body is an alias to to_hash (backward compatibility)
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_body
224
+ to_hash
225
+ end
226
+
227
+ # Returns the object in the form of hash
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_hash
230
+ hash = {}
231
+ self.class.attribute_map.each_pair do |attr, param|
232
+ value = self.send(attr)
233
+ next if value.nil?
234
+ hash[param] = _to_hash(value)
235
+ end
236
+ ::ActiveSupport::HashWithIndifferentAccess.new(hash)
237
+ end
238
+
239
+ def [](key)
240
+ to_hash[key]
241
+ end
242
+
243
+ def dig(*args)
244
+ to_hash.dig(*args)
245
+ end
246
+
247
+ # Outputs non-array value in the form of hash
248
+ # For object, use to_hash. Otherwise, just return the value
249
+ # @param [Object] value Any valid value
250
+ # @return [Hash] Returns the value in the form of hash
251
+ def _to_hash(value)
252
+ if value.is_a?(Array)
253
+ value.compact.map { |v| _to_hash(v) }
254
+ elsif value.is_a?(Hash)
255
+ {}.tap do |hash|
256
+ value.each { |k, v| hash[k] = _to_hash(v) }
257
+ end
258
+ elsif value.respond_to? :to_hash
259
+ value.to_hash
260
+ else
261
+ value
262
+ end
263
+ end
264
+
265
+ end
266
+
267
+ end