mx-platform-ruby 0.17.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,417 @@
1
+ =begin
2
+ #MX Platform API
3
+
4
+ #The MX Platform API is a powerful, fully-featured API designed to make aggregating and enhancing financial data easy and reliable. It can seamlessly connect your app or website to tens of thousands of financial institutions.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MxPlatformRuby
17
+ class AccountCreateRequest
18
+ attr_accessor :account_subtype_name
19
+
20
+ attr_accessor :account_type
21
+
22
+ attr_accessor :apr
23
+
24
+ attr_accessor :apy
25
+
26
+ attr_accessor :available_balance
27
+
28
+ attr_accessor :balance
29
+
30
+ attr_accessor :cash_surrender_value
31
+
32
+ attr_accessor :credit_limit
33
+
34
+ attr_accessor :currency_code
35
+
36
+ attr_accessor :death_benefit
37
+
38
+ attr_accessor :interest_rate
39
+
40
+ attr_accessor :is_business
41
+
42
+ attr_accessor :is_closed
43
+
44
+ attr_accessor :is_hidden
45
+
46
+ attr_accessor :loan_amount
47
+
48
+ attr_accessor :metadata
49
+
50
+ attr_accessor :name
51
+
52
+ attr_accessor :nickname
53
+
54
+ attr_accessor :original_balance
55
+
56
+ attr_accessor :property_type
57
+
58
+ attr_accessor :property_type_name
59
+
60
+ attr_accessor :skip_webhook
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'account_subtype_name' => :'account_subtype_name',
66
+ :'account_type' => :'account_type',
67
+ :'apr' => :'apr',
68
+ :'apy' => :'apy',
69
+ :'available_balance' => :'available_balance',
70
+ :'balance' => :'balance',
71
+ :'cash_surrender_value' => :'cash_surrender_value',
72
+ :'credit_limit' => :'credit_limit',
73
+ :'currency_code' => :'currency_code',
74
+ :'death_benefit' => :'death_benefit',
75
+ :'interest_rate' => :'interest_rate',
76
+ :'is_business' => :'is_business',
77
+ :'is_closed' => :'is_closed',
78
+ :'is_hidden' => :'is_hidden',
79
+ :'loan_amount' => :'loan_amount',
80
+ :'metadata' => :'metadata',
81
+ :'name' => :'name',
82
+ :'nickname' => :'nickname',
83
+ :'original_balance' => :'original_balance',
84
+ :'property_type' => :'property_type',
85
+ :'property_type_name' => :'property_type_name',
86
+ :'skip_webhook' => :'skip_webhook'
87
+ }
88
+ end
89
+
90
+ # Returns all the JSON keys this model knows about
91
+ def self.acceptable_attributes
92
+ attribute_map.values
93
+ end
94
+
95
+ # Attribute type mapping.
96
+ def self.openapi_types
97
+ {
98
+ :'account_subtype_name' => :'String',
99
+ :'account_type' => :'Integer',
100
+ :'apr' => :'Float',
101
+ :'apy' => :'Float',
102
+ :'available_balance' => :'Float',
103
+ :'balance' => :'Float',
104
+ :'cash_surrender_value' => :'Float',
105
+ :'credit_limit' => :'Float',
106
+ :'currency_code' => :'String',
107
+ :'death_benefit' => :'Integer',
108
+ :'interest_rate' => :'Float',
109
+ :'is_business' => :'Boolean',
110
+ :'is_closed' => :'Boolean',
111
+ :'is_hidden' => :'Boolean',
112
+ :'loan_amount' => :'Float',
113
+ :'metadata' => :'String',
114
+ :'name' => :'String',
115
+ :'nickname' => :'String',
116
+ :'original_balance' => :'Float',
117
+ :'property_type' => :'Integer',
118
+ :'property_type_name' => :'String',
119
+ :'skip_webhook' => :'Boolean'
120
+ }
121
+ end
122
+
123
+ # List of attributes with nullable: true
124
+ def self.openapi_nullable
125
+ Set.new([
126
+ ])
127
+ end
128
+
129
+ # Initializes the object
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ def initialize(attributes = {})
132
+ if (!attributes.is_a?(Hash))
133
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::AccountCreateRequest` initialize method"
134
+ end
135
+
136
+ # check to see if the attribute exists and convert string to symbol for hash key
137
+ attributes = attributes.each_with_object({}) { |(k, v), h|
138
+ if (!self.class.attribute_map.key?(k.to_sym))
139
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MxPlatformRuby::AccountCreateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
140
+ end
141
+ h[k.to_sym] = v
142
+ }
143
+
144
+ if attributes.key?(:'account_subtype_name')
145
+ self.account_subtype_name = attributes[:'account_subtype_name']
146
+ end
147
+
148
+ if attributes.key?(:'account_type')
149
+ self.account_type = attributes[:'account_type']
150
+ end
151
+
152
+ if attributes.key?(:'apr')
153
+ self.apr = attributes[:'apr']
154
+ end
155
+
156
+ if attributes.key?(:'apy')
157
+ self.apy = attributes[:'apy']
158
+ end
159
+
160
+ if attributes.key?(:'available_balance')
161
+ self.available_balance = attributes[:'available_balance']
162
+ end
163
+
164
+ if attributes.key?(:'balance')
165
+ self.balance = attributes[:'balance']
166
+ end
167
+
168
+ if attributes.key?(:'cash_surrender_value')
169
+ self.cash_surrender_value = attributes[:'cash_surrender_value']
170
+ end
171
+
172
+ if attributes.key?(:'credit_limit')
173
+ self.credit_limit = attributes[:'credit_limit']
174
+ end
175
+
176
+ if attributes.key?(:'currency_code')
177
+ self.currency_code = attributes[:'currency_code']
178
+ end
179
+
180
+ if attributes.key?(:'death_benefit')
181
+ self.death_benefit = attributes[:'death_benefit']
182
+ end
183
+
184
+ if attributes.key?(:'interest_rate')
185
+ self.interest_rate = attributes[:'interest_rate']
186
+ end
187
+
188
+ if attributes.key?(:'is_business')
189
+ self.is_business = attributes[:'is_business']
190
+ end
191
+
192
+ if attributes.key?(:'is_closed')
193
+ self.is_closed = attributes[:'is_closed']
194
+ end
195
+
196
+ if attributes.key?(:'is_hidden')
197
+ self.is_hidden = attributes[:'is_hidden']
198
+ end
199
+
200
+ if attributes.key?(:'loan_amount')
201
+ self.loan_amount = attributes[:'loan_amount']
202
+ end
203
+
204
+ if attributes.key?(:'metadata')
205
+ self.metadata = attributes[:'metadata']
206
+ end
207
+
208
+ if attributes.key?(:'name')
209
+ self.name = attributes[:'name']
210
+ end
211
+
212
+ if attributes.key?(:'nickname')
213
+ self.nickname = attributes[:'nickname']
214
+ end
215
+
216
+ if attributes.key?(:'original_balance')
217
+ self.original_balance = attributes[:'original_balance']
218
+ end
219
+
220
+ if attributes.key?(:'property_type')
221
+ self.property_type = attributes[:'property_type']
222
+ end
223
+
224
+ if attributes.key?(:'property_type_name')
225
+ self.property_type_name = attributes[:'property_type_name']
226
+ end
227
+
228
+ if attributes.key?(:'skip_webhook')
229
+ self.skip_webhook = attributes[:'skip_webhook']
230
+ end
231
+ end
232
+
233
+ # Show invalid properties with the reasons. Usually used together with valid?
234
+ # @return Array for valid properties with the reasons
235
+ def list_invalid_properties
236
+ invalid_properties = Array.new
237
+ if @account_type.nil?
238
+ invalid_properties.push('invalid value for "account_type", account_type cannot be nil.')
239
+ end
240
+
241
+ if @name.nil?
242
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
243
+ end
244
+
245
+ invalid_properties
246
+ end
247
+
248
+ # Check to see if the all the properties in the model are valid
249
+ # @return true if the model is valid
250
+ def valid?
251
+ return false if @account_type.nil?
252
+ return false if @name.nil?
253
+ true
254
+ end
255
+
256
+ # Checks equality by comparing each attribute.
257
+ # @param [Object] Object to be compared
258
+ def ==(o)
259
+ return true if self.equal?(o)
260
+ self.class == o.class &&
261
+ account_subtype_name == o.account_subtype_name &&
262
+ account_type == o.account_type &&
263
+ apr == o.apr &&
264
+ apy == o.apy &&
265
+ available_balance == o.available_balance &&
266
+ balance == o.balance &&
267
+ cash_surrender_value == o.cash_surrender_value &&
268
+ credit_limit == o.credit_limit &&
269
+ currency_code == o.currency_code &&
270
+ death_benefit == o.death_benefit &&
271
+ interest_rate == o.interest_rate &&
272
+ is_business == o.is_business &&
273
+ is_closed == o.is_closed &&
274
+ is_hidden == o.is_hidden &&
275
+ loan_amount == o.loan_amount &&
276
+ metadata == o.metadata &&
277
+ name == o.name &&
278
+ nickname == o.nickname &&
279
+ original_balance == o.original_balance &&
280
+ property_type == o.property_type &&
281
+ property_type_name == o.property_type_name &&
282
+ skip_webhook == o.skip_webhook
283
+ end
284
+
285
+ # @see the `==` method
286
+ # @param [Object] Object to be compared
287
+ def eql?(o)
288
+ self == o
289
+ end
290
+
291
+ # Calculates hash code according to all attributes.
292
+ # @return [Integer] Hash code
293
+ def hash
294
+ [account_subtype_name, account_type, apr, apy, available_balance, balance, cash_surrender_value, credit_limit, currency_code, death_benefit, interest_rate, is_business, is_closed, is_hidden, loan_amount, metadata, name, nickname, original_balance, property_type, property_type_name, skip_webhook].hash
295
+ end
296
+
297
+ # Builds the object from hash
298
+ # @param [Hash] attributes Model attributes in the form of hash
299
+ # @return [Object] Returns the model itself
300
+ def self.build_from_hash(attributes)
301
+ new.build_from_hash(attributes)
302
+ end
303
+
304
+ # Builds the object from hash
305
+ # @param [Hash] attributes Model attributes in the form of hash
306
+ # @return [Object] Returns the model itself
307
+ def build_from_hash(attributes)
308
+ return nil unless attributes.is_a?(Hash)
309
+ self.class.openapi_types.each_pair do |key, type|
310
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
311
+ self.send("#{key}=", nil)
312
+ elsif type =~ /\AArray<(.*)>/i
313
+ # check to ensure the input is an array given that the attribute
314
+ # is documented as an array but the input is not
315
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
316
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
317
+ end
318
+ elsif !attributes[self.class.attribute_map[key]].nil?
319
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
320
+ end
321
+ end
322
+
323
+ self
324
+ end
325
+
326
+ # Deserializes the data based on type
327
+ # @param string type Data type
328
+ # @param string value Value to be deserialized
329
+ # @return [Object] Deserialized data
330
+ def _deserialize(type, value)
331
+ case type.to_sym
332
+ when :Time
333
+ Time.parse(value)
334
+ when :Date
335
+ Date.parse(value)
336
+ when :String
337
+ value.to_s
338
+ when :Integer
339
+ value.to_i
340
+ when :Float
341
+ value.to_f
342
+ when :Boolean
343
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
344
+ true
345
+ else
346
+ false
347
+ end
348
+ when :Object
349
+ # generic object (usually a Hash), return directly
350
+ value
351
+ when /\AArray<(?<inner_type>.+)>\z/
352
+ inner_type = Regexp.last_match[:inner_type]
353
+ value.map { |v| _deserialize(inner_type, v) }
354
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
355
+ k_type = Regexp.last_match[:k_type]
356
+ v_type = Regexp.last_match[:v_type]
357
+ {}.tap do |hash|
358
+ value.each do |k, v|
359
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
360
+ end
361
+ end
362
+ else # model
363
+ # models (e.g. Pet) or oneOf
364
+ klass = MxPlatformRuby.const_get(type)
365
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
366
+ end
367
+ end
368
+
369
+ # Returns the string representation of the object
370
+ # @return [String] String presentation of the object
371
+ def to_s
372
+ to_hash.to_s
373
+ end
374
+
375
+ # to_body is an alias to to_hash (backward compatibility)
376
+ # @return [Hash] Returns the object in the form of hash
377
+ def to_body
378
+ to_hash
379
+ end
380
+
381
+ # Returns the object in the form of hash
382
+ # @return [Hash] Returns the object in the form of hash
383
+ def to_hash
384
+ hash = {}
385
+ self.class.attribute_map.each_pair do |attr, param|
386
+ value = self.send(attr)
387
+ if value.nil?
388
+ is_nullable = self.class.openapi_nullable.include?(attr)
389
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
390
+ end
391
+
392
+ hash[param] = _to_hash(value)
393
+ end
394
+ hash
395
+ end
396
+
397
+ # Outputs non-array value in the form of hash
398
+ # For object, use to_hash. Otherwise, just return the value
399
+ # @param [Object] value Any valid value
400
+ # @return [Hash] Returns the value in the form of hash
401
+ def _to_hash(value)
402
+ if value.is_a?(Array)
403
+ value.compact.map { |v| _to_hash(v) }
404
+ elsif value.is_a?(Hash)
405
+ {}.tap do |hash|
406
+ value.each { |k, v| hash[k] = _to_hash(v) }
407
+ end
408
+ elsif value.respond_to? :to_hash
409
+ value.to_hash
410
+ else
411
+ value
412
+ end
413
+ end
414
+
415
+ end
416
+
417
+ end
@@ -0,0 +1,228 @@
1
+ =begin
2
+ #MX Platform API
3
+
4
+ #The MX Platform API is a powerful, fully-featured API designed to make aggregating and enhancing financial data easy and reliable. It can seamlessly connect your app or website to tens of thousands of financial institutions.
5
+
6
+ The version of the OpenAPI document: 0.1.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MxPlatformRuby
17
+ class AccountCreateRequestBody
18
+ attr_accessor :skip_webhook
19
+
20
+ attr_accessor :account
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'skip_webhook' => :'skip_webhook',
26
+ :'account' => :'account'
27
+ }
28
+ end
29
+
30
+ # Returns all the JSON keys this model knows about
31
+ def self.acceptable_attributes
32
+ attribute_map.values
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'skip_webhook' => :'Boolean',
39
+ :'account' => :'AccountCreateRequest'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ :'skip_webhook',
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::AccountCreateRequestBody` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MxPlatformRuby::AccountCreateRequestBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'skip_webhook')
66
+ self.skip_webhook = attributes[:'skip_webhook']
67
+ end
68
+
69
+ if attributes.key?(:'account')
70
+ self.account = attributes[:'account']
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ invalid_properties = Array.new
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ true
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(o)
90
+ return true if self.equal?(o)
91
+ self.class == o.class &&
92
+ skip_webhook == o.skip_webhook &&
93
+ account == o.account
94
+ end
95
+
96
+ # @see the `==` method
97
+ # @param [Object] Object to be compared
98
+ def eql?(o)
99
+ self == o
100
+ end
101
+
102
+ # Calculates hash code according to all attributes.
103
+ # @return [Integer] Hash code
104
+ def hash
105
+ [skip_webhook, account].hash
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def self.build_from_hash(attributes)
112
+ new.build_from_hash(attributes)
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def build_from_hash(attributes)
119
+ return nil unless attributes.is_a?(Hash)
120
+ self.class.openapi_types.each_pair do |key, type|
121
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
122
+ self.send("#{key}=", nil)
123
+ elsif type =~ /\AArray<(.*)>/i
124
+ # check to ensure the input is an array given that the attribute
125
+ # is documented as an array but the input is not
126
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
127
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
128
+ end
129
+ elsif !attributes[self.class.attribute_map[key]].nil?
130
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
131
+ end
132
+ end
133
+
134
+ self
135
+ end
136
+
137
+ # Deserializes the data based on type
138
+ # @param string type Data type
139
+ # @param string value Value to be deserialized
140
+ # @return [Object] Deserialized data
141
+ def _deserialize(type, value)
142
+ case type.to_sym
143
+ when :Time
144
+ Time.parse(value)
145
+ when :Date
146
+ Date.parse(value)
147
+ when :String
148
+ value.to_s
149
+ when :Integer
150
+ value.to_i
151
+ when :Float
152
+ value.to_f
153
+ when :Boolean
154
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
155
+ true
156
+ else
157
+ false
158
+ end
159
+ when :Object
160
+ # generic object (usually a Hash), return directly
161
+ value
162
+ when /\AArray<(?<inner_type>.+)>\z/
163
+ inner_type = Regexp.last_match[:inner_type]
164
+ value.map { |v| _deserialize(inner_type, v) }
165
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
166
+ k_type = Regexp.last_match[:k_type]
167
+ v_type = Regexp.last_match[:v_type]
168
+ {}.tap do |hash|
169
+ value.each do |k, v|
170
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
171
+ end
172
+ end
173
+ else # model
174
+ # models (e.g. Pet) or oneOf
175
+ klass = MxPlatformRuby.const_get(type)
176
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ if value.nil?
199
+ is_nullable = self.class.openapi_nullable.include?(attr)
200
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
201
+ end
202
+
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ hash
206
+ end
207
+
208
+ # Outputs non-array value in the form of hash
209
+ # For object, use to_hash. Otherwise, just return the value
210
+ # @param [Object] value Any valid value
211
+ # @return [Hash] Returns the value in the form of hash
212
+ def _to_hash(value)
213
+ if value.is_a?(Array)
214
+ value.compact.map { |v| _to_hash(v) }
215
+ elsif value.is_a?(Hash)
216
+ {}.tap do |hash|
217
+ value.each { |k, v| hash[k] = _to_hash(v) }
218
+ end
219
+ elsif value.respond_to? :to_hash
220
+ value.to_hash
221
+ else
222
+ value
223
+ end
224
+ end
225
+
226
+ end
227
+
228
+ end