moneykit 0.1.5 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) 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/AccountBalances.md +3 -1
  6. data/docs/AccountNumbersApi.md +12 -12
  7. data/docs/AccountNumbersLegacy20230218.md +24 -0
  8. data/docs/AccountWithAccountNumbersLegacy20230218.md +28 -0
  9. data/docs/AccountsApi.md +20 -20
  10. data/docs/AppClientResponse.md +26 -0
  11. data/docs/AppResponse.md +24 -0
  12. data/docs/CreateLinkSessionRequest.md +2 -2
  13. data/docs/GetAccountNumbersResponseLegacy20230218.md +20 -0
  14. data/docs/IdentityApi.md +1 -1
  15. data/docs/Institution.md +1 -1
  16. data/docs/InstitutionsApi.md +2 -2
  17. data/docs/InvestmentTransactionResponse.md +4 -4
  18. data/docs/InvestmentsApi.md +2 -2
  19. data/docs/LinkCommon.md +3 -1
  20. data/docs/LinkProduct.md +28 -0
  21. data/docs/LinkProducts.md +4 -4
  22. data/docs/LinkResponse.md +2 -0
  23. data/docs/LinksApi.md +5 -5
  24. data/docs/MoneyKitConnectFeatures.md +3 -1
  25. data/docs/ProductSettings.md +24 -0
  26. data/docs/ProductsApi.md +1 -1
  27. data/docs/ProductsSettings.md +3 -3
  28. data/docs/RequestedLinkPermission.md +2 -2
  29. data/docs/Response401GetAccountNumbersLegacy20230218LinksIdAccountsNumbersGet.md +22 -0
  30. data/docs/SecurityResponse.md +2 -2
  31. data/docs/TransactionsApi.md +5 -5
  32. data/docs/TransactionsLinkProduct.md +6 -4
  33. data/docs/TransactionsProductSettings.md +4 -2
  34. data/docs/UsersApi.md +7 -7
  35. data/docs/WebhooksApi.md +1 -1
  36. data/lib/moneykit/api/access_token_api.rb +3 -3
  37. data/lib/moneykit/api/account_numbers_api.rb +10 -10
  38. data/lib/moneykit/api/accounts_api.rb +16 -16
  39. data/lib/moneykit/api/investments_api.rb +2 -2
  40. data/lib/moneykit/api/transactions_api.rb +6 -6
  41. data/lib/moneykit/api/users_api.rb +8 -8
  42. data/lib/moneykit/models/account_balances.rb +14 -4
  43. data/lib/moneykit/models/account_numbers_legacy20230218.rb +275 -0
  44. data/lib/moneykit/models/account_with_account_numbers_legacy20230218.rb +296 -0
  45. data/lib/moneykit/models/app_client_response.rb +281 -0
  46. data/lib/moneykit/models/app_response.rb +272 -0
  47. data/lib/moneykit/models/create_link_session_request.rb +2 -2
  48. data/lib/moneykit/models/get_account_numbers_response_legacy20230218.rb +237 -0
  49. data/lib/moneykit/models/institution.rb +1 -1
  50. data/lib/moneykit/models/investment_transaction_response.rb +13 -13
  51. data/lib/moneykit/models/link_common.rb +22 -4
  52. data/lib/moneykit/models/link_product.rb +283 -0
  53. data/lib/moneykit/models/link_product_failure_reasons.rb +2 -1
  54. data/lib/moneykit/models/link_products.rb +4 -4
  55. data/lib/moneykit/models/link_response.rb +19 -1
  56. data/lib/moneykit/models/money_kit_connect_features.rb +16 -4
  57. data/lib/moneykit/models/product_settings.rb +249 -0
  58. data/lib/moneykit/models/products_settings.rb +3 -3
  59. data/lib/moneykit/models/requested_link_permission.rb +2 -2
  60. data/lib/moneykit/models/response401_get_account_numbers_legacy20230218_links_id_accounts_numbers_get.rb +104 -0
  61. data/lib/moneykit/models/security_response.rb +11 -11
  62. data/lib/moneykit/models/transactions_link_product.rb +22 -18
  63. data/lib/moneykit/models/transactions_product_settings.rb +20 -10
  64. data/lib/moneykit/version.rb +1 -1
  65. data/lib/moneykit.rb +8 -14
  66. data/spec/models/account_numbers_legacy20230218_spec.rb +54 -0
  67. data/spec/models/account_with_account_numbers_legacy20230218_spec.rb +66 -0
  68. data/spec/models/app_client_response_spec.rb +60 -0
  69. data/spec/models/app_response_spec.rb +54 -0
  70. data/spec/models/get_account_numbers_response_legacy20230218_spec.rb +42 -0
  71. data/spec/models/link_product_spec.rb +66 -0
  72. data/spec/models/product_settings_spec.rb +54 -0
  73. data/spec/models/response401_get_account_numbers_legacy20230218_links_id_accounts_numbers_get_spec.rb +21 -0
  74. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/byebug/byebug.so +0 -0
  75. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/gem_make.out +5 -5
  76. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
  77. 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
  78. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.1.1/gem_make.out +5 -5
  79. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.1.1/psych.so +0 -0
  80. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.7.3/gem_make.out +5 -5
  81. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.7.3/racc/cparse.so +0 -0
  82. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.0/gem_make.out +5 -5
  83. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.0/stringio.so +0 -0
  84. data/vendor/bundle/ruby/3.2.0/gems/byebug-11.1.3/lib/byebug/byebug.so +0 -0
  85. data/vendor/bundle/ruby/3.2.0/gems/jaro_winkler-1.5.6/lib/jaro_winkler/jaro_winkler_ext.so +0 -0
  86. data/vendor/bundle/ruby/3.2.0/gems/psych-5.1.1.1/lib/psych.so +0 -0
  87. data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.3/lib/racc/cparse.so +0 -0
  88. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.1.0/lib/stringio.so +0 -0
  89. metadata +145 -113
