moneykit 0.1.6 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/docs/AccessTokenApi.md +4 -4
- data/docs/AccountNumbersApi.md +12 -12
- data/docs/AccountNumbersLegacy20230218.md +24 -0
- data/docs/AccountWithAccountNumbersLegacy20230218.md +28 -0
- data/docs/AccountsApi.md +20 -20
- data/docs/AppClientResponse.md +26 -0
- data/docs/AppResponse.md +24 -0
- data/docs/CreateLinkSessionRequest.md +2 -2
- data/docs/GetAccountNumbersResponseLegacy20230218.md +20 -0
- data/docs/IdentityApi.md +1 -1
- data/docs/Institution.md +1 -1
- data/docs/InstitutionsApi.md +2 -2
- data/docs/InvestmentTransactionResponse.md +4 -4
- data/docs/InvestmentsApi.md +2 -2
- data/docs/LinkProduct.md +28 -0
- data/docs/LinkProducts.md +4 -4
- data/docs/LinksApi.md +5 -5
- data/docs/MoneyKitConnectFeatures.md +3 -1
- data/docs/ProductSettings.md +24 -0
- data/docs/ProductsApi.md +1 -1
- data/docs/ProductsSettings.md +3 -3
- data/docs/RequestedLinkPermission.md +2 -2
- data/docs/Response401GetAccountNumbersLegacy20230218LinksIdAccountsNumbersGet.md +22 -0
- data/docs/SecurityResponse.md +2 -2
- data/docs/TransactionsApi.md +5 -5
- data/docs/TransactionsLinkProduct.md +6 -4
- data/docs/TransactionsProductSettings.md +4 -2
- data/docs/UsersApi.md +7 -7
- data/docs/WebhooksApi.md +1 -1
- data/lib/moneykit/api/access_token_api.rb +3 -3
- data/lib/moneykit/api/account_numbers_api.rb +10 -10
- data/lib/moneykit/api/accounts_api.rb +16 -16
- data/lib/moneykit/api/investments_api.rb +2 -2
- data/lib/moneykit/api/transactions_api.rb +6 -6
- data/lib/moneykit/api/users_api.rb +8 -8
- data/lib/moneykit/models/account_numbers_legacy20230218.rb +275 -0
- data/lib/moneykit/models/account_with_account_numbers_legacy20230218.rb +296 -0
- data/lib/moneykit/models/app_client_response.rb +281 -0
- data/lib/moneykit/models/app_response.rb +272 -0
- data/lib/moneykit/models/create_link_session_request.rb +2 -2
- data/lib/moneykit/models/get_account_numbers_response_legacy20230218.rb +237 -0
- data/lib/moneykit/models/institution.rb +1 -1
- data/lib/moneykit/models/investment_transaction_response.rb +13 -13
- data/lib/moneykit/models/link_product.rb +283 -0
- data/lib/moneykit/models/link_product_failure_reasons.rb +2 -1
- data/lib/moneykit/models/link_products.rb +4 -4
- data/lib/moneykit/models/money_kit_connect_features.rb +16 -4
- data/lib/moneykit/models/product_settings.rb +249 -0
- data/lib/moneykit/models/products_settings.rb +3 -3
- data/lib/moneykit/models/requested_link_permission.rb +2 -2
- data/lib/moneykit/models/response401_get_account_numbers_legacy20230218_links_id_accounts_numbers_get.rb +104 -0
- data/lib/moneykit/models/security_response.rb +11 -11
- data/lib/moneykit/models/transactions_link_product.rb +22 -18
- data/lib/moneykit/models/transactions_product_settings.rb +20 -10
- data/lib/moneykit/version.rb +1 -1
- data/lib/moneykit.rb +8 -14
- data/spec/models/account_numbers_legacy20230218_spec.rb +54 -0
- data/spec/models/account_with_account_numbers_legacy20230218_spec.rb +66 -0
- data/spec/models/app_client_response_spec.rb +60 -0
- data/spec/models/app_response_spec.rb +54 -0
- data/spec/models/get_account_numbers_response_legacy20230218_spec.rb +42 -0
- data/spec/models/link_product_spec.rb +66 -0
- data/spec/models/product_settings_spec.rb +54 -0
- data/spec/models/response401_get_account_numbers_legacy20230218_links_id_accounts_numbers_get_spec.rb +21 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/byebug/byebug.so +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
- 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
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.1.1/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.1.1/psych.so +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.7.3/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.7.3/racc/cparse.so +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.0/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.0/stringio.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/byebug-11.1.3/lib/byebug/byebug.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/jaro_winkler-1.5.6/lib/jaro_winkler/jaro_winkler_ext.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/psych-5.1.1.1/lib/psych.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/racc-1.7.3/lib/racc/cparse.so +0 -0
- data/vendor/bundle/ruby/3.2.0/gems/stringio-3.1.0/lib/stringio.so +0 -0
- metadata +143 -111
@@ -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' => :'
|
45
|
-
:'identity' => :'
|
44
|
+
:'account_numbers' => :'ProductSettings',
|
45
|
+
:'identity' => :'ProductSettings',
|
46
46
|
:'transactions' => :'TransactionsProductSettings',
|
47
|
-
:'investments' => :'
|
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
|
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' => :'
|
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 :
|
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
|
-
:'
|
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
|
-
:'
|
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?(:'
|
102
|
-
self.
|
101
|
+
if attributes.key?(:'security_id')
|
102
|
+
self.security_id = attributes[:'security_id']
|
103
103
|
else
|
104
|
-
self.
|
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 @
|
152
|
-
invalid_properties.push('invalid value for "
|
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 @
|
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
|
-
|
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
|
-
[
|
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
|
@@ -26,10 +26,14 @@ module MoneyKit
|
|
26
26
|
# The error message, if the last attempt to refresh the product failed.
|
27
27
|
attr_accessor :error_message
|
28
28
|
|
29
|
-
|
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
|
30
31
|
|
31
32
|
attr_accessor :settings
|
32
33
|
|
34
|
+
# DEPRECATED: No longer used as we fetch as much history as possible.
|
35
|
+
attr_accessor :has_history
|
36
|
+
|
33
37
|
class EnumAttributeValidator
|
34
38
|
attr_reader :datatype
|
35
39
|
attr_reader :allowable_values
|
@@ -59,8 +63,9 @@ module MoneyKit
|
|
59
63
|
:'last_attempted_at' => :'last_attempted_at',
|
60
64
|
:'error_code' => :'error_code',
|
61
65
|
:'error_message' => :'error_message',
|
62
|
-
:'
|
63
|
-
:'settings' => :'settings'
|
66
|
+
:'unavailable' => :'unavailable',
|
67
|
+
:'settings' => :'settings',
|
68
|
+
:'has_history' => :'has_history'
|
64
69
|
}
|
65
70
|
end
|
66
71
|
|
@@ -76,8 +81,9 @@ module MoneyKit
|
|
76
81
|
:'last_attempted_at' => :'Time',
|
77
82
|
:'error_code' => :'LinkProductFailureReasons',
|
78
83
|
:'error_message' => :'String',
|
79
|
-
:'
|
80
|
-
:'settings' => :'TransactionsProductSettings'
|
84
|
+
:'unavailable' => :'String',
|
85
|
+
:'settings' => :'TransactionsProductSettings',
|
86
|
+
:'has_history' => :'Boolean'
|
81
87
|
}
|
82
88
|
end
|
83
89
|
|
@@ -118,16 +124,18 @@ module MoneyKit
|
|
118
124
|
self.error_message = attributes[:'error_message']
|
119
125
|
end
|
120
126
|
|
121
|
-
if attributes.key?(:'
|
122
|
-
self.
|
123
|
-
else
|
124
|
-
self.has_history = nil
|
127
|
+
if attributes.key?(:'unavailable')
|
128
|
+
self.unavailable = attributes[:'unavailable']
|
125
129
|
end
|
126
130
|
|
127
131
|
if attributes.key?(:'settings')
|
128
132
|
self.settings = attributes[:'settings']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.key?(:'has_history')
|
136
|
+
self.has_history = attributes[:'has_history']
|
129
137
|
else
|
130
|
-
self.
|
138
|
+
self.has_history = nil
|
131
139
|
end
|
132
140
|
end
|
133
141
|
|
@@ -140,10 +148,6 @@ module MoneyKit
|
|
140
148
|
invalid_properties.push('invalid value for "has_history", has_history cannot be nil.')
|
141
149
|
end
|
142
150
|
|
143
|
-
if @settings.nil?
|
144
|
-
invalid_properties.push('invalid value for "settings", settings cannot be nil.')
|
145
|
-
end
|
146
|
-
|
147
151
|
invalid_properties
|
148
152
|
end
|
149
153
|
|
@@ -152,7 +156,6 @@ module MoneyKit
|
|
152
156
|
def valid?
|
153
157
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
154
158
|
return false if @has_history.nil?
|
155
|
-
return false if @settings.nil?
|
156
159
|
true
|
157
160
|
end
|
158
161
|
|
@@ -165,8 +168,9 @@ module MoneyKit
|
|
165
168
|
last_attempted_at == o.last_attempted_at &&
|
166
169
|
error_code == o.error_code &&
|
167
170
|
error_message == o.error_message &&
|
168
|
-
|
169
|
-
settings == o.settings
|
171
|
+
unavailable == o.unavailable &&
|
172
|
+
settings == o.settings &&
|
173
|
+
has_history == o.has_history
|
170
174
|
end
|
171
175
|
|
172
176
|
# @see the `==` method
|
@@ -178,7 +182,7 @@ module MoneyKit
|
|
178
182
|
# Calculates hash code according to all attributes.
|
179
183
|
# @return [Integer] Hash code
|
180
184
|
def hash
|
181
|
-
[refreshed_at, last_attempted_at, error_code, error_message,
|
185
|
+
[refreshed_at, last_attempted_at, error_code, error_message, unavailable, settings, has_history].hash
|
182
186
|
end
|
183
187
|
|
184
188
|
# Builds the object from hash
|