moneykit 0.1.6 → 0.1.9

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.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +1 -1
  4. data/docs/AccessTokenApi.md +4 -4
  5. data/docs/AccountNumbersApi.md +12 -12
  6. data/docs/AccountNumbersLegacy20230218.md +24 -0
  7. data/docs/AccountWithAccountNumbersLegacy20230218.md +28 -0
  8. data/docs/AccountsApi.md +20 -20
  9. data/docs/AppClientResponse.md +26 -0
  10. data/docs/AppResponse.md +24 -0
  11. data/docs/CreateLinkSessionRequest.md +2 -2
  12. data/docs/GetAccountNumbersResponseLegacy20230218.md +20 -0
  13. data/docs/IdentityApi.md +1 -1
  14. data/docs/Institution.md +1 -1
  15. data/docs/InstitutionsApi.md +2 -2
  16. data/docs/InvestmentTransactionResponse.md +4 -4
  17. data/docs/InvestmentsApi.md +2 -2
  18. data/docs/LinkProduct.md +28 -0
  19. data/docs/LinkProducts.md +4 -4
  20. data/docs/LinksApi.md +5 -5
  21. data/docs/MoneyKitConnectFeatures.md +3 -1
  22. data/docs/ProductSettings.md +24 -0
  23. data/docs/ProductsApi.md +1 -1
  24. data/docs/ProductsSettings.md +3 -3
  25. data/docs/RequestedLinkPermission.md +2 -2
  26. data/docs/Response401GetAccountNumbersLegacy20230218LinksIdAccountsNumbersGet.md +22 -0
  27. data/docs/SecurityResponse.md +2 -2
  28. data/docs/TransactionsApi.md +5 -5
  29. data/docs/TransactionsLinkProduct.md +6 -4
  30. data/docs/TransactionsProductSettings.md +4 -2
  31. data/docs/UsersApi.md +7 -7
  32. data/docs/WebhooksApi.md +1 -1
  33. data/lib/moneykit/api/access_token_api.rb +3 -3
  34. data/lib/moneykit/api/account_numbers_api.rb +10 -10
  35. data/lib/moneykit/api/accounts_api.rb +16 -16
  36. data/lib/moneykit/api/investments_api.rb +2 -2
  37. data/lib/moneykit/api/transactions_api.rb +6 -6
  38. data/lib/moneykit/api/users_api.rb +8 -8
  39. data/lib/moneykit/models/account_numbers_legacy20230218.rb +275 -0
  40. data/lib/moneykit/models/account_with_account_numbers_legacy20230218.rb +296 -0
  41. data/lib/moneykit/models/app_client_response.rb +281 -0
  42. data/lib/moneykit/models/app_response.rb +272 -0
  43. data/lib/moneykit/models/create_link_session_request.rb +2 -2
  44. data/lib/moneykit/models/get_account_numbers_response_legacy20230218.rb +237 -0
  45. data/lib/moneykit/models/institution.rb +1 -1
  46. data/lib/moneykit/models/investment_transaction_response.rb +13 -13
  47. data/lib/moneykit/models/link_product.rb +283 -0
  48. data/lib/moneykit/models/link_product_failure_reasons.rb +2 -1
  49. data/lib/moneykit/models/link_products.rb +4 -4
  50. data/lib/moneykit/models/money_kit_connect_features.rb +16 -4
  51. data/lib/moneykit/models/product_settings.rb +249 -0
  52. data/lib/moneykit/models/products_settings.rb +3 -3
  53. data/lib/moneykit/models/requested_link_permission.rb +2 -2
  54. data/lib/moneykit/models/response401_get_account_numbers_legacy20230218_links_id_accounts_numbers_get.rb +104 -0
  55. data/lib/moneykit/models/security_response.rb +11 -11
  56. data/lib/moneykit/models/transactions_link_product.rb +22 -18
  57. data/lib/moneykit/models/transactions_product_settings.rb +20 -10
  58. data/lib/moneykit/version.rb +1 -1
  59. data/lib/moneykit.rb +8 -14
  60. data/spec/models/account_numbers_legacy20230218_spec.rb +54 -0
  61. data/spec/models/account_with_account_numbers_legacy20230218_spec.rb +66 -0
  62. data/spec/models/app_client_response_spec.rb +60 -0
  63. data/spec/models/app_response_spec.rb +54 -0
  64. data/spec/models/get_account_numbers_response_legacy20230218_spec.rb +42 -0
  65. data/spec/models/link_product_spec.rb +66 -0
  66. data/spec/models/product_settings_spec.rb +54 -0
  67. data/spec/models/response401_get_account_numbers_legacy20230218_links_id_accounts_numbers_get_spec.rb +21 -0
  68. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/byebug/byebug.so +0 -0
  69. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/gem_make.out +5 -5
  70. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
  71. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/jaro_winkler/jaro_winkler_ext.so +0 -0
  72. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.1.1/gem_make.out +5 -5
  73. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.1.1/psych.so +0 -0
  74. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.7.3/gem_make.out +5 -5
  75. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.7.3/racc/cparse.so +0 -0
  76. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.0/gem_make.out +5 -5
  77. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.0/stringio.so +0 -0
  78. data/vendor/bundle/ruby/3.2.0/gems/byebug-11.1.3/lib/byebug/byebug.so +0 -0
  79. data/vendor/bundle/ruby/3.2.0/gems/jaro_winkler-1.5.6/lib/jaro_winkler/jaro_winkler_ext.so +0 -0
  80. data/vendor/bundle/ruby/3.2.0/gems/psych-5.1.1.1/lib/psych.so +0 -0
  81. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.3/lib/racc/cparse.so +0 -0
  82. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.1.0/lib/stringio.so +0 -0
  83. metadata +143 -111