@@ -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
 
@@ -38,6 +38,8 @@ module MoneyKit
38
38
 
39
39
  attr_accessor :products
40
40
 
41
+ attr_accessor :available_products
42
+
41
43
  attr_accessor :provider
42
44
 
43
45
  # The webhook url assigned to this link.
@@ -77,6 +79,7 @@ module MoneyKit
77
79
  :'last_synced_at' => :'last_synced_at',
78
80
  :'tags' => :'tags',
79
81
  :'products' => :'products',
82
+ :'available_products' => :'available_products',
80
83
  :'provider' => :'provider',
81
84
  :'webhook' => :'webhook'
82
85
  }
@@ -99,6 +102,7 @@ module MoneyKit
99
102
  :'last_synced_at' => :'Time',
100
103
  :'tags' => :'Array<String>',
101
104
  :'products' => :'LinkProducts',
105
+ :'available_products' => :'Array<Product>',
102
106
  :'provider' => :'Provider',
103
107
  :'webhook' => :'String'
104
108
  }
@@ -175,6 +179,14 @@ module MoneyKit
175
179
  self.products = nil
176
180
  end
177
181
 
182
+ if attributes.key?(:'available_products')
183
+ if (value = attributes[:'available_products']).is_a?(Array)
184
+ self.available_products = value
185
+ end
186
+ else
187
+ self.available_products = nil
188
+ end
189
+
178
190
  if attributes.key?(:'provider')
179
191
  self.provider = attributes[:'provider']
180
192
  else
@@ -215,6 +227,10 @@ module MoneyKit
215
227
  invalid_properties.push('invalid value for "products", products cannot be nil.')
216
228
  end
217
229
 
230
+ if @available_products.nil?
231
+ invalid_properties.push('invalid value for "available_products", available_products cannot be nil.')
232
+ end
233
+
218
234
  if @provider.nil?
