transferzero-sdk 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -54,6 +54,10 @@ module TransferZero
54
54
 
55
55
  attr_accessor :reference
56
56
 
57
+ attr_accessor :name
58
+
59
+ attr_accessor :address
60
+
57
61
  # Attribute mapping from ruby-style variable name to JSON key.
58
62
  def self.attribute_map
59
63
  {
@@ -76,7 +80,9 @@ module TransferZero
76
80
  :'reason' => :'reason',
77
81
  :'identity_card_type' => :'identity_card_type',
78
82
  :'identity_card_id' => :'identity_card_id',
79
- :'reference' => :'reference'
83
+ :'reference' => :'reference',
84
+ :'name' => :'name',
85
+ :'address' => :'address'
80
86
  }
81
87
  end
82
88
 
@@ -102,13 +108,16 @@ module TransferZero
102
108
  :'reason' => :'String',
103
109
  :'identity_card_type' => :'PayoutMethodIdentityCardTypeEnum',
104
110
  :'identity_card_id' => :'String',
105
- :'reference' => :'String'
111
+ :'reference' => :'String',
112
+ :'name' => :'String',
113
+ :'address' => :'String'
106
114
  }
107
115
  end
108
116
 
109
117
  # List of class defined in oneOf (OpenAPI v3)
110
118
  def self.openapi_one_of
