moneykit 0.1.10 → 0.1.11

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 (147) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +1 -1
  4. data/docs/AccessTokenApi.md +26 -21
  5. data/docs/AccountBalances.md +2 -2
  6. data/docs/AccountGroup.md +1 -1
  7. data/docs/AccountIdentity.md +2 -0
  8. data/docs/AccountImportData.md +26 -0
  9. data/docs/AccountResponse.md +28 -0
  10. data/docs/AccountWithAccountNumbersLegacy20230218.md +2 -0
  11. data/docs/Address.md +1 -1
  12. data/docs/AppClientResponse.md +2 -2
  13. data/docs/AppLinkStateChangedWebhook.md +36 -0
  14. data/docs/AppResponse.md +2 -2
  15. data/docs/Body.md +3 -3
  16. data/docs/CreateAccessTokenResponse.md +22 -0
  17. data/docs/CreateLinkSessionRequest.md +1 -1
  18. data/docs/CustomerUser.md +22 -0
  19. data/docs/CustomerUserEmail.md +20 -0
  20. data/docs/CustomerUserPhone.md +22 -0
  21. data/docs/Date.md +15 -0
  22. data/docs/Email.md +1 -1
  23. data/docs/GetAccountResponse.md +1 -1
  24. data/docs/GetAccountsResponse.md +1 -1
  25. data/docs/GetHoldingsResponse.md +1 -1
  26. data/docs/GetInvestmentTransactionsResponse.md +1 -1
  27. data/docs/GetTransactionsResponse.md +2 -2
  28. data/docs/GetUserTransactionsResponse.md +1 -1
  29. data/docs/ImportLinkRequest.md +26 -0
  30. data/docs/Institution.md +1 -1
  31. data/docs/LinkCommon.md +3 -3
  32. data/docs/LinkProductError.md +15 -0
  33. data/docs/LinkProductRefreshWebhook.md +2 -2
  34. data/docs/LinkProductResponse.md +28 -0
  35. data/docs/LinkProducts.md +7 -5
  36. data/docs/LinkResponse.md +3 -3
  37. data/docs/LinkSessionApi.md +1 -1
  38. data/docs/LinksApi.md +79 -9
  39. data/docs/PhoneNumber.md +1 -1
  40. data/docs/PublicLinkState.md +15 -0
  41. data/docs/Response401DeleteLinkLinksIdDelete.md +22 -0
  42. data/docs/Response401GetTransactionsSyncLinksIdTransactionsSyncGet.md +22 -0
  43. data/docs/Response401ImportLinkLinksImportPost.md +22 -0
  44. data/docs/ResponseHandleLinkWebhookEventRequestBodyWebhookPost.md +3 -3
  45. data/docs/TransactionCategoryResponse.md +20 -0
  46. data/docs/TransactionEnrichmentResponse.md +26 -0
  47. data/docs/TransactionImportData.md +28 -0
  48. data/docs/TransactionMerchantResponse.md +24 -0
  49. data/docs/TransactionProcessorResponse.md +24 -0
  50. data/docs/TransactionRecurrenceResponse.md +20 -0
  51. data/docs/TransactionResponse.md +42 -0
  52. data/docs/TransactionSubcategoryResponse.md +20 -0
  53. data/docs/TransactionSync.md +22 -0
  54. data/docs/TransactionSyncResponse.md +1 -1
  55. data/docs/TransactionUpdatesAvailableWebhook.md +4 -2
  56. data/docs/TransactionsApi.md +15 -15
  57. data/docs/TransactionsLinkProduct.md +1 -1
  58. data/lib/moneykit/api/access_token_api.rb +19 -16
  59. data/lib/moneykit/api/links_api.rb +75 -7
  60. data/lib/moneykit/api/transactions_api.rb +17 -17
  61. data/lib/moneykit/models/account_balances.rb +2 -30
  62. data/lib/moneykit/models/account_group.rb +1 -1
  63. data/lib/moneykit/models/account_identity.rb +11 -1
  64. data/lib/moneykit/models/account_import_data.rb +280 -0
  65. data/lib/moneykit/models/account_response.rb +290 -0
  66. data/lib/moneykit/models/account_with_account_numbers_legacy20230218.rb +11 -1
  67. data/lib/moneykit/models/address.rb +0 -2
  68. data/lib/moneykit/models/app_client_response.rb +1 -1
  69. data/lib/moneykit/models/app_link_state_changed_webhook.rb +394 -0
  70. data/lib/moneykit/models/body.rb +1 -1
  71. data/lib/moneykit/models/create_access_token_response.rb +255 -0
  72. data/lib/moneykit/models/create_link_session_request.rb +1 -1
  73. data/lib/moneykit/models/customer_user.rb +266 -0
  74. data/lib/moneykit/models/customer_user_email.rb +258 -0
  75. data/lib/moneykit/models/customer_user_phone.rb +289 -0
  76. data/lib/moneykit/models/date.rb +104 -0
  77. data/lib/moneykit/models/email.rb +0 -2
  78. data/lib/moneykit/models/get_account_response.rb +1 -1
  79. data/lib/moneykit/models/get_accounts_response.rb +1 -1
  80. data/lib/moneykit/models/get_holdings_response.rb +1 -1
  81. data/lib/moneykit/models/get_investment_transactions_response.rb +1 -1
  82. data/lib/moneykit/models/get_transactions_response.rb +2 -2
  83. data/lib/moneykit/models/get_user_transactions_response.rb +1 -1
  84. data/lib/moneykit/models/import_link_request.rb +303 -0
  85. data/lib/moneykit/models/institution.rb +0 -7
  86. data/lib/moneykit/models/link_common.rb +3 -3
  87. data/lib/moneykit/models/link_product_error.rb +46 -0
  88. data/lib/moneykit/models/link_product_refresh_webhook.rb +24 -24
  89. data/lib/moneykit/models/link_product_response.rb +283 -0
  90. data/lib/moneykit/models/link_product_state.rb +3 -1
  91. data/lib/moneykit/models/link_products.rb +16 -7
  92. data/lib/moneykit/models/link_response.rb +3 -3
  93. data/lib/moneykit/models/phone_number.rb +0 -2
  94. data/lib/moneykit/models/product.rb +2 -1
  95. data/lib/moneykit/models/provider.rb +1 -2
  96. data/lib/moneykit/models/public_link_error.rb +1 -1
  97. data/lib/moneykit/models/public_link_state.rb +43 -0
  98. data/lib/moneykit/models/response401_delete_link_links_id_delete.rb +104 -0
  99. data/lib/moneykit/models/response401_get_transactions_sync_links_id_transactions_sync_get.rb +104 -0
  100. data/lib/moneykit/models/response401_import_link_links_import_post.rb +103 -0
  101. data/lib/moneykit/models/response_handle_link_webhook_event_request_body_webhook_post.rb +1 -1
  102. data/lib/moneykit/models/transaction_category_response.rb +230 -0
  103. data/lib/moneykit/models/transaction_enrichment_response.rb +255 -0
  104. data/lib/moneykit/models/transaction_import_data.rb +283 -0
  105. data/lib/moneykit/models/transaction_merchant_response.rb +243 -0
  106. data/lib/moneykit/models/transaction_processor_response.rb +243 -0
  107. data/lib/moneykit/models/transaction_recurrence_response.rb +223 -0
  108. data/lib/moneykit/models/transaction_response.rb +402 -0
  109. data/lib/moneykit/models/transaction_subcategory_response.rb +230 -0
  110. data/lib/moneykit/models/transaction_sync.rb +257 -0
  111. data/lib/moneykit/models/transaction_sync_response.rb +1 -1
  112. data/lib/moneykit/models/transaction_updates_available_webhook.rb +42 -24
  113. data/lib/moneykit/models/transactions_link_product.rb +1 -1
  114. data/lib/moneykit/version.rb +1 -1
  115. data/lib/moneykit.rb +25 -16
  116. data/spec/models/account_import_data_spec.rb +60 -0
  117. data/spec/models/account_response_spec.rb +66 -0
  118. data/spec/models/app_link_state_changed_webhook_spec.rb +102 -0
  119. data/spec/models/create_access_token_response_spec.rb +48 -0
  120. data/spec/models/customer_user_email_spec.rb +42 -0
  121. data/spec/models/customer_user_phone_spec.rb +48 -0
  122. data/spec/models/customer_user_spec.rb +48 -0
  123. data/spec/models/date_spec.rb +21 -0
  124. data/spec/models/import_link_request_spec.rb +60 -0
  125. data/spec/models/link_product_error_spec.rb +30 -0
  126. data/spec/models/link_product_response_spec.rb +66 -0
  127. data/spec/models/public_link_error_spec.rb +30 -0
  128. data/spec/models/public_link_state_spec.rb +30 -0
  129. data/spec/models/response401_delete_link_links_id_delete_spec.rb +21 -0
  130. data/spec/models/response401_get_transactions_sync_links_id_transactions_sync_get_spec.rb +21 -0
  131. data/spec/models/response401_import_link_links_import_post_spec.rb +21 -0
  132. data/spec/models/transaction_category_response_spec.rb +42 -0
  133. data/spec/models/transaction_enrichment_response_spec.rb +60 -0
  134. data/spec/models/transaction_import_data_spec.rb +66 -0
  135. data/spec/models/transaction_merchant_response_spec.rb +54 -0
  136. data/spec/models/transaction_processor_response_spec.rb +54 -0
  137. data/spec/models/transaction_recurrence_response_spec.rb +42 -0
  138. data/spec/models/transaction_response_spec.rb +108 -0
  139. data/spec/models/transaction_subcategory_response_spec.rb +42 -0
  140. data/spec/models/transaction_sync_spec.rb +48 -0
  141. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/gem_make.out +5 -5
  142. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
  143. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.1.1/gem_make.out +5 -5
  144. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.1.1/mkmf.log +2 -2
  145. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.7.3/gem_make.out +5 -5
  146. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.0/gem_make.out +5 -5
  147. metadata +219 -121