@@ -0,0 +1,237 @@
1
+ =begin
2
+ #MoneyKit API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2023-02-18
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.1.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MoneyKit
17
+ class GetAccountNumbersResponseLegacy20230218
18
+ attr_accessor :accounts
19
+
20
+ attr_accessor :link
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'accounts' => :'accounts',
26
+ :'link' => :'link'
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
+ :'accounts' => :'Array<AccountWithAccountNumbersLegacy20230218>',
39
+ :'link' => :'LinkCommon'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MoneyKit::GetAccountNumbersResponseLegacy20230218` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MoneyKit::GetAccountNumbersResponseLegacy20230218`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'accounts')
65
+ if (value = attributes[:'accounts']).is_a?(Array)
66
+ self.accounts = value
67
+ end
68
+ else
69
+ self.accounts = nil
70
+ end
71
+
72
+ if attributes.key?(:'link')
73
+ self.link = attributes[:'link']
74
+ else
75
+ self.link = nil
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
83
+ invalid_properties = Array.new
84
+ if @accounts.nil?
85
+ invalid_properties.push('invalid value for "accounts", accounts cannot be nil.')
86
+ end
87
+
88
+ if @link.nil?
89
+ invalid_properties.push('invalid value for "link", link cannot be nil.')
90
+ end
91
+
92
+ invalid_properties
93
+ end
94
+
95
+ # Check to see if the all the properties in the model are valid
96
+ # @return true if the model is valid
97
+ def valid?
98
+ warn '[DEPRECATED] the `valid?` method is obsolete'
99
+ return false if @accounts.nil?
100
+ return false if @link.nil?
101
+ true
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ accounts == o.accounts &&
110
+ link == o.link
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [accounts, link].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ attributes = attributes.transform_keys(&:to_sym)
131
+ transformed_hash = {}
132
+ openapi_types.each_pair do |key, type|
133
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = nil
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[attribute_map[key]].is_a?(Array)
139
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
140
+ end
141
+ elsif !attributes[attribute_map[key]].nil?
142
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
143
+ end
144
+ end
145
+ new(transformed_hash)
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def self._deserialize(type, value)
153
+ case type.to_sym
154
+ when :Time
155
+ Time.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :Boolean
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ # models (e.g. Pet) or oneOf
186
+ klass = MoneyKit.const_get(type)
187
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+ end
237
+ end
@@ -25,7 +25,7 @@ module MoneyKit
25
25
 