219
235
  invalid_properties.push('invalid value for "provider", provider cannot be nil.')
220
236
  end
@@ -232,6 +248,7 @@ module MoneyKit
232
248
  return false if @institution_avatar.nil?
233
249
  return false if @state.nil?
234
250
  return false if @products.nil?
251
+ return false if @available_products.nil?
235
252
  return false if @provider.nil?
236
253
  true
237
254
  end
@@ -250,6 +267,7 @@ module MoneyKit
250
267
  last_synced_at == o.last_synced_at &&
251
268
  tags == o.tags &&
252
269
  products == o.products &&
270
+ available_products == o.available_products &&
253
271
  provider == o.provider &&
254
272
  webhook == o.webhook
255
273
  end
@@ -263,7 +281,7 @@ module MoneyKit
263
281
  # Calculates hash code according to all attributes.
264
282
  # @return [Integer] Hash code
265
283
  def hash
266
- [link_id, institution_id, institution_name, institution_avatar, state, error_code, last_synced_at, tags, products, provider, webhook].hash
284
+ [link_id, institution_id, institution_name, institution_avatar, state, error_code, last_synced_at, tags, products, available_products, provider, webhook].hash
267
285
  end
268
286
 
269
287
  # Builds the object from hash
@@ -21,11 +21,15 @@ module MoneyKit
21
21
  # If enabled, the user can register for, or login into, Money ID.
22
22
  attr_accessor :enable_money_id
23
23
 
24
+ # If enabled, the user will see a warning when trying to connect the same institution more than once.
25
+ attr_accessor :duplicate_institution_warning
26
+
24
27
  # Attribute mapping from ruby-style variable name to JSON key.
25
28
  def self.attribute_map
26
29
  {
27
30
  :'issue_reporter' => :'issue_reporter',
28
- :'enable_money_id' => :'enable_money_id'
31
+ :'enable_money_id' => :'enable_money_id',
32
+ :'duplicate_institution_warning' => :'duplicate_institution_warning'
29
33
  }
30
34
  end
31
35
 
@@ -38,7 +42,8 @@ module MoneyKit
38
42
  def self.openapi_types
39
43
  {
40
44
  :'issue_reporter' => :'Boolean',
41
- :'enable_money_id' => :'Boolean'
45
+ :'enable_money_id' => :'Boolean',
46
+ :'duplicate_institution_warning' => :'Boolean'
42
47
  }
43
48
  end
44
49
 
@@ -74,6 +79,12 @@ module MoneyKit
74
79
  else
75
80
  self.enable_money_id = false
76
81
  end
82
+
83
+ if attributes.key?(:'duplicate_institution_warning')
84
+ self.duplicate_institution_warning = attributes[:'duplicate_institution_warning']
85
+ else
86
+ self.duplicate_institution_warning = false
87
+ end
77
88
  end
78
89
 
79
90
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -97,7 +108,8 @@ module MoneyKit
97
108
  return true if self.equal?(o)
98
109
  self.class == o.class &&
99
110
  issue_reporter == o.issue_reporter &&
100
- enable_money_id == o.enable_money_id
111
+ enable_money_id == o.enable_money_id &&
112
+ duplicate_institution_warning == o.duplicate_institution_warning
101
113
  end
102
114
 
103
115
  # @see the `==` method
@@ -109,7 +121,7 @@ module MoneyKit
109
121
  # Calculates hash code according to all attributes.
110
122
  # @return [Integer] Hash code
111
123
  def hash
112
- [issue_reporter, enable_money_id].hash
124
+ [issue_reporter, enable_money_id, duplicate_institution_warning].hash
113
125
  end
114
126
 
115
127
  # Builds the object from hash