@@ -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 LinkProductResponse
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' => :'LinkProductError',
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::LinkProductResponse` 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::LinkProductResponse`. 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
@@ -15,11 +15,13 @@ require 'time'
15
15
 
16
16
  module MoneyKit
17
17
  class LinkProductState
18
+ PENDING = "pending".freeze
19
+ IN_PROGRESS = "in_progress".freeze
18
20
  COMPLETED = "completed".freeze
19
21
  FAILED = "failed".freeze
20
22
 
21
23
  def self.all_vars
22
- @all_vars ||= [COMPLETED, FAILED].freeze
24
+ @all_vars ||= [PENDING, IN_PROGRESS, COMPLETED, FAILED].freeze
23
25
  end
24
26
 
25
27
  # Builds the enum from string
@@ -25,6 +25,8 @@ module MoneyKit
25
25
 
26
26
  attr_accessor :investments
27
27
 
28
+ attr_accessor :enrichment
29
+
28
30
  # Attribute mapping from ruby-style variable name to JSON key.
29
31
  def self.attribute_map
30
32
  {
@@ -32,7 +34,8 @@ module MoneyKit
32
34
  :'account_numbers' => :'account_numbers',
33
35
  :'identity' => :'identity',
34
36
  :'transactions' => :'transactions',
35
- :'investments' => :'investments'
37
+ :'investments' => :'investments',
38
+ :'enrichment' => :'enrichment'
36
39
  }