26
26
  attr_accessor :country
27
27
 
28
- # The domain of the institution's customer-facing website.
28
+ # The domain of the institution's user-facing website.
29
29
  attr_accessor :domain
30
30
 
31
31
  # The primary color of this institution, represented as hexcode.
@@ -16,12 +16,12 @@ require 'time'
16
16
  module MoneyKit
17
17
  class InvestmentTransactionResponse
18
18
  # The unique ID for this investment transaction.
19
- attr_accessor :id
19
+ attr_accessor :investment_transaction_id
20
20
 
21
21
  # The ID of the account in which this investment transaction occurred.
22
22
  attr_accessor :account_id
23
23
 
24
- # The total value of this transaction, denominated in account currency. Positive values indicate debits (deposits); negative values are credits (withdrawals). For example, for a `buy` transaction, the amount will be equal to `-(quantity * price + fees)`.
24
+ # The total value of this transaction, denominated in account currency. Positive values indicate debits (withdrawals); negative values are credits (deposits). When a transaction has both quantity and price, the amount should be equal to `quantity * price + fees`.
25
25
  attr_accessor :amount
26
26
 
27
27
  # The effective (posted) date of the transaction, in ISO-8601 format.
@@ -36,7 +36,7 @@ module MoneyKit
36
36
  # The type of transaction (buy, sell, cash, fee, transfer). May include a dotted subtype, for example, `buy.buy_to_cover` or `fee.transfer_fee`.
37
37
  attr_accessor :type
38
38
 
39
- # The combined value of any fees applied to the transaction. Fees are subtracted from the total transaction amount, and are reported as positive values; refunds are reported as negative values.
39
+ # The combined value of any fees applied to the transaction. Fees are reported as positive values; refunds are reported as negative values.
40
40
  attr_accessor :fees
41
41
 
42
42
  # The currency exchange rate applied. Only present for transactions involving a security that is denominated in a currency other than the account currency.
@@ -54,7 +54,7 @@ module MoneyKit
54
54
  # Attribute mapping from ruby-style variable name to JSON key.
55
55
  def self.attribute_map