@@ -0,0 +1,249 @@
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 ProductSettings
18
+ # If true, only institutions supporting this product will be available.
19
+ attr_accessor :required
20
+
21
+ # This flag matters only if `required` is false. For non-required products, the product permission is normally presented to the user as optional (granted by default, but the user may opt out). If this flag is true, however, the product permission will be presented in the UI as non-optional: the user's only choice is to grant the permission or to cancel the link. <p> Note that this field is ignored if `required` is true. Permission is always mandatory for required products.
22
+ attr_accessor :require_permission
23
+
24
+ # If true, the data will be available as soon as possible after linking, even if `required` is false. If false, the data will be available after the first manual data refresh.
25
+ attr_accessor :prefetch
26
+
27
+ # A **brief** description of the reason your app wants this data. This description will follow the words \"...data is used to\", and will be displayed to the user when permission is requested. You should provide this field if your app does not request this product by default, or if you want to show a particular reason for requesting the product during this link session.
28
+ attr_accessor :reason
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'required' => :'required',
34
+ :'require_permission' => :'require_permission',
35
+ :'prefetch' => :'prefetch',
36
+ :'reason' => :'reason'
37
+ }
38
+ end
39
+
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ attribute_map.values
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'required' => :'Boolean',
49
+ :'require_permission' => :'Boolean',
50
+ :'prefetch' => :'Boolean',
51
+ :'reason' => :'String'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MoneyKit::ProductSettings` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MoneyKit::ProductSettings`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'required')
77
+ self.required = attributes[:'required']
78
+ else
79
+ self.required = false
80
+ end
81
+
82
+ if attributes.key?(:'require_permission')
83
+ self.require_permission = attributes[:'require_permission']
84
+ else
85
+ self.require_permission = false
86
+ end
87
+
88
+ if attributes.key?(:'prefetch')
89
+ self.prefetch = attributes[:'prefetch']
90
+ else
91
+ self.prefetch = false
92
+ end
93
+
94
+ if attributes.key?(:'reason')
95
+ self.reason = attributes[:'reason']
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
103
+ invalid_properties = Array.new
104
+ invalid_properties
105
+ end
106
+
107
+ # Check to see if the all the properties in the model are valid
108
+ # @return true if the model is valid
109
+ def valid?
110
+ warn '[DEPRECATED] the `valid?` method is obsolete'
111
+ true
112
+ end
113
+
114
+ # Checks equality by comparing each attribute.
115
+ # @param [Object] Object to be compared
116
+ def ==(o)
117
+ return true if self.equal?(o)
118
+ self.class == o.class &&
119
+ required == o.required &&
120
+ require_permission == o.require_permission &&
121
+ prefetch == o.prefetch &&
122
+ reason == o.reason
123
+ end
124
+
125
+ # @see the `==` method
126
+ # @param [Object] Object to be compared
127
+ def eql?(o)
128
+ self == o
129
+ end
130
+
131
+ # Calculates hash code according to all attributes.
132
+ # @return [Integer] Hash code
133
+ def hash
134
+ [required, require_permission, prefetch, reason].hash
135
+ end
136
+
137
+ # Builds the object from hash
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ # @return [Object] Returns the model itself
140
+ def self.build_from_hash(attributes)
141
+ return nil unless attributes.is_a?(Hash)
142
+ attributes = attributes.transform_keys(&:to_sym)
143
+ transformed_hash = {}
144
+ openapi_types.each_pair do |key, type|
145
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
146
+ transformed_hash["#{key}"] = nil
147
+ elsif type =~ /\AArray<(.*)>/i
148
+ # check to ensure the input is an array given that the attribute
149
+ # is documented as an array but the input is not
150
+ if attributes[attribute_map[key]].is_a?(Array)
151
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
152
+ end
153
+ elsif !attributes[attribute_map[key]].nil?
154
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
155
+ end
156
+ end
157
+ new(transformed_hash)
158
+ end
159
+
160
+ # Deserializes the data based on type
161
+ # @param string type Data type
162
+ # @param string value Value to be deserialized
163
+ # @return [Object] Deserialized data
164
+ def self._deserialize(type, value)
165
+ case type.to_sym
166
+ when :Time
167
+ Time.parse(value)
168
+ when :Date
169
+ Date.parse(value)
170
+ when :String
171
+ value.to_s
172
+ when :Integer
173
+ value.to_i
174
+ when :Float
175
+ value.to_f
176
+ when :Boolean
177
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
178
+ true
179
+ else
180
+ false
181
+ end
182
+ when :Object
183
+ # generic object (usually a Hash), return directly
184
+ value
185
+ when /\AArray<(?<inner_type>.+)>\z/
186
+ inner_type = Regexp.last_match[:inner_type]
187
+ value.map { |v| _deserialize(inner_type, v) }
188
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
189
+ k_type = Regexp.last_match[:k_type]
190
+ v_type = Regexp.last_match[:v_type]
191
+ {}.tap do |hash|
192
+ value.each do |k, v|
193
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
194
+ end
195
+ end
196
+ else # model
197
+ # models (e.g. Pet) or oneOf
198
+ klass = MoneyKit.const_get(type)
199
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
200
+ end
201
+ end
202
+
203
+ # Returns the string representation of the object
204
+ # @return [String] String presentation of the object
205
+ def to_s
206
+ to_hash.to_s
207
+ end
208
+
209
+ # to_body is an alias to to_hash (backward compatibility)
210
+ # @return [Hash] Returns the object in the form of hash
211
+ def to_body
212
+ to_hash
213
+ end
214
+
215
+ # Returns the object in the form of hash
216
+ # @return [Hash] Returns the object in the form of hash
217
+ def to_hash
218
+ hash = {}
219
+ self.class.attribute_map.each_pair do |attr, param|
220
+ value = self.send(attr)
221
+ if value.nil?
222
+ is_nullable = self.class.openapi_nullable.include?(attr)
223
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
224
+ end
225
+
226
+ hash[param] = _to_hash(value)
227
+ end
228
+ hash
229
+ end
230
+
231
+ # Outputs non-array value in the form of hash
232
+ # For object, use to_hash. Otherwise, just return the value
233
+ # @param [Object] value Any valid value
234
+ # @return [Hash] Returns the value in the form of hash
235
+ def _to_hash(value)
236
+ if value.is_a?(Array)
237
+ value.compact.map { |v| _to_hash(v) }
238
+ elsif value.is_a?(Hash)
239
+ {}.tap do |hash|
240
+ value.each { |k, v| hash[k] = _to_hash(v) }
241
+ end
242
+ elsif value.respond_to? :to_hash
243
+ value.to_hash
244
+ else
245
+ value
246
+ end
247
+ end
248
+ end
249
+ end
@@ -41,10 +41,10 @@ module MoneyKit
41
41
  # Attribute type mapping.