37
40
  end
38
41
 
@@ -44,11 +47,12 @@ module MoneyKit
44
47
  # Attribute type mapping.
45
48
  def self.openapi_types
46
49
  {
47
- :'accounts' => :'LinkProduct',
48
- :'account_numbers' => :'LinkProduct',
49
- :'identity' => :'LinkProduct',
50
+ :'accounts' => :'LinkProductResponse',
51
+ :'account_numbers' => :'LinkProductResponse',
52
+ :'identity' => :'LinkProductResponse',
50
53
  :'transactions' => :'TransactionsLinkProduct',
51
- :'investments' => :'LinkProduct'
54
+ :'investments' => :'LinkProductResponse',
55
+ :'enrichment' => :'LinkProductResponse'
52
56
  }
53
57
  end
54
58
 
@@ -92,6 +96,10 @@ module MoneyKit
92
96
  if attributes.key?(:'investments')
93
97
  self.investments = attributes[:'investments']
94
98
  end
99
+
100
+ if attributes.key?(:'enrichment')
101
+ self.enrichment = attributes[:'enrichment']
102
+ end
95
103
  end
96
104
 
97
105
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -118,7 +126,8 @@ module MoneyKit
118
126
  account_numbers == o.account_numbers &&
119
127
  identity == o.identity &&
120
128
  transactions == o.transactions &&
121
- investments == o.investments
129
+ investments == o.investments &&
130
+ enrichment == o.enrichment
122
131
  end
123
132
 
124
133
  # @see the `==` method
@@ -130,7 +139,7 @@ module MoneyKit
130
139
  # Calculates hash code according to all attributes.