56
56
  {
57
- :'id' => :'id',
57
+ :'investment_transaction_id' => :'investment_transaction_id',
58
58
  :'account_id' => :'account_id',
59
59
  :'amount' => :'amount',
60
60
  :'date' => :'date',
@@ -77,7 +77,7 @@ module MoneyKit
77
77
  # Attribute type mapping.
78
78
  def self.openapi_types
79
79
  {
80
- :'id' => :'String',
80
+ :'investment_transaction_id' => :'String',
81
81
  :'account_id' => :'String',
82
82
  :'amount' => :'String',
83
83
  :'date' => :'Date',
@@ -113,10 +113,10 @@ module MoneyKit
113
113
  h[k.to_sym] = v
114
114
  }
115
115
 
116
- if attributes.key?(:'id')
117
- self.id = attributes[:'id']
116
+ if attributes.key?(:'investment_transaction_id')
117
+ self.investment_transaction_id = attributes[:'investment_transaction_id']
118
118
  else
119
- self.id = nil
119
+ self.investment_transaction_id = nil
120
120
  end
121
121
 
122
122
  if attributes.key?(:'account_id')
@@ -179,8 +179,8 @@ module MoneyKit
179
179
  def list_invalid_properties
180
180
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
181
181
  invalid_properties = Array.new
182
- if @id.nil?
183
- invalid_properties.push('invalid value for "id", id cannot be nil.')
182
+ if @investment_transaction_id.nil?
183
+ invalid_properties.push('invalid value for "investment_transaction_id", investment_transaction_id cannot be nil.')
184
184
  end
185
185
 
186
186
  if @account_id.nil?
@@ -210,7 +210,7 @@ module MoneyKit
210
210
  # @return true if the model is valid
211
211
  def valid?
212
212
  warn '[DEPRECATED] the `valid?` method is obsolete'
213
- return false if @id.nil?
213
+ return false if @investment_transaction_id.nil?
214
214
  return false if @account_id.nil?
215
215
  return false if @amount.nil?
216
216
  return false if @date.nil?
@@ -224,7 +224,7 @@ module MoneyKit
224
224
  def ==(o)
225
225
  return true if self.equal?(o)
226
226
  self.class == o.class &&
227
- id == o.id &&
227
+ investment_transaction_id == o.investment_transaction_id &&
228
228
  account_id == o.account_id &&
229
229
  amount == o.amount &&
230
230
  date == o.date &&
@@ -247,7 +247,7 @@ module MoneyKit
247
247
  # Calculates hash code according to all attributes.
248
248
  # @return [Integer] Hash code
249
249
  def hash
250
- [id, account_id, amount, date, datetime, description, type, fees, forex_rate, price, quantity, security_id].hash
250
+ [investment_transaction_id, account_id, amount, date, datetime, description, type, fees, forex_rate, price, quantity, security_id].hash
251
251
  end
252
252
 
253
253
  # Builds the object from hash
@@ -0,0 +1,283 @@
1
+ =begin
2
+ #MoneyKit API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2023-02-18
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.1.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MoneyKit
17
+ class LinkProduct
18
+ # An ISO-8601 timestamp indicating the last time that the product was updated.
19
+ attr_accessor :refreshed_at
20
+
21
+ # An ISO-8601 timestamp indicating the last time that the product was attempted.
22
+ attr_accessor :last_attempted_at
23
+
24
+ attr_accessor :error_code
25
+
26
+ # The error message, if the last attempt to refresh the product failed.
27
+ attr_accessor :error_message
28
+
29
+ # If this product can't currently be updated, the reason why it is unavailable. <p>Unavailable products can't be refreshed, but past data, if any, is still accessible.
30
+ attr_accessor :unavailable
31
+
32
+ attr_accessor :settings
33
+
34
+ class EnumAttributeValidator
35
+ attr_reader :datatype
36
+ attr_reader :allowable_values
37
+
38
+ def initialize(datatype, allowable_values)
39
+ @allowable_values = allowable_values.map do |value|
40
+ case datatype.to_s
41
+ when /Integer/i
42
+ value.to_i
43
+ when /Float/i
44
+ value.to_f
45
+ else
46
+ value
47
+ end
48
+ end
49
+ end
50
+
51
+ def valid?(value)
52
+ !value || allowable_values.include?(value)
53
+ end
54
+ end
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'refreshed_at' => :'refreshed_at',
60
+ :'last_attempted_at' => :'last_attempted_at',
61
+ :'error_code' => :'error_code',
62
+ :'error_message' => :'error_message',
63
+ :'unavailable' => :'unavailable',
64
+ :'settings' => :'settings'
65
+ }
66
+ end
67
+
68
+ # Returns all the JSON keys this model knows about
69
+ def self.acceptable_attributes
70
+ attribute_map.values
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'refreshed_at' => :'Time',
77
+ :'last_attempted_at' => :'Time',
78
+ :'error_code' => :'LinkProductFailureReasons',
79
+ :'error_message' => :'String',
80
+ :'unavailable' => :'String',
81
+ :'settings' => :'ProductSettings'
82
+ }
83
+ end
84
+
85
+ # List of attributes with nullable: true
86
+ def self.openapi_nullable
87
+ Set.new([
88
+ ])
89
+ end
90
+
91
+ # Initializes the object
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ def initialize(attributes = {})
94
+ if (!attributes.is_a?(Hash))
95
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MoneyKit::LinkProduct` initialize method"
96
+ end
97
+
98
+ # check to see if the attribute exists and convert string to symbol for hash key
99
+ attributes = attributes.each_with_object({}) { |(k, v), h|
100
+ if (!self.class.attribute_map.key?(k.to_sym))
101
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MoneyKit::LinkProduct`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
102
+ end
103
+ h[k.to_sym] = v
104
+ }
105
+
106
+ if attributes.key?(:'refreshed_at')
107
+ self.refreshed_at = attributes[:'refreshed_at']
108
+ end
109
+
110
+ if attributes.key?(:'last_attempted_at')
111
+ self.last_attempted_at = attributes[:'last_attempted_at']
112
+ end
113
+
114
+ if attributes.key?(:'error_code')
115
+ self.error_code = attributes[:'error_code']
116
+ end
117
+
118
+ if attributes.key?(:'error_message')
119
+ self.error_message = attributes[:'error_message']
120
+ end
121
+
122
+ if attributes.key?(:'unavailable')
123
+ self.unavailable = attributes[:'unavailable']
124
+ end
125
+
126
+ if attributes.key?(:'settings')
127
+ self.settings = attributes[:'settings']
128
+ end
129
+ end
130
+
131
+ # Show invalid properties with the reasons. Usually used together with valid?
132
+ # @return Array for valid properties with the reasons
133
+ def list_invalid_properties
134
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
135
+ invalid_properties = Array.new
136
+ invalid_properties
137
+ end
138
+
139
+ # Check to see if the all the properties in the model are valid
140
+ # @return true if the model is valid
141
+ def valid?
142
+ warn '[DEPRECATED] the `valid?` method is obsolete'
143
+ true
144
+ end
145
+
146
+ # Checks equality by comparing each attribute.
147
+ # @param [Object] Object to be compared
148
+ def ==(o)
149
+ return true if self.equal?(o)
150
+ self.class == o.class &&
151
+ refreshed_at == o.refreshed_at &&
152
+ last_attempted_at == o.last_attempted_at &&
153
+ error_code == o.error_code &&
154
+ error_message == o.error_message &&
155
+ unavailable == o.unavailable &&
156
+ settings == o.settings
157
+ end
158
+
159
+ # @see the `==` method
160
+ # @param [Object] Object to be compared
161
+ def eql?(o)
162
+ self == o
163
+ end
164
+
165
+ # Calculates hash code according to all attributes.
166
+ # @return [Integer] Hash code
167
+ def hash
168
+ [refreshed_at, last_attempted_at, error_code, error_message, unavailable, settings].hash
169
+ end
170
+
171
+ # Builds the object from hash
172
+ # @param [Hash] attributes Model attributes in the form of hash
173
+ # @return [Object] Returns the model itself
174
+ def self.build_from_hash(attributes)
175
+ return nil unless attributes.is_a?(Hash)
176
+ attributes = attributes.transform_keys(&:to_sym)
177
+ transformed_hash = {}
178
+ openapi_types.each_pair do |key, type|
179
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
180
+ transformed_hash["#{key}"] = nil
181
+ elsif type =~ /\AArray<(.*)>/i
182
+ # check to ensure the input is an array given that the attribute
183
+ # is documented as an array but the input is not
184
+ if attributes[attribute_map[key]].is_a?(Array)
185
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
186
+ end
187
+ elsif !attributes[attribute_map[key]].nil?
188
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
189
+ end
190
+ end
191
+ new(transformed_hash)
192
+ end
193
+
194
+ # Deserializes the data based on type
195
+ # @param string type Data type
196
+ # @param string value Value to be deserialized
197
+ # @return [Object] Deserialized data
198
+ def self._deserialize(type, value)
199
+ case type.to_sym
200
+ when :Time
201
+ Time.parse(value)
202
+ when :Date
203
+ Date.parse(value)
204
+ when :String
205
+ value.to_s
206
+ when :Integer
207
+ value.to_i
208
+ when :Float
209
+ value.to_f
210
+ when :Boolean
211
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
212
+ true
213
+ else
214
+ false
215
+ end
216
+ when :Object
217
+ # generic object (usually a Hash), return directly
218
+ value
219
+ when /\AArray<(?<inner_type>.+)>\z/
220
+ inner_type = Regexp.last_match[:inner_type]
221
+ value.map { |v| _deserialize(inner_type, v) }
222
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
223
+ k_type = Regexp.last_match[:k_type]
224
+ v_type = Regexp.last_match[:v_type]
225
+ {}.tap do |hash|
226
+ value.each do |k, v|
227
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
228
+ end
229
+ end
230
+ else # model
231
+ # models (e.g. Pet) or oneOf
232
+ klass = MoneyKit.const_get(type)
233
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
234
+ end
235
+ end
236
+
237
+ # Returns the string representation of the object
238
+ # @return [String] String presentation of the object
239
+ def to_s
240
+ to_hash.to_s
241
+ end
242
+
243
+ # to_body is an alias to to_hash (backward compatibility)
244
+ # @return [Hash] Returns the object in the form of hash
245
+ def to_body
246
+ to_hash
247
+ end
248
+
249
+ # Returns the object in the form of hash
250
+ # @return [Hash] Returns the object in the form of hash
251
+ def to_hash
252
+ hash = {}
253
+ self.class.attribute_map.each_pair do |attr, param|
254
+ value = self.send(attr)
255
+ if value.nil?
256
+ is_nullable = self.class.openapi_nullable.include?(attr)
257
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
258
+ end
259
+
260
+ hash[param] = _to_hash(value)
261
+ end
262
+ hash
263
+ end
264
+
265
+ # Outputs non-array value in the form of hash
266
+ # For object, use to_hash. Otherwise, just return the value
267
+ # @param [Object] value Any valid value
268
+ # @return [Hash] Returns the value in the form of hash
269
+ def _to_hash(value)
270
+ if value.is_a?(Array)
271
+ value.compact.map { |v| _to_hash(v) }
272
+ elsif value.is_a?(Hash)
273
+ {}.tap do |hash|
274
+ value.each { |k, v| hash[k] = _to_hash(v) }
275
+ end
276
+ elsif value.respond_to? :to_hash
277
+ value.to_hash
278
+ else
279
+ value
280
+ end
281
+ end
282
+ end
283
+ end
@@ -22,9 +22,10 @@ module MoneyKit
22
22
  TIMEOUT = "timeout".freeze