42
42
  def self.openapi_types
43
43
  {
44
- :'account_numbers' => :'AccountNumbersProductSettings',
45
- :'identity' => :'IdentityProductSettings',
44
+ :'account_numbers' => :'ProductSettings',
45
+ :'identity' => :'ProductSettings',
46
46
  :'transactions' => :'TransactionsProductSettings',
47
- :'investments' => :'InvestmentsProductSettings'
47
+ :'investments' => :'ProductSettings'
48
48
  }
49
49
  end
50
50
 
@@ -17,7 +17,7 @@ module MoneyKit
17
17
  class RequestedLinkPermission
18
18
  attr_accessor :scope
19
19
 
20
- # A **brief** description of the reason your app wants this data. This description will be displayed to the user when permission is requested.
20
+ # A **brief** description of the reason your app wants this data. This description will follow the words \"...data is used to\", and will be displayed to the user when permission is requested.
21
21
  attr_accessor :reason
22
22
 
23
23
  # If true, only institutions that support this data type will be available, and the user **must** grant this permission or the link will not be created. If false, then the available institutions list may include those that do not support this data type, and even if the user declines to grant this permission, the link will still be created (so long as at least one permission is granted).
@@ -62,7 +62,7 @@ module MoneyKit
62
62
  # Attribute type mapping.
