mx-platform-ruby 0.37.0 → 0.39.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,335 @@
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: 7.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MxPlatformRuby
17
+ class CreditCardProduct
18
+ attr_accessor :annual_fee
19
+
20
+ attr_accessor :duration_of_introductory_rate_on_balance_transfer
21
+
22
+ attr_accessor :duration_of_introductory_rate_on_purchases
23
+
24
+ attr_accessor :guid
25
+
26
+ attr_accessor :has_cashback_rewards
27
+
28
+ attr_accessor :has_other_rewards
29
+
30
+ attr_accessor :has_travel_rewards
31
+
32
+ attr_accessor :has_zero_introductory_annual_fee
33
+
34
+ attr_accessor :has_zero_percent_introductory_rate
35
+
36
+ attr_accessor :has_zero_percent_introductory_rate_on_balance_transfer
37
+
38
+ attr_accessor :financial_institution
39
+
40
+ attr_accessor :is_accepting_applications
41
+
42
+ attr_accessor :is_small_business_card
43
+
44
+ attr_accessor :name
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'annual_fee' => :'annual_fee',
50
+ :'duration_of_introductory_rate_on_balance_transfer' => :'duration_of_introductory_rate_on_balance_transfer',
51
+ :'duration_of_introductory_rate_on_purchases' => :'duration_of_introductory_rate_on_purchases',
52
+ :'guid' => :'guid',
53
+ :'has_cashback_rewards' => :'has_cashback_rewards',
54
+ :'has_other_rewards' => :'has_other_rewards',
55
+ :'has_travel_rewards' => :'has_travel_rewards',
56
+ :'has_zero_introductory_annual_fee' => :'has_zero_introductory_annual_fee',
57
+ :'has_zero_percent_introductory_rate' => :'has_zero_percent_introductory_rate',
58
+ :'has_zero_percent_introductory_rate_on_balance_transfer' => :'has_zero_percent_introductory_rate_on_balance_transfer',
59
+ :'financial_institution' => :'financial_institution',
60
+ :'is_accepting_applications' => :'is_accepting_applications',
61
+ :'is_small_business_card' => :'is_small_business_card',
62
+ :'name' => :'name'
63
+ }
64
+ end
65
+
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ attribute_map.values
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.openapi_types
73
+ {
74
+ :'annual_fee' => :'Object',
75
+ :'duration_of_introductory_rate_on_balance_transfer' => :'Object',
76
+ :'duration_of_introductory_rate_on_purchases' => :'Object',
77
+ :'guid' => :'Object',
78
+ :'has_cashback_rewards' => :'Boolean',
79
+ :'has_other_rewards' => :'Boolean',
80
+ :'has_travel_rewards' => :'Boolean',
81
+ :'has_zero_introductory_annual_fee' => :'Boolean',
82
+ :'has_zero_percent_introductory_rate' => :'Boolean',
83
+ :'has_zero_percent_introductory_rate_on_balance_transfer' => :'Boolean',
84
+ :'financial_institution' => :'Boolean',
85
+ :'is_accepting_applications' => :'Boolean',
86
+ :'is_small_business_card' => :'Boolean',
87
+ :'name' => :'String'
88
+ }
89
+ end
90
+
91
+ # List of attributes with nullable: true
92
+ def self.openapi_nullable
93
+ Set.new([
94
+ :'annual_fee',
95
+ :'duration_of_introductory_rate_on_balance_transfer',
96
+ :'duration_of_introductory_rate_on_purchases',
97
+ :'guid',
98
+ ])
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::CreditCardProduct` initialize method"
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ attributes = attributes.each_with_object({}) { |(k, v), h|
110
+ if (!self.class.attribute_map.key?(k.to_sym))
111
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MxPlatformRuby::CreditCardProduct`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
112
+ end
113
+ h[k.to_sym] = v
114
+ }
115
+
116
+ if attributes.key?(:'annual_fee')
117
+ self.annual_fee = attributes[:'annual_fee']
118
+ end
119
+
120
+ if attributes.key?(:'duration_of_introductory_rate_on_balance_transfer')
121
+ self.duration_of_introductory_rate_on_balance_transfer = attributes[:'duration_of_introductory_rate_on_balance_transfer']
122
+ end
123
+
124
+ if attributes.key?(:'duration_of_introductory_rate_on_purchases')
125
+ self.duration_of_introductory_rate_on_purchases = attributes[:'duration_of_introductory_rate_on_purchases']
126
+ end
127
+
128
+ if attributes.key?(:'guid')
129
+ self.guid = attributes[:'guid']
130
+ end
131
+
132
+ if attributes.key?(:'has_cashback_rewards')
133
+ self.has_cashback_rewards = attributes[:'has_cashback_rewards']
134
+ end
135
+
136
+ if attributes.key?(:'has_other_rewards')
137
+ self.has_other_rewards = attributes[:'has_other_rewards']
138
+ end
139
+
140
+ if attributes.key?(:'has_travel_rewards')
141
+ self.has_travel_rewards = attributes[:'has_travel_rewards']
142
+ end
143
+
144
+ if attributes.key?(:'has_zero_introductory_annual_fee')
145
+ self.has_zero_introductory_annual_fee = attributes[:'has_zero_introductory_annual_fee']
146
+ end
147
+
148
+ if attributes.key?(:'has_zero_percent_introductory_rate')
149
+ self.has_zero_percent_introductory_rate = attributes[:'has_zero_percent_introductory_rate']
150
+ end
151
+
152
+ if attributes.key?(:'has_zero_percent_introductory_rate_on_balance_transfer')
153
+ self.has_zero_percent_introductory_rate_on_balance_transfer = attributes[:'has_zero_percent_introductory_rate_on_balance_transfer']
154
+ end
155
+
156
+ if attributes.key?(:'financial_institution')
157
+ self.financial_institution = attributes[:'financial_institution']
158
+ end
159
+
160
+ if attributes.key?(:'is_accepting_applications')
161
+ self.is_accepting_applications = attributes[:'is_accepting_applications']
162
+ end
163
+
164
+ if attributes.key?(:'is_small_business_card')
165
+ self.is_small_business_card = attributes[:'is_small_business_card']
166
+ end
167
+
168
+ if attributes.key?(:'name')
169
+ self.name = attributes[:'name']
170
+ end
171
+ end
172
+
173
+ # Show invalid properties with the reasons. Usually used together with valid?
174
+ # @return Array for valid properties with the reasons
175
+ def list_invalid_properties
176
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
177
+ invalid_properties = Array.new
178
+ invalid_properties
179
+ end
180
+
181
+ # Check to see if the all the properties in the model are valid
182
+ # @return true if the model is valid
183
+ def valid?
184
+ warn '[DEPRECATED] the `valid?` method is obsolete'
185
+ true
186
+ end
187
+
188
+ # Checks equality by comparing each attribute.
189
+ # @param [Object] Object to be compared
190
+ def ==(o)
191
+ return true if self.equal?(o)
192
+ self.class == o.class &&
193
+ annual_fee == o.annual_fee &&
194
+ duration_of_introductory_rate_on_balance_transfer == o.duration_of_introductory_rate_on_balance_transfer &&
195
+ duration_of_introductory_rate_on_purchases == o.duration_of_introductory_rate_on_purchases &&
196
+ guid == o.guid &&
197
+ has_cashback_rewards == o.has_cashback_rewards &&
198
+ has_other_rewards == o.has_other_rewards &&
199
+ has_travel_rewards == o.has_travel_rewards &&
200
+ has_zero_introductory_annual_fee == o.has_zero_introductory_annual_fee &&
201
+ has_zero_percent_introductory_rate == o.has_zero_percent_introductory_rate &&
202
+ has_zero_percent_introductory_rate_on_balance_transfer == o.has_zero_percent_introductory_rate_on_balance_transfer &&
203
+ financial_institution == o.financial_institution &&
204
+ is_accepting_applications == o.is_accepting_applications &&
205
+ is_small_business_card == o.is_small_business_card &&
206
+ name == o.name
207
+ end
208
+
209
+ # @see the `==` method
210
+ # @param [Object] Object to be compared
211
+ def eql?(o)
212
+ self == o
213
+ end
214
+
215
+ # Calculates hash code according to all attributes.
216
+ # @return [Integer] Hash code
217
+ def hash
218
+ [annual_fee, duration_of_introductory_rate_on_balance_transfer, duration_of_introductory_rate_on_purchases, guid, has_cashback_rewards, has_other_rewards, has_travel_rewards, has_zero_introductory_annual_fee, has_zero_percent_introductory_rate, has_zero_percent_introductory_rate_on_balance_transfer, financial_institution, is_accepting_applications, is_small_business_card, name].hash
219
+ end
220
+
221
+ # Builds the object from hash
222
+ # @param [Hash] attributes Model attributes in the form of hash
223
+ # @return [Object] Returns the model itself
224
+ def self.build_from_hash(attributes)
225
+ return nil unless attributes.is_a?(Hash)
226
+ attributes = attributes.transform_keys(&:to_sym)
227
+ transformed_hash = {}
228
+ openapi_types.each_pair do |key, type|
229
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
230
+ transformed_hash["#{key}"] = nil
231
+ elsif type =~ /\AArray<(.*)>/i
232
+ # check to ensure the input is an array given that the attribute
233
+ # is documented as an array but the input is not
234
+ if attributes[attribute_map[key]].is_a?(Array)
235
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
236
+ end
237
+ elsif !attributes[attribute_map[key]].nil?
238
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
239
+ end
240
+ end
241
+ new(transformed_hash)
242
+ end
243
+
244
+ # Deserializes the data based on type
245
+ # @param string type Data type
246
+ # @param string value Value to be deserialized
247
+ # @return [Object] Deserialized data
248
+ def self._deserialize(type, value)
249
+ case type.to_sym
250
+ when :Time
251
+ Time.parse(value)
252
+ when :Date
253
+ Date.parse(value)
254
+ when :String
255
+ value.to_s
256
+ when :Integer
257
+ value.to_i
258
+ when :Float
259
+ value.to_f
260
+ when :Boolean
261
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
262
+ true
263
+ else
264
+ false
265
+ end
266
+ when :Object
267
+ # generic object (usually a Hash), return directly
268
+ value
269
+ when /\AArray<(?<inner_type>.+)>\z/
270
+ inner_type = Regexp.last_match[:inner_type]
271
+ value.map { |v| _deserialize(inner_type, v) }
272
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
273
+ k_type = Regexp.last_match[:k_type]
274
+ v_type = Regexp.last_match[:v_type]
275
+ {}.tap do |hash|
276
+ value.each do |k, v|
277
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
278
+ end
279
+ end
280
+ else # model
281
+ # models (e.g. Pet) or oneOf
282
+ klass = MxPlatformRuby.const_get(type)
283
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
284
+ end
285
+ end
286
+
287
+ # Returns the string representation of the object
288
+ # @return [String] String presentation of the object
289
+ def to_s
290
+ to_hash.to_s
291
+ end
292
+
293
+ # to_body is an alias to to_hash (backward compatibility)
294
+ # @return [Hash] Returns the object in the form of hash
295
+ def to_body
296
+ to_hash
297
+ end
298
+
299
+ # Returns the object in the form of hash
300
+ # @return [Hash] Returns the object in the form of hash
301
+ def to_hash
302
+ hash = {}
303
+ self.class.attribute_map.each_pair do |attr, param|
304
+ value = self.send(attr)
305
+ if value.nil?
306
+ is_nullable = self.class.openapi_nullable.include?(attr)
307
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
308
+ end
309
+
310
+ hash[param] = _to_hash(value)
311
+ end
312
+ hash
313
+ end
314
+
315
+ # Outputs non-array value in the form of hash
316
+ # For object, use to_hash. Otherwise, just return the value
317
+ # @param [Object] value Any valid value
318
+ # @return [Hash] Returns the value in the form of hash
319
+ def _to_hash(value)
320
+ if value.is_a?(Array)
321
+ value.compact.map { |v| _to_hash(v) }
322
+ elsif value.is_a?(Hash)
323
+ {}.tap do |hash|
324
+ value.each { |k, v| hash[k] = _to_hash(v) }
325
+ end
326
+ elsif value.respond_to? :to_hash
327
+ value.to_hash
328
+ else
329
+ value
330
+ end
331
+ end
332
+
333
+ end
334
+
335
+ end
@@ -0,0 +1,214 @@
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: 7.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MxPlatformRuby
17
+ class CreditCardProductResponse
18
+ attr_accessor :reward
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'reward' => :'reward'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'reward' => :'CreditCardProduct'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MxPlatformRuby::CreditCardProductResponse` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MxPlatformRuby::CreditCardProductResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'reward')
61
+ self.reward = attributes[:'reward']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
69
+ invalid_properties = Array.new
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ warn '[DEPRECATED] the `valid?` method is obsolete'
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ reward == o.reward
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Integer] Hash code
96
+ def hash
97
+ [reward].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def self.build_from_hash(attributes)
104
+ return nil unless attributes.is_a?(Hash)
105
+ attributes = attributes.transform_keys(&:to_sym)
106
+ transformed_hash = {}
107
+ openapi_types.each_pair do |key, type|
108
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
109
+ transformed_hash["#{key}"] = nil
110
+ elsif type =~ /\AArray<(.*)>/i
111
+ # check to ensure the input is an array given that the attribute
112
+ # is documented as an array but the input is not
113
+ if attributes[attribute_map[key]].is_a?(Array)
114
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
115
+ end
116
+ elsif !attributes[attribute_map[key]].nil?
117
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
118
+ end
119
+ end
120
+ new(transformed_hash)
121
+ end
122
+
123
+ # Deserializes the data based on type
124
+ # @param string type Data type
125
+ # @param string value Value to be deserialized
126
+ # @return [Object] Deserialized data
127
+ def self._deserialize(type, value)
128
+ case type.to_sym
129
+ when :Time
130
+ Time.parse(value)
131
+ when :Date
132
+ Date.parse(value)
133
+ when :String
134
+ value.to_s
135
+ when :Integer
136
+ value.to_i
137
+ when :Float
138
+ value.to_f
139
+ when :Boolean
140
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
141
+ true
142
+ else
143
+ false
144
+ end
145
+ when :Object
146
+ # generic object (usually a Hash), return directly
147
+ value
148
+ when /\AArray<(?<inner_type>.+)>\z/
149
+ inner_type = Regexp.last_match[:inner_type]
150
+ value.map { |v| _deserialize(inner_type, v) }
151
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
152
+ k_type = Regexp.last_match[:k_type]
153
+ v_type = Regexp.last_match[:v_type]
154
+ {}.tap do |hash|
155
+ value.each do |k, v|
156
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
157
+ end
158
+ end
159
+ else # model
160
+ # models (e.g. Pet) or oneOf
161
+ klass = MxPlatformRuby.const_get(type)
162
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ if value.nil?
185
+ is_nullable = self.class.openapi_nullable.include?(attr)
186
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
187
+ end
188
+
189
+ hash[param] = _to_hash(value)
190
+ end
191
+ hash
192
+ end
193
+
194
+ # Outputs non-array value in the form of hash
195
+ # For object, use to_hash. Otherwise, just return the value
196
+ # @param [Object] value Any valid value
197
+ # @return [Hash] Returns the value in the form of hash
198
+ def _to_hash(value)
199
+ if value.is_a?(Array)
200
+ value.compact.map { |v| _to_hash(v) }
201
+ elsif value.is_a?(Hash)
202
+ {}.tap do |hash|
203
+ value.each { |k, v| hash[k] = _to_hash(v) }
204
+ end
205
+ elsif value.respond_to? :to_hash
206
+ value.to_hash
207
+ else
208
+ value
209
+ end
210
+ end
211
+
212
+ end
213
+
214
+ end