23
23
  UNKNOWN = "unknown".freeze
24
24
  NO_ACCOUNTS = "no_accounts".freeze
25
+ INSTITUTION_ERROR = "institution_error".freeze
25
26
 
26
27
  def self.all_vars
27
- @all_vars ||= [RATE_LIMIT, AUTH_EXPIRED, INVALID_CREDENTIALS, NOT_SUPPORTED, TIMEOUT, UNKNOWN, NO_ACCOUNTS].freeze
28
+ @all_vars ||= [RATE_LIMIT, AUTH_EXPIRED, INVALID_CREDENTIALS, NOT_SUPPORTED, TIMEOUT, UNKNOWN, NO_ACCOUNTS, INSTITUTION_ERROR].freeze
28
29
  end
29
30
 
30
31
  # Builds the enum from string
@@ -44,11 +44,11 @@ module MoneyKit
44
44
  # Attribute type mapping.
45
45
  def self.openapi_types
46
46
  {
47
- :'accounts' => :'AccountsLinkProduct',
48
- :'account_numbers' => :'AccountNumbersLinkProduct',
49
- :'identity' => :'IdentityLinkProduct',
47
+ :'accounts' => :'LinkProduct',
48
+ :'account_numbers' => :'LinkProduct',
49
+ :'identity' => :'LinkProduct',
50
50
  :'transactions' => :'TransactionsLinkProduct',
51
- :'investments' => :'InvestmentsLinkProduct'
51
+ :'investments' => :'LinkProduct'
52
52
  }
53
53
  end
54
54