63
63
  def self.openapi_types
64
64
  {
65
- :'scope' => :'LinkPermissionScope',
65
+ :'scope' => :'Product',
66
66
  :'reason' => :'String',
67
67
  :'required' => :'Boolean'
68
68
  }
@@ -0,0 +1,104 @@
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
+ module Response401GetAccountNumbersLegacy20230218LinksIdAccountsNumbersGet
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'APIErrorAuthExpiredAccessTokenResponse',
23
+ :'APIErrorAuthUnauthorizedResponse',
24
+ :'LinkErrorUnauthorizedAccessResponse'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of anyOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_any_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ typed_data = find_and_cast_into_type(klass, data)
42
+ return typed_data if typed_data
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_any_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.parse(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = MoneyKit.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise unless (data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+ end
@@ -16,7 +16,7 @@ require 'time'
16
16
  module MoneyKit
17
17
  class SecurityResponse
18
18
  # A unique MoneyKit ID for this security.
19
- attr_accessor :id
19
+ attr_accessor :security_id
20
20
 
21
21
  # A user-facing name for this security.
22
22
  attr_accessor :name
@@ -45,7 +45,7 @@ module MoneyKit
45
45
  # Attribute mapping from ruby-style variable name to JSON key.
46
46
  def self.attribute_map
47
47
  {
48
- :'id' => :'id',
48
+ :'security_id' => :'security_id',
49
49
  :'name' => :'name',
50
50
  :'type' => :'type',
51
51
  :'currency' => :'currency',
@@ -65,7 +65,7 @@ module MoneyKit
65
65
  # Attribute type mapping.
66
66
  def self.openapi_types
67
67
  {
68
- :'id' => :'String',
68
+ :'security_id' => :'String',
69
69
  :'name' => :'String',
70
70
  :'type' => :'String',
71
71
  :'currency' => :'String',
@@ -98,10 +98,10 @@ module MoneyKit
98
98
  h[k.to_sym] = v
99
99
  }
100
100
 
101
- if attributes.key?(:'id')
102
- self.id = attributes[:'id']
101
+ if attributes.key?(:'security_id')
102
+ self.security_id = attributes[:'security_id']
103
103
  else
104
- self.id = nil
104
+ self.security_id = nil
105
105
  end
106
106
 
107
107
  if attributes.key?(:'name')
@@ -148,8 +148,8 @@ module MoneyKit
148
148
  def list_invalid_properties
149
149
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
150
150
  invalid_properties = Array.new
151
- if @id.nil?
152
- invalid_properties.push('invalid value for "id", id cannot be nil.')
151
+ if @security_id.nil?
152
+ invalid_properties.push('invalid value for "security_id", security_id cannot be nil.')
153
153
  end
154
154
 
155
155
  if @name.nil?
@@ -171,7 +171,7 @@ module MoneyKit
171
171
  # @return true if the model is valid
172
172
  def valid?
173
173
  warn '[DEPRECATED] the `valid?` method is obsolete'
174
- return false if @id.nil?
174
+ return false if @security_id.nil?
175
175
  return false if @name.nil?
176
176
  return false if @type.nil?
177
177
  return false if @currency.nil?
@@ -183,7 +183,7 @@ module MoneyKit
183
183
  def ==(o)
184
184
  return true if self.equal?(o)
185
185
  self.class == o.class &&
186
- id == o.id &&
186
+ security_id == o.security_id &&
187
187
  name == o.name &&
188
188
  type == o.type &&
189
189
  currency == o.currency &&
@@ -203,7 +203,7 @@ module MoneyKit
203
203
  # Calculates hash code according to all attributes.
204
204
  # @return [Integer] Hash code
205
205
  def hash
206
- [id, name, type, currency, ticker, isin, sedol, close_price, close_date].hash
206
+ [security_id, name, type, currency, ticker, isin, sedol, close_price, close_date].hash
207
207
  end
208
208
 
209
209
  # Builds the object from hash