mx-platform-ruby 0.17.0 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,503 @@
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_number
19
+
20
+ attr_accessor :apr
21
+
22
+ attr_accessor :apy
23
+
24
+ attr_accessor :available_balance
25
+
26
+ attr_accessor :available_credit
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 :day_payment_is_due
37
+
38
+ attr_accessor :death_benefit
39
+
40
+ attr_accessor :id
41
+
42
+ attr_accessor :interest_rate
43
+
44
+ attr_accessor :is_closed
45
+
46
+ attr_accessor :is_hidden
47
+
48
+ attr_accessor :last_payment
49
+
50
+ attr_accessor :last_payment_at
51
+
52
+ attr_accessor :loan_amount
53
+
54
+ attr_accessor :matures_on
55
+
56
+ attr_accessor :metadata
57
+
58
+ attr_accessor :minimum_balance
59
+
60
+ attr_accessor :minimum_payment
61
+
62
+ attr_accessor :name
63
+
64
+ attr_accessor :nickname
65
+
66
+ attr_accessor :original_balance
67
+
68
+ attr_accessor :payment_due_at
69
+
70
+ attr_accessor :payoff_balance
71
+
72
+ attr_accessor :routing_number
73
+
74
+ attr_accessor :started_on
75
+
76
+ attr_accessor :subtype
77
+
78
+ attr_accessor :type
79
+
80
+ # Attribute mapping from ruby-style variable name to JSON key.
81
+ def self.attribute_map
82
+ {
83
+ :'account_number' => :'account_number',
84
+ :'apr' => :'apr',
85
+ :'apy' => :'apy',
86
+ :'available_balance' => :'available_balance',
87
+ :'available_credit' => :'available_credit',
88
+ :'balance' => :'balance',
89
+ :'cash_surrender_value' => :'cash_surrender_value',
90
+ :'credit_limit' => :'credit_limit',
91
+ :'currency_code' => :'currency_code',
92
+ :'day_payment_is_due' => :'day_payment_is_due',
93
+ :'death_benefit' => :'death_benefit',
94
+ :'id' => :'id',
95
+ :'interest_rate' => :'interest_rate',
96
+ :'is_closed' => :'is_closed',
97
+ :'is_hidden' => :'is_hidden',
98
+ :'last_payment' => :'last_payment',
99
+ :'last_payment_at' => :'last_payment_at',
100
+ :'loan_amount' => :'loan_amount',
101
+ :'matures_on' => :'matures_on',
102
+ :'metadata' => :'metadata',
103
+ :'minimum_balance' => :'minimum_balance',
104
+ :'minimum_payment' => :'minimum_payment',
105
+ :'name' => :'name',
106
+ :'nickname' => :'nickname',
107
+ :'original_balance' => :'original_balance',
108
+ :'payment_due_at' => :'payment_due_at',
109
+ :'payoff_balance' => :'payoff_balance',
110
+ :'routing_number' => :'routing_number',
111
+ :'started_on' => :'started_on',
112
+ :'subtype' => :'subtype',
113
+ :'type' => :'type'
114
+ }
115
+ end
116
+
117
+ # Returns all the JSON keys this model knows about
118
+ def self.acceptable_attributes
119
+ attribute_map.values
120
+ end
121
+
122
+ # Attribute type mapping.
123
+ def self.openapi_types
124
+ {
125
+ :'account_number' => :'String',
126
+ :'apr' => :'Float',
127
+ :'apy' => :'Float',
128
+ :'available_balance' => :'Float',
129
+ :'available_credit' => :'Float',
130
+ :'balance' => :'Float',
131
+ :'cash_surrender_value' => :'Float',
132
+ :'credit_limit' => :'Float',
133
+ :'currency_code' => :'String',
134
+ :'day_payment_is_due' => :'Integer',
135
+ :'death_benefit' => :'Integer',
136
+ :'id' => :'String',
137
+ :'interest_rate' => :'Float',
138
+ :'is_closed' => :'Boolean',
139
+ :'is_hidden' => :'Boolean',
140
+ :'last_payment' => :'Float',
141
+ :'last_payment_at' => :'String',
142
+ :'loan_amount' => :'Float',
143
+ :'matures_on' => :'String',
144
+ :'metadata' => :'String',
145
+ :'minimum_balance' => :'Float',
146
+ :'minimum_payment' => :'Float',
147
+ :'name' => :'String',
148
+ :'nickname' => :'String',
149
+ :'original_balance' => :'Float',
150
+ :'payment_due_at' => :'String',
151
+ :'payoff_balance' => :'Float',
152
+ :'routing_number' => :'String',
153
+ :'started_on' => :'String',
154
+ :'subtype' => :'String',
155
+ :'type' => :'String'
156
+ }
157
+ end
158
+
159
+ # List of attributes with nullable: true
160
+ def self.openapi_nullable
161
+ Set.new([
162
+ ])
163
+ end
164
+
165
+ # Initializes the object
166
+ # @param [Hash] attributes Model attributes in the form of hash
167
+ def initialize(attributes = {})
168
+ if (!attributes.is_a?(Hash))
169
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::AccountCreateRequest` initialize method"
170
+ end
171
+
172
+ # check to see if the attribute exists and convert string to symbol for hash key
173
+ attributes = attributes.each_with_object({}) { |(k, v), h|
174
+ if (!self.class.attribute_map.key?(k.to_sym))
175
+ 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
176
+ end
177
+ h[k.to_sym] = v
178
+ }
179
+
180
+ if attributes.key?(:'account_number')
181
+ self.account_number = attributes[:'account_number']
182
+ end
183
+
184
+ if attributes.key?(:'apr')
185
+ self.apr = attributes[:'apr']
186
+ end
187
+
188
+ if attributes.key?(:'apy')
189
+ self.apy = attributes[:'apy']
190
+ end
191
+
192
+ if attributes.key?(:'available_balance')
193
+ self.available_balance = attributes[:'available_balance']
194
+ end
195
+
196
+ if attributes.key?(:'available_credit')
197
+ self.available_credit = attributes[:'available_credit']
198
+ end
199
+
200
+ if attributes.key?(:'balance')
201
+ self.balance = attributes[:'balance']
202
+ end
203
+
204
+ if attributes.key?(:'cash_surrender_value')
205
+ self.cash_surrender_value = attributes[:'cash_surrender_value']
206
+ end
207
+
208
+ if attributes.key?(:'credit_limit')
209
+ self.credit_limit = attributes[:'credit_limit']
210
+ end
211
+
212
+ if attributes.key?(:'currency_code')
213
+ self.currency_code = attributes[:'currency_code']
214
+ end
215
+
216
+ if attributes.key?(:'day_payment_is_due')
217
+ self.day_payment_is_due = attributes[:'day_payment_is_due']
218
+ end
219
+
220
+ if attributes.key?(:'death_benefit')
221
+ self.death_benefit = attributes[:'death_benefit']
222
+ end
223
+
224
+ if attributes.key?(:'id')
225
+ self.id = attributes[:'id']
226
+ end
227
+
228
+ if attributes.key?(:'interest_rate')
229
+ self.interest_rate = attributes[:'interest_rate']
230
+ end
231
+
232
+ if attributes.key?(:'is_closed')
233
+ self.is_closed = attributes[:'is_closed']
234
+ end
235
+
236
+ if attributes.key?(:'is_hidden')
237
+ self.is_hidden = attributes[:'is_hidden']
238
+ end
239
+
240
+ if attributes.key?(:'last_payment')
241
+ self.last_payment = attributes[:'last_payment']
242
+ end
243
+
244
+ if attributes.key?(:'last_payment_at')
245
+ self.last_payment_at = attributes[:'last_payment_at']
246
+ end
247
+
248
+ if attributes.key?(:'loan_amount')
249
+ self.loan_amount = attributes[:'loan_amount']
250
+ end
251
+
252
+ if attributes.key?(:'matures_on')
253
+ self.matures_on = attributes[:'matures_on']
254
+ end
255
+
256
+ if attributes.key?(:'metadata')
257
+ self.metadata = attributes[:'metadata']
258
+ end
259
+
260
+ if attributes.key?(:'minimum_balance')
261
+ self.minimum_balance = attributes[:'minimum_balance']
262
+ end
263
+
264
+ if attributes.key?(:'minimum_payment')
265
+ self.minimum_payment = attributes[:'minimum_payment']
266
+ end
267
+
268
+ if attributes.key?(:'name')
269
+ self.name = attributes[:'name']
270
+ end
271
+
272
+ if attributes.key?(:'nickname')
273
+ self.nickname = attributes[:'nickname']
274
+ end
275
+
276
+ if attributes.key?(:'original_balance')
277
+ self.original_balance = attributes[:'original_balance']
278
+ end
279
+
280
+ if attributes.key?(:'payment_due_at')
281
+ self.payment_due_at = attributes[:'payment_due_at']
282
+ end
283
+
284
+ if attributes.key?(:'payoff_balance')
285
+ self.payoff_balance = attributes[:'payoff_balance']
286
+ end
287
+
288
+ if attributes.key?(:'routing_number')
289
+ self.routing_number = attributes[:'routing_number']
290
+ end
291
+
292
+ if attributes.key?(:'started_on')
293
+ self.started_on = attributes[:'started_on']
294
+ end
295
+
296
+ if attributes.key?(:'subtype')
297
+ self.subtype = attributes[:'subtype']
298
+ end
299
+
300
+ if attributes.key?(:'type')
301
+ self.type = attributes[:'type']
302
+ end
303
+ end
304
+
305
+ # Show invalid properties with the reasons. Usually used together with valid?
306
+ # @return Array for valid properties with the reasons
307
+ def list_invalid_properties
308
+ invalid_properties = Array.new
309
+ if @balance.nil?
310
+ invalid_properties.push('invalid value for "balance", balance cannot be nil.')
311
+ end
312
+
313
+ if @name.nil?
314
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
315
+ end
316
+
317
+ if @type.nil?
318
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
319
+ end
320
+
321
+ invalid_properties
322
+ end
323
+
324
+ # Check to see if the all the properties in the model are valid
325
+ # @return true if the model is valid
326
+ def valid?
327
+ return false if @balance.nil?
328
+ return false if @name.nil?
329
+ return false if @type.nil?
330
+ true
331
+ end
332
+
333
+ # Checks equality by comparing each attribute.
334
+ # @param [Object] Object to be compared
335
+ def ==(o)
336
+ return true if self.equal?(o)
337
+ self.class == o.class &&
338
+ account_number == o.account_number &&
339
+ apr == o.apr &&
340
+ apy == o.apy &&
341
+ available_balance == o.available_balance &&
342
+ available_credit == o.available_credit &&
343
+ balance == o.balance &&
344
+ cash_surrender_value == o.cash_surrender_value &&
345
+ credit_limit == o.credit_limit &&
346
+ currency_code == o.currency_code &&
347
+ day_payment_is_due == o.day_payment_is_due &&
348
+ death_benefit == o.death_benefit &&
349
+ id == o.id &&
350
+ interest_rate == o.interest_rate &&
351
+ is_closed == o.is_closed &&
352
+ is_hidden == o.is_hidden &&
353
+ last_payment == o.last_payment &&
354
+ last_payment_at == o.last_payment_at &&
355
+ loan_amount == o.loan_amount &&
356
+ matures_on == o.matures_on &&
357
+ metadata == o.metadata &&
358
+ minimum_balance == o.minimum_balance &&
359
+ minimum_payment == o.minimum_payment &&
360
+ name == o.name &&
361
+ nickname == o.nickname &&
362
+ original_balance == o.original_balance &&
363
+ payment_due_at == o.payment_due_at &&
364
+ payoff_balance == o.payoff_balance &&
365
+ routing_number == o.routing_number &&
366
+ started_on == o.started_on &&
367
+ subtype == o.subtype &&
368
+ type == o.type
369
+ end
370
+
371
+ # @see the `==` method
372
+ # @param [Object] Object to be compared
373
+ def eql?(o)
374
+ self == o
375
+ end
376
+
377
+ # Calculates hash code according to all attributes.
378
+ # @return [Integer] Hash code
379
+ def hash
380
+ [account_number, apr, apy, available_balance, available_credit, balance, cash_surrender_value, credit_limit, currency_code, day_payment_is_due, death_benefit, id, interest_rate, is_closed, is_hidden, last_payment, last_payment_at, loan_amount, matures_on, metadata, minimum_balance, minimum_payment, name, nickname, original_balance, payment_due_at, payoff_balance, routing_number, started_on, subtype, type].hash
381
+ end
382
+
383
+ # Builds the object from hash
384
+ # @param [Hash] attributes Model attributes in the form of hash
385
+ # @return [Object] Returns the model itself
386
+ def self.build_from_hash(attributes)
387
+ new.build_from_hash(attributes)
388
+ end
389
+
390
+ # Builds the object from hash
391
+ # @param [Hash] attributes Model attributes in the form of hash
392
+ # @return [Object] Returns the model itself
393
+ def build_from_hash(attributes)
394
+ return nil unless attributes.is_a?(Hash)
395
+ self.class.openapi_types.each_pair do |key, type|
396
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
397
+ self.send("#{key}=", nil)
398
+ elsif type =~ /\AArray<(.*)>/i
399
+ # check to ensure the input is an array given that the attribute
400
+ # is documented as an array but the input is not
401
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
402
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
403
+ end
404
+ elsif !attributes[self.class.attribute_map[key]].nil?
405
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
406
+ end
407
+ end
408
+
409
+ self
410
+ end
411
+
412
+ # Deserializes the data based on type
413
+ # @param string type Data type
414
+ # @param string value Value to be deserialized
415
+ # @return [Object] Deserialized data
416
+ def _deserialize(type, value)
417
+ case type.to_sym
418
+ when :Time
419
+ Time.parse(value)
420
+ when :Date
421
+ Date.parse(value)
422
+ when :String
423
+ value.to_s
424
+ when :Integer
425
+ value.to_i
426
+ when :Float
427
+ value.to_f
428
+ when :Boolean
429
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
430
+ true
431
+ else
432
+ false
433
+ end
434
+ when :Object
435
+ # generic object (usually a Hash), return directly
436
+ value
437
+ when /\AArray<(?<inner_type>.+)>\z/
438
+ inner_type = Regexp.last_match[:inner_type]
439
+ value.map { |v| _deserialize(inner_type, v) }
440
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
441
+ k_type = Regexp.last_match[:k_type]
442
+ v_type = Regexp.last_match[:v_type]
443
+ {}.tap do |hash|
444
+ value.each do |k, v|
445
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
446
+ end
447
+ end
448
+ else # model
449
+ # models (e.g. Pet) or oneOf
450
+ klass = MxPlatformRuby.const_get(type)
451
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
452
+ end
453
+ end
454
+
455
+ # Returns the string representation of the object
456
+ # @return [String] String presentation of the object
457
+ def to_s
458
+ to_hash.to_s
459
+ end
460
+
461
+ # to_body is an alias to to_hash (backward compatibility)
462
+ # @return [Hash] Returns the object in the form of hash
463
+ def to_body
464
+ to_hash
465
+ end
466
+
467
+ # Returns the object in the form of hash
468
+ # @return [Hash] Returns the object in the form of hash
469
+ def to_hash
470
+ hash = {}
471
+ self.class.attribute_map.each_pair do |attr, param|
472
+ value = self.send(attr)
473
+ if value.nil?
474
+ is_nullable = self.class.openapi_nullable.include?(attr)
475
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
476
+ end
477
+
478
+ hash[param] = _to_hash(value)
479
+ end
480
+ hash
481
+ end
482
+
483
+ # Outputs non-array value in the form of hash
484
+ # For object, use to_hash. Otherwise, just return the value
485
+ # @param [Object] value Any valid value
486
+ # @return [Hash] Returns the value in the form of hash
487
+ def _to_hash(value)
488
+ if value.is_a?(Array)
489
+ value.compact.map { |v| _to_hash(v) }
490
+ elsif value.is_a?(Hash)
491
+ {}.tap do |hash|
492
+ value.each { |k, v| hash[k] = _to_hash(v) }
493
+ end
494
+ elsif value.respond_to? :to_hash
495
+ value.to_hash
496
+ else
497
+ value
498
+ end
499
+ end
500
+
501
+ end
502
+
503
+ end