131
140
  # @return [Integer] Hash code
132
141
  def hash
133
- [accounts, account_numbers, identity, transactions, investments].hash
142
+ [accounts, account_numbers, identity, transactions, investments, enrichment].hash
134
143
  end
135
144
 
136
145
  # Builds the object from hash
@@ -31,7 +31,7 @@ module MoneyKit
31
31
 
32
32
  attr_accessor :error_code
33
33
 
34
- # An ISO-8601 timestamp indicating the last time that the account was updated.
34
+ # (Deprecated) An ISO-8601 timestamp indicating the last time that the link was updated.
35
35
  attr_accessor :last_synced_at
36
36
 
37
37
  attr_accessor :tags
@@ -97,8 +97,8 @@ module MoneyKit
97
97
  :'institution_id' => :'String',
98
98
  :'institution_name' => :'String',
99
99
  :'institution_avatar' => :'String',
100
- :'state' => :'LinkState',
101
- :'error_code' => :'LinkError',
100
+ :'state' => :'PublicLinkState',
101
+ :'error_code' => :'PublicLinkError',
102
102
  :'last_synced_at' => :'Time',
103
103
  :'tags' => :'Array<String>',
104
104
  :'products' => :'LinkProducts',
@@ -97,8 +97,6 @@ module MoneyKit
97
97
 
98
98
  if attributes.key?(:'primary')
99
99
  self.primary = attributes[:'primary']
100
- else
101
- self.primary = false
102
100
  end
103
101
 
104
102
  if attributes.key?(:'type')
@@ -20,9 +20,10 @@ module MoneyKit
20
20
  IDENTITY = "identity".freeze
21
21
  TRANSACTIONS = "transactions".freeze
22
22
  INVESTMENTS = "investments".freeze
23
+ ENRICHMENT = "enrichment".freeze
23
24
 
24
25
  def self.all_vars
25
- @all_vars ||= [ACCOUNTS, ACCOUNT_NUMBERS, IDENTITY, TRANSACTIONS, INVESTMENTS].freeze
26
+ @all_vars ||= [ACCOUNTS, ACCOUNT_NUMBERS, IDENTITY, TRANSACTIONS, INVESTMENTS, ENRICHMENT].freeze
26
27
  end
27
28
 
28
29
  # Builds the enum from string
@@ -21,10 +21,9 @@ module MoneyKit
21
21
  YODLEE = "yodlee".freeze
22
22
  MX = "mx".freeze
23
23
  AKOYA = "akoya".freeze
24
- SOPHTRON = "sophtron".freeze
25
24
 
26
25
  def self.all_vars
27
- @all_vars ||= [MONEYKIT, FINICITY, PLAID, YODLEE, MX, AKOYA, SOPHTRON].freeze
26
+ @all_vars ||= [MONEYKIT, FINICITY, PLAID, YODLEE, MX, AKOYA].freeze
28
27
  end
29
28
 
30
29
  # Builds the enum from string
@@ -3,7 +3,7 @@
3
3
 
4
4
  #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
- The version of the OpenAPI document: 0.1.0
6
+ The version of the OpenAPI document: 2023-02-18
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  OpenAPI Generator version: 7.1.0
@@ -0,0 +1,43 @@
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 PublicLinkState
18
+ CONNECTING = "connecting".freeze
19
+ AWAITING_TOKEN_EXCHANGE = "awaiting_token_exchange".freeze
20
+ CONNECTED = "connected".freeze
21
+ DELETED = "deleted".freeze
22
+ ERROR = "error".freeze
23
+
24
+ def self.all_vars
25
+ @all_vars ||= [CONNECTING, AWAITING_TOKEN_EXCHANGE, CONNECTED, DELETED, ERROR].freeze
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def self.build_from_hash(value)
32
+ new.build_from_hash(value)
33
+ end
34
+
35
+ # Builds the enum from string
36
+ # @param [String] The enum value in the form of the string
37
+ # @return [String] The enum value
38
+ def build_from_hash(value)
39
+ return value if PublicLinkState.all_vars.include?(value)
40
+ raise "Invalid ENUM value #{value} for class #PublicLinkState"
41
+ end
42
+ end
43
+ end
@@ -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 Response401DeleteLinkLinksIdDelete
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
@@ -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 Response401GetTransactionsSyncLinksIdTransactionsSyncGet
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