111
119
  [
120
+ :'PayoutMethodDetailsBTC',
112
121
  :'PayoutMethodDetailsBalance',
113
122
  :'PayoutMethodDetailsGHSBank',
114
123
  :'PayoutMethodDetailsIBAN',
@@ -214,6 +223,14 @@ module TransferZero
214
223
  if attributes.key?(:'reference')
215
224
  self.reference = attributes[:'reference']
216
225
  end
226
+
227
+ if attributes.key?(:'name')
228
+ self.name = attributes[:'name']
229
+ end
230
+
231
+ if attributes.key?(:'address')
232
+ self.address = attributes[:'address']
233
+ end
217
234
  end
218
235
 
219
236
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -276,6 +293,14 @@ module TransferZero
276
293
  invalid_properties.push('invalid value for "sender_gender", sender_gender cannot be nil.')
277
294
  end
278
295
 
296
+ if @name.nil?
297
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
298
+ end
299
+
300
+ if @address.nil?
301
+ invalid_properties.push('invalid value for "address", address cannot be nil.')
302
+ end
303
+
279
304
  invalid_properties
280
305
  end
281
306
 
@@ -296,6 +321,8 @@ module TransferZero
296
321
  return false if @sender_city_of_birth.nil?
297
322
  return false if @sender_country_of_birth.nil?
298
323
  return false if @sender_gender.nil?
324
+ return false if @name.nil?
325
+ return false if @address.nil?
299
326
  _one_of_found = false
300
327
  openapi_one_of.each do |_class|
301
328
  _one_of = TransferZero.const_get(_class).build_from_hash(self.to_hash)
@@ -339,7 +366,9 @@ module TransferZero
339
366
  reason == o.reason &&
340
367
  identity_card_type == o.identity_card_type &&
341
368
  identity_card_id == o.identity_card_id &&
342
- reference == o.reference
369
+ reference == o.reference &&
370
+ name == o.name &&
371
+ address == o.address
343
372
  end
344
373
 
345
374
  # @see the `==` method
@@ -351,7 +380,7 @@ module TransferZero
351
380
  # Calculates hash code according to all attributes.
352
381
  # @return [Integer] Hash code
353
382
  def hash
354
- [first_name, last_name, bank_code, bank_account, bank_account_type, phone_number, mobile_provider, iban, bank_name, bank_country, 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].hash
383
+ [first_name, last_name, bank_code, bank_account, bank_account_type, phone_number, mobile_provider, iban, bank_name, bank_country, 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].hash
355
384
  end
356
385
 
357
386
  require 'active_support/core_ext/hash'
@@ -0,0 +1,249 @@
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
+ end
@@ -0,0 +1,271 @@
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 PoliticallyExposedPerson
17
+ attr_accessor :id
18
+
19
+ # Full name of the politically exposed person
20
+ attr_accessor :name
21
+
22
+ # The office held by the politically exposed person
23
+ attr_accessor :position
24
+
25
+ # The date on which the person started holding the office
26
+ attr_accessor :started_date
27
+
28
+ # The date on which the person ended holding the office
29
+ attr_accessor :ended_date
30
+
31
+ # The ID of the Sender to whom the person is attached to
32
+ attr_accessor :sender_id
33
+
34
+ # Date and time the person was created
35
+ attr_accessor :created_at
36
+
37
+ # Date and time the person was updated
38
+ attr_accessor :updated_at
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'id' => :'id',
44
+ :'name' => :'name',
45
+ :'position' => :'position',
46
+ :'started_date' => :'started_date',
47
+ :'ended_date' => :'ended_date',
48
+ :'sender_id' => :'sender_id',
49
+ :'created_at' => :'created_at',
50
+ :'updated_at' => :'updated_at'
51
+ }
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'id' => :'Integer',
58
+ :'name' => :'String',
59
+ :'position' => :'String',
60
+ :'started_date' => :'DateTime',
61
+ :'ended_date' => :'DateTime',
62
+ :'sender_id' => :'String',
63
+ :'created_at' => :'DateTime',
64
+ :'updated_at' => :'DateTime'
65
+ }
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ if (!attributes.is_a?(Hash))
72
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::PoliticallyExposedPerson` initialize method"
73
+ end
74
+
75
+ # check to see if the attribute exists and convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!self.class.attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::PoliticallyExposedPerson`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'id')
84
+ self.id = attributes[:'id']
85
+ end
86
+
87
+ if attributes.key?(:'name')
88
+ self.name = attributes[:'name']
89
+ end
90
+
91
+ if attributes.key?(:'position')
92
+ self.position = attributes[:'position']
93
+ end
94
+
95
+ if attributes.key?(:'started_date')
96
+ self.started_date = attributes[:'started_date']
97
+ end
98
+
99
+ if attributes.key?(:'ended_date')
100
+ self.ended_date = attributes[:'ended_date']
101
+ end
102
+
103
+ if attributes.key?(:'sender_id')
104
+ self.sender_id = attributes[:'sender_id']
105
+ end
106
+
107
+ if attributes.key?(:'created_at')
108
+ self.created_at = attributes[:'created_at']
109
+ end
110
+
111
+ if attributes.key?(:'updated_at')
112
+ self.updated_at = attributes[:'updated_at']
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ invalid_properties = Array.new
120
+ invalid_properties
121
+ end
122
+
123
+ # Check to see if the all the properties in the model are valid
124
+ # @return true if the model is valid
125
+ def valid?
126
+ true
127
+ end
128
+
129
+ # Checks equality by comparing each attribute.
130
+ # @param [Object] Object to be compared
131
+ def ==(o)
132
+ return true if self.equal?(o)
133
+ self.class == o.class &&
134
+ id == o.id &&
135
+ name == o.name &&
136
+ position == o.position &&
137
+ started_date == o.started_date &&
138
+ ended_date == o.ended_date &&
139
+ sender_id == o.sender_id &&
140
+ created_at == o.created_at &&
141
+ updated_at == o.updated_at
142
+ end
143
+
144
+ # @see the `==` method
145
+ # @param [Object] Object to be compared
146
+ def eql?(o)
147
+ self == o
148
+ end
149
+
150
+ # Calculates hash code according to all attributes.
151
+ # @return [Integer] Hash code
152
+ def hash
153
+ [id, name, position, started_date, ended_date, sender_id, created_at, updated_at].hash
154
+ end
155
+
156
+ require 'active_support/core_ext/hash'
157
+ require 'active_support/hash_with_indifferent_access.rb'
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def build_from_hash(attributes)
162
+ return nil unless attributes.is_a?(Hash)
163
+ self.class.openapi_types.each_pair do |key, type|
164
+ if type =~ /\AArray<(.*)>/i
165
+ # check to ensure the input is an array given that the the attribute
166
+ # is documented as an array but the input is not
167
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
168
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
169
+ end
170
+ elsif !attributes[self.class.attribute_map[key]].nil?
171
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
172
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
173
+ end
174
+
175
+ self
176
+ end
177
+
178
+ # Deserializes the data based on type
179
+ # @param string type Data type
180
+ # @param string value Value to be deserialized
181
+ # @return [Object] Deserialized data
182
+ def _deserialize(type, value)
183
+ case type.to_sym
184
+ when :DateTime
185
+ DateTime.parse(value)
186
+ when :Date
187
+ Date.parse(value)
188
+ when :String
189
+ value.to_s
190
+ when :Integer
191
+ value.to_i
192
+ when :Float
193
+ value.to_f
194
+ when :Boolean
195
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
196
+ true
197
+ else
198
+ false
199
+ end
200
+ when :Object
201
+ # generic object (usually a Hash), return directly
202
+ value
203
+ when /\AArray<(?<inner_type>.+)>\z/
204
+ inner_type = Regexp.last_match[:inner_type]
205
+ value.map { |v| _deserialize(inner_type, v) }
206
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
207
+ k_type = Regexp.last_match[:k_type]
208
+ v_type = Regexp.last_match[:v_type]
209
+ {}.tap do |hash|
210
+ value.each do |k, v|
211
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
212
+ end
213
+ end
214
+ else # model
215
+ temp_model = TransferZero.const_get(type).new
216
+ temp_model.build_from_hash(value)
217
+ end
218
+ end
219
+
220
+ # Returns the string representation of the object
221
+ # @return [String] String presentation of the object
222
+ def to_s
223
+ to_hash.to_s
224
+ end
225
+
226
+ # to_body is an alias to to_hash (backward compatibility)
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_body
229
+ to_hash
230
+ end
231
+
232
+ # Returns the object in the form of hash
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_hash
235
+ hash = {}
236
+ self.class.attribute_map.each_pair do |attr, param|
237
+ value = self.send(attr)
238
+ next if value.nil?
239
+ hash[param] = _to_hash(value)
240
+ end
241
+ ::ActiveSupport::HashWithIndifferentAccess.new(hash)
242
+ end
243
+
244
+ def [](key)
245
+ to_hash[key]
246
+ end
247
+
248
+ def dig(*args)
249
+ to_hash.dig(*args)
250
+ end
251
+
252
+ # Outputs non-array value in the form of hash
253
+ # For object, use to_hash. Otherwise, just return the value
254
+ # @param [Object] value Any valid value
255
+ # @return [Hash] Returns the value in the form of hash
256
+ def _to_hash(value)
257
+ if value.is_a?(Array)
258
+ value.compact.map { |v| _to_hash(v) }
259
+ elsif value.is_a?(Hash)
260
+ {}.tap do |hash|
261
+ value.each { |k, v| hash[k] = _to_hash(v) }
262
+ end
263
+ elsif value.respond_to? :to_hash
264
+ value.to_hash
265
+ else
266
+ value
267
+ end
268
+ end
269
+
270
+ end
271
+ end