moneykit 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/moneykit/api/access_token_api.rb +9 -9
  4. data/lib/moneykit/api/account_numbers_api.rb +6 -6
  5. data/lib/moneykit/api/accounts_api.rb +15 -15
  6. data/lib/moneykit/api/identity_api.rb +6 -6
  7. data/lib/moneykit/api/institutions_api.rb +7 -7
  8. data/lib/moneykit/api/link_session_api.rb +7 -7
  9. data/lib/moneykit/api/links_api.rb +76 -13
  10. data/lib/moneykit/api/products_api.rb +6 -6
  11. data/lib/moneykit/api/transactions_api.rb +28 -28
  12. data/lib/moneykit/api/users_api.rb +14 -14
  13. data/lib/moneykit/api/webhooks_api.rb +97 -0
  14. data/lib/moneykit/api_client.rb +40 -36
  15. data/lib/moneykit/api_error.rb +1 -1
  16. data/lib/moneykit/configuration.rb +20 -30
  17. data/lib/moneykit/models/account.rb +27 -54
  18. data/lib/moneykit/models/account_balances.rb +18 -27
  19. data/lib/moneykit/models/account_group.rb +23 -26
  20. data/lib/moneykit/models/account_identity.rb +34 -59
  21. data/lib/moneykit/models/account_numbers.rb +75 -51
  22. data/lib/moneykit/models/account_numbers_link_product.rb +18 -28
  23. data/lib/moneykit/models/account_numbers_product_settings.rb +16 -21
  24. data/lib/moneykit/models/account_with_account_numbers.rb +29 -56
  25. data/lib/moneykit/models/accounts_link_product.rb +17 -25
  26. data/lib/moneykit/models/ach_number.rb +19 -26
  27. data/lib/moneykit/models/address.rb +17 -28
  28. data/lib/moneykit/models/api_error_auth_expired_access_token_response.rb +17 -24
  29. data/lib/moneykit/models/api_error_auth_unauthorized_response.rb +18 -25
  30. data/lib/moneykit/models/api_error_rate_limit_exceeded_response.rb +17 -24
  31. data/lib/moneykit/models/bacs_number.rb +18 -25
  32. data/lib/moneykit/models/basic_account_details.rb +20 -29
  33. data/lib/moneykit/models/country.rb +1 -1
  34. data/lib/moneykit/models/create_link_session_request.rb +48 -45
  35. data/lib/moneykit/models/create_link_session_response.rb +17 -24
  36. data/lib/moneykit/models/currency.rb +1 -1
  37. data/lib/moneykit/models/cursor_pagination.rb +17 -24
  38. data/lib/moneykit/models/customer_app.rb +18 -25
  39. data/lib/moneykit/models/eft_number.rb +19 -26
  40. data/lib/moneykit/models/email.rb +17 -22
  41. data/lib/moneykit/models/exchange_token_request.rb +17 -24
  42. data/lib/moneykit/models/exchange_token_response.rb +19 -26
  43. data/lib/moneykit/models/generate_access_token_response.rb +19 -26
  44. data/lib/moneykit/models/get_account_numbers_response.rb +23 -26
  45. data/lib/moneykit/models/get_account_response.rb +19 -26
  46. data/lib/moneykit/models/get_accounts_response.rb +25 -31
  47. data/lib/moneykit/models/get_institutions_response.rb +25 -31
  48. data/lib/moneykit/models/get_transactions_response.rb +34 -39
  49. data/lib/moneykit/models/get_user_accounts_response.rb +24 -32
  50. data/lib/moneykit/models/get_user_links_response.rb +24 -32
  51. data/lib/moneykit/models/get_user_transactions_response.rb +32 -34
  52. data/lib/moneykit/models/http_validation_error.rb +24 -28
  53. data/lib/moneykit/models/identity_link_product.rb +18 -28
  54. data/lib/moneykit/models/identity_product_settings.rb +16 -21
  55. data/lib/moneykit/models/identity_response.rb +24 -30
  56. data/lib/moneykit/models/institution.rb +29 -38
  57. data/lib/moneykit/models/institution_error_not_found_response.rb +17 -24
  58. data/lib/moneykit/models/international_number.rb +18 -25
  59. data/lib/moneykit/models/introspect_client_response.rb +22 -29
  60. data/lib/moneykit/models/jwk_set.rb +23 -26
  61. data/lib/moneykit/models/link_common.rb +25 -39
  62. data/lib/moneykit/models/link_error_bad_config_response.rb +269 -0
  63. data/lib/moneykit/models/link_error_bad_state_response.rb +19 -28
  64. data/lib/moneykit/models/link_error_deleted_response.rb +17 -24
  65. data/lib/moneykit/models/link_error_forbidden_action_response.rb +18 -25
  66. data/lib/moneykit/models/link_error_not_found_response.rb +17 -24
  67. data/lib/moneykit/models/link_error_unauthorized_access_response.rb +17 -24
  68. data/lib/moneykit/models/link_permission_scope.rb +1 -1
  69. data/lib/moneykit/models/link_permissions.rb +23 -33
  70. data/lib/moneykit/models/link_products.rb +16 -21
  71. data/lib/moneykit/models/link_response.rb +26 -39
  72. data/lib/moneykit/models/link_session_customer_user.rb +20 -28
  73. data/lib/moneykit/models/link_session_customer_user_email.rb +18 -25
  74. data/lib/moneykit/models/link_session_customer_user_phone.rb +18 -26
  75. data/lib/moneykit/models/link_session_error_forbidden_config_response.rb +18 -25
  76. data/lib/moneykit/models/link_session_error_invalid_token_exchange.rb +18 -25
  77. data/lib/moneykit/models/link_session_setting_overrides.rb +19 -43
  78. data/lib/moneykit/models/link_state.rb +1 -1
  79. data/lib/moneykit/models/link_state_changed_webhook.rb +28 -31
  80. data/lib/moneykit/models/money_link_features.rb +27 -32
  81. data/lib/moneykit/models/owner.rb +42 -42
  82. data/lib/moneykit/models/phone_number.rb +18 -25
  83. data/lib/moneykit/models/phone_number_type.rb +1 -1
  84. data/lib/moneykit/models/product.rb +1 -1
  85. data/lib/moneykit/models/products_settings.rb +19 -24
  86. data/lib/moneykit/models/provider.rb +4 -2
  87. data/lib/moneykit/models/public_link_error.rb +43 -0
  88. data/lib/moneykit/models/refresh_products_request.rb +23 -34
  89. data/lib/moneykit/models/requested_link_permission.rb +19 -26
  90. data/lib/moneykit/models/response401_disconnect_links_id_delete.rb +75 -269
  91. data/lib/moneykit/models/response401_exchange_token_link_session_exchange_token_post.rb +74 -267
  92. data/lib/moneykit/models/response401_get_account_links_id_accounts_account_id_get.rb +75 -269
  93. data/lib/moneykit/models/response401_get_account_numbers_links_id_accounts_numbers_get.rb +75 -269
  94. data/lib/moneykit/models/response401_get_accounts_links_id_accounts_get.rb +75 -269
  95. data/lib/moneykit/models/response401_get_identities_links_id_identity_get.rb +75 -269
  96. data/lib/moneykit/models/response401_get_institution_institutions_institution_id_get.rb +74 -267
  97. data/lib/moneykit/models/response401_get_institutions_institutions_get.rb +74 -267
  98. data/lib/moneykit/models/response401_get_link_links_id_get.rb +75 -269
  99. data/lib/moneykit/models/response401_get_transactions_diff_links_id_transactions_sync_get.rb +75 -269
  100. data/lib/moneykit/models/response401_get_transactions_links_id_transactions_get.rb +75 -269
  101. data/lib/moneykit/models/response401_get_user_accounts_users_id_accounts_get.rb +74 -267
  102. data/lib/moneykit/models/response401_get_user_links_users_id_links_get.rb +74 -267
  103. data/lib/moneykit/models/response401_get_user_transactions_users_id_transactions_get.rb +74 -267
  104. data/lib/moneykit/models/response401_get_well_known_jwks_well_known_jwks_json_get.rb +74 -267
  105. data/lib/moneykit/models/response401_instrospect_client_auth_introspect_get.rb +74 -267
  106. data/lib/moneykit/models/response401_refresh_products_links_id_products_post.rb +75 -269
  107. data/lib/moneykit/models/response401_reset_login_links_id_reset_post.rb +102 -0
  108. data/lib/moneykit/models/response401_trigger_test_link_webhook_event_webhooks_test_link_id_post.rb +102 -0
  109. data/lib/moneykit/models/response401_update_link_links_id_patch.rb +75 -269
  110. data/lib/moneykit/models/transaction.rb +35 -35
  111. data/lib/moneykit/models/transaction_diff.rb +36 -37
  112. data/lib/moneykit/models/transaction_sync_response.rb +23 -30
  113. data/lib/moneykit/models/transaction_type.rb +1 -1
  114. data/lib/moneykit/models/transaction_type_filter.rb +1 -1
  115. data/lib/moneykit/models/transactions_link_product.rb +18 -28
  116. data/lib/moneykit/models/transactions_product_settings.rb +16 -21
  117. data/lib/moneykit/models/update_link_request.rb +21 -28
  118. data/lib/moneykit/models/validation_error.rb +25 -28
  119. data/lib/moneykit/models/validation_error_location_inner.rb +101 -0
  120. data/lib/moneykit/models/webhook_link_test_event.rb +40 -0
  121. data/lib/moneykit/models/webhook_test_link_request.rb +252 -0
  122. data/lib/moneykit/models/webhook_test_link_response.rb +220 -0
  123. data/lib/moneykit/version.rb +2 -2
  124. data/lib/moneykit.rb +10 -29
  125. data/lib/plaid_compatible/money_kit_plaid_compatible/api/plaid_api.rb +684 -679
  126. data/lib/plaid_compatible/money_kit_plaid_compatible/api_client.rb +330 -330
  127. data/lib/plaid_compatible/money_kit_plaid_compatible/api_error.rb +33 -33
  128. data/lib/plaid_compatible/money_kit_plaid_compatible/configuration.rb +245 -245
  129. data/lib/plaid_compatible/money_kit_plaid_compatible/models/account_balance.rb +198 -198
  130. data/lib/plaid_compatible/money_kit_plaid_compatible/models/account_base.rb +213 -213
  131. data/lib/plaid_compatible/money_kit_plaid_compatible/models/account_identity.rb +223 -223
  132. data/lib/plaid_compatible/money_kit_plaid_compatible/models/account_subtype.rb +89 -89
  133. data/lib/plaid_compatible/money_kit_plaid_compatible/models/account_type.rb +22 -22
  134. data/lib/plaid_compatible/money_kit_plaid_compatible/models/accounts_get_request.rb +198 -198
  135. data/lib/plaid_compatible/money_kit_plaid_compatible/models/accounts_get_request_options.rb +175 -175
  136. data/lib/plaid_compatible/money_kit_plaid_compatible/models/accounts_get_response.rb +194 -194
  137. data/lib/plaid_compatible/money_kit_plaid_compatible/models/address.rb +183 -183
  138. data/lib/plaid_compatible/money_kit_plaid_compatible/models/address_data.rb +209 -209
  139. data/lib/plaid_compatible/money_kit_plaid_compatible/models/auth_get_numbers.rb +211 -209
  140. data/lib/plaid_compatible/money_kit_plaid_compatible/models/auth_get_request.rb +198 -198
  141. data/lib/plaid_compatible/money_kit_plaid_compatible/models/auth_get_request_options.rb +175 -175
  142. data/lib/plaid_compatible/money_kit_plaid_compatible/models/auth_get_response.rb +200 -200
  143. data/lib/plaid_compatible/money_kit_plaid_compatible/models/country_code.rb +19 -19
  144. data/lib/plaid_compatible/money_kit_plaid_compatible/models/email.rb +184 -184
  145. data/lib/plaid_compatible/money_kit_plaid_compatible/models/http_validation_error.rb +171 -171
  146. data/lib/plaid_compatible/money_kit_plaid_compatible/models/identity_get_request.rb +198 -198
  147. data/lib/plaid_compatible/money_kit_plaid_compatible/models/identity_get_request_options.rb +175 -175
  148. data/lib/plaid_compatible/money_kit_plaid_compatible/models/identity_get_response.rb +194 -194
  149. data/lib/plaid_compatible/money_kit_plaid_compatible/models/institution.rb +216 -214
  150. data/lib/plaid_compatible/money_kit_plaid_compatible/models/institutions_get_by_id_request.rb +202 -202
  151. data/lib/plaid_compatible/money_kit_plaid_compatible/models/institutions_get_by_id_response.rb +183 -183
  152. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item.rb +246 -245
  153. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_error_webhook.rb +208 -208
  154. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_get_request.rb +192 -192
  155. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_get_response.rb +189 -189
  156. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_public_token_exchange_request.rb +192 -192
  157. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_public_token_exchange_response.rb +193 -193
  158. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_remove_request.rb +192 -192
  159. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_remove_response.rb +175 -175
  160. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_status_investments.rb +182 -182
  161. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_status_last_webhook.rb +182 -182
  162. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_status_nullable.rb +183 -183
  163. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_status_transactions.rb +182 -182
  164. data/lib/plaid_compatible/money_kit_plaid_compatible/models/link_token_create_request.rb +268 -266
  165. data/lib/plaid_compatible/money_kit_plaid_compatible/models/link_token_create_request_user.rb +212 -212
  166. data/lib/plaid_compatible/money_kit_plaid_compatible/models/link_token_create_response.rb +193 -193
  167. data/lib/plaid_compatible/money_kit_plaid_compatible/models/numbers_ach.rb +202 -202
  168. data/lib/plaid_compatible/money_kit_plaid_compatible/models/numbers_bacs.rb +193 -193
  169. data/lib/plaid_compatible/money_kit_plaid_compatible/models/numbers_eft.rb +202 -202
  170. data/lib/plaid_compatible/money_kit_plaid_compatible/models/numbers_international.rb +193 -193
  171. data/lib/plaid_compatible/money_kit_plaid_compatible/models/owner.rb +211 -209
  172. data/lib/plaid_compatible/money_kit_plaid_compatible/models/personal_finance_category.rb +184 -184
  173. data/lib/plaid_compatible/money_kit_plaid_compatible/models/phone_number.rb +193 -193
  174. data/lib/plaid_compatible/money_kit_plaid_compatible/models/plaid_error.rb +247 -245
  175. data/lib/plaid_compatible/money_kit_plaid_compatible/models/plaid_error_type.rb +30 -30
  176. data/lib/plaid_compatible/money_kit_plaid_compatible/models/products.rb +20 -20
  177. data/lib/plaid_compatible/money_kit_plaid_compatible/models/removed_transaction.rb +174 -174
  178. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transaction.rb +283 -283
  179. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_get_request.rb +217 -217
  180. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_get_request_options.rb +211 -211
  181. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_get_response.rb +217 -217
  182. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_refresh_request.rb +192 -192
  183. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_refresh_response.rb +175 -175
  184. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_sync_request.rb +215 -215
  185. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_sync_request_options.rb +184 -184
  186. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_sync_response.rb +228 -228
  187. data/lib/plaid_compatible/money_kit_plaid_compatible/models/validation_error.rb +187 -187
  188. data/lib/plaid_compatible/money_kit_plaid_compatible/models/webhook_environment_values.rb +19 -19
  189. data/lib/plaid_compatible/money_kit_plaid_compatible/version.rb +1 -1
  190. data/lib/plaid_compatible/money_kit_plaid_compatible.rb +13 -13
  191. data/moneykit.gemspec +2 -1
  192. metadata +14 -5
@@ -5,7 +5,7 @@
5
5
  # The version of the OpenAPI document: 0.1.0
6
6
  #
7
7
  # Generated by: https://openapi-generator.tech
8
- # OpenAPI Generator version: 6.5.0
8
+ # OpenAPI Generator version: 7.1.0
9
9
  #
10
10
 
11
11
  require 'cgi'
@@ -19,11 +19,11 @@ module MoneyKit
19
19
  end
20
20
 
21
21
  # /links/{id}/products
22
- # Requests an update of the provided products for the link. This is an asynchronous operation. The response will be a 202 Accepted if the request was successful.
22
+ # Requests an update of the provided products for the link. This is an asynchronous operation. The response will be a 202 Accepted if the request was successful. Refreshes are subject to rate limiting. <br><br> <b>Rate Limiting</b><br> <ul> <li>1 refresh per link per hour for account data</li> <li>1 refresh per link per hour for transaction data</li> <li>1 refresh per link per day for account numbers</li> <li>1 refresh per link per day for identity data</li> </ul>
23
23
  # @param id [String] The unique ID for this link.
24
24
  # @param refresh_products_request [RefreshProductsRequest]
25
25
  # @param [Hash] opts the optional parameters
26
- # @option opts [SupportedVersion] :moneykit_version
26
+ # @option opts [String] :moneykit_version (default to '2023-02-18')
27
27
  # @return [nil]
28
28
  def refresh_products(id, refresh_products_request, opts = {})
29
29
  refresh_products_with_http_info(id, refresh_products_request, opts)
@@ -31,11 +31,11 @@ module MoneyKit
31
31
  end
32
32
 
33
33
  # /links/{id}/products
34
- # Requests an update of the provided products for the link. This is an asynchronous operation. The response will be a 202 Accepted if the request was successful.
34
+ # Requests an update of the provided products for the link. This is an asynchronous operation. The response will be a 202 Accepted if the request was successful. Refreshes are subject to rate limiting. &lt;br&gt;&lt;br&gt; &lt;b&gt;Rate Limiting&lt;/b&gt;&lt;br&gt; &lt;ul&gt; &lt;li&gt;1 refresh per link per hour for account data&lt;/li&gt; &lt;li&gt;1 refresh per link per hour for transaction data&lt;/li&gt; &lt;li&gt;1 refresh per link per day for account numbers&lt;/li&gt; &lt;li&gt;1 refresh per link per day for identity data&lt;/li&gt; &lt;/ul&gt;
35
35
  # @param id [String] The unique ID for this link.
36
36
  # @param refresh_products_request [RefreshProductsRequest]
37
37
  # @param [Hash] opts the optional parameters
38
- # @option opts [SupportedVersion] :moneykit_version
38
+ # @option opts [String] :moneykit_version (default to '2023-02-18')
39
39
  # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
40
40
  def refresh_products_with_http_info(id, refresh_products_request, opts = {})
41
41
  @api_client.config.logger.debug 'Calling API: ProductsApi.refresh_products ...' if @api_client.config.debugging
@@ -75,7 +75,7 @@ module MoneyKit
75
75
  return_type = opts[:debug_return_type]
76
76
 
77
77
  # auth_names
78
- auth_names = opts[:debug_auth_names] || %w[clientId OAuth2ClientCredentials clientSecret]
78
+ auth_names = opts[:debug_auth_names] || ['OAuth2ClientCredentials']
79
79
 
80
80
  new_options = opts.merge(
81
81
  operation: :"ProductsApi.refresh_products",
@@ -5,7 +5,7 @@
5
5
  # The version of the OpenAPI document: 0.1.0
6
6
  #
7
7
  # Generated by: https://openapi-generator.tech
8
- # OpenAPI Generator version: 6.5.0
8
+ # OpenAPI Generator version: 7.1.0
9
9
  #
10
10
 
11
11
  require 'cgi'
@@ -19,15 +19,15 @@ module MoneyKit
19
19
  end
20
20
 
21
21
  # /links/{id}/transactions
22
- # Fetches transactions for the accounts associated with a <a href=#tag/Links>link</a>. Results are paginated, and returned in reverse chronological order. <p>MoneyKit checks for updated account data, including transactions, periodically throughout the day, but the update frequency can vary, depending on the downstream data provider and the institution. To force a check for updated transactions, you can use the <a href=#operation/refresh_products>/products</a> endpoint.
22
+ # Returns transactions for the accounts associated with a <a href=#tag/Links>link</a>. Results are paginated, and returned in reverse chronological order. <p>**Note** that this endpoint does **not** trigger a fetch of transactions from the institution; it merely returns transactions that have already been fetched, either because `prefetch` was requested when the link was created, or because of scheduled or on-demand updates. <p>MoneyKit checks for updated account data, including transactions, periodically throughout the day, but the update frequency can vary, depending on the downstream data provider, the institution, and whether one or both provide webhook-based updates. **To force a check for updated transactions, you can use the <a href=#operation/refresh_products>/products</a> endpoint.** <p>If you have requested prefetch or an on-demand update, you should check the `refreshed_at` date for this product in the returned response, and compare that against the previous `refreshed_at` date, which you can get from any previous response for this or any other account or link request. If the refreshed_at date has not increased, then updated data is not yet available.
23
23
  # @param id [String] The unique ID for this link.
24
24
  # @param [Hash] opts the optional parameters
25
25
  # @option opts [Array<String>] :account_ids An optional list of account IDs to filter the results.
26
- # @option opts [Integer] :page (default to 1)
27
- # @option opts [Integer] :size (default to 50)
26
+ # @option opts [Integer] :page The page number to return. (default to 1)
27
+ # @option opts [Integer] :size The number of items to return per page. (default to 50)
28
28
  # @option opts [String] :start_date The earliest date for which data should be returned, formatted as YYYY-MM-DD. Defaults to 90 days before the &#x60;end_date&#x60;. &lt;p&gt;If you want to retrieve **all** transactions, use &#x60;1900-01-01&#x60;.
29
29
  # @option opts [String] :end_date The latest date for which data should be returned, formatted as YYYY-MM-DD. Defaults to today.
30
- # @option opts [SupportedVersion] :moneykit_version
30
+ # @option opts [String] :moneykit_version (default to '2023-02-18')
31
31
  # @return [GetTransactionsResponse]
32
32
  def get_transactions(id, opts = {})
33
33
  data, _status_code, _headers = get_transactions_with_http_info(id, opts)
@@ -35,15 +35,15 @@ module MoneyKit
35
35
  end
36
36
 
37
37
  # /links/{id}/transactions
38
- # Fetches transactions for the accounts associated with a &lt;a href&#x3D;#tag/Links&gt;link&lt;/a&gt;. Results are paginated, and returned in reverse chronological order. &lt;p&gt;MoneyKit checks for updated account data, including transactions, periodically throughout the day, but the update frequency can vary, depending on the downstream data provider and the institution. To force a check for updated transactions, you can use the &lt;a href&#x3D;#operation/refresh_products&gt;/products&lt;/a&gt; endpoint.
38
+ # Returns transactions for the accounts associated with a &lt;a href&#x3D;#tag/Links&gt;link&lt;/a&gt;. Results are paginated, and returned in reverse chronological order. &lt;p&gt;**Note** that this endpoint does **not** trigger a fetch of transactions from the institution; it merely returns transactions that have already been fetched, either because &#x60;prefetch&#x60; was requested when the link was created, or because of scheduled or on-demand updates. &lt;p&gt;MoneyKit checks for updated account data, including transactions, periodically throughout the day, but the update frequency can vary, depending on the downstream data provider, the institution, and whether one or both provide webhook-based updates. **To force a check for updated transactions, you can use the &lt;a href&#x3D;#operation/refresh_products&gt;/products&lt;/a&gt; endpoint.** &lt;p&gt;If you have requested prefetch or an on-demand update, you should check the &#x60;refreshed_at&#x60; date for this product in the returned response, and compare that against the previous &#x60;refreshed_at&#x60; date, which you can get from any previous response for this or any other account or link request. If the refreshed_at date has not increased, then updated data is not yet available.
39
39
  # @param id [String] The unique ID for this link.
40
40
  # @param [Hash] opts the optional parameters
41
41
  # @option opts [Array<String>] :account_ids An optional list of account IDs to filter the results.
42
- # @option opts [Integer] :page (default to 1)
43
- # @option opts [Integer] :size (default to 50)
42
+ # @option opts [Integer] :page The page number to return. (default to 1)
43
+ # @option opts [Integer] :size The number of items to return per page. (default to 50)
44
44
  # @option opts [String] :start_date The earliest date for which data should be returned, formatted as YYYY-MM-DD. Defaults to 90 days before the &#x60;end_date&#x60;. &lt;p&gt;If you want to retrieve **all** transactions, use &#x60;1900-01-01&#x60;.
45
45
  # @option opts [String] :end_date The latest date for which data should be returned, formatted as YYYY-MM-DD. Defaults to today.
46
- # @option opts [SupportedVersion] :moneykit_version
46
+ # @option opts [String] :moneykit_version (default to '2023-02-18')
47
47
  # @return [Array<(GetTransactionsResponse, Integer, Hash)>] GetTransactionsResponse data, response status code and response headers
48
48
  def get_transactions_with_http_info(id, opts = {})
49
49
  if @api_client.config.debugging
@@ -99,7 +99,7 @@ module MoneyKit
99
99
  return_type = opts[:debug_return_type] || 'GetTransactionsResponse'
100
100
 
101
101
  # auth_names
102
- auth_names = opts[:debug_auth_names] || %w[clientId OAuth2ClientCredentials clientSecret]
102
+ auth_names = opts[:debug_auth_names] || ['OAuth2ClientCredentials']
103
103
 
104
104
  new_options = opts.merge(
105
105
  operation: :"TransactionsApi.get_transactions",
@@ -119,12 +119,12 @@ module MoneyKit
119
119
  end
120
120
 
121
121
  # /links/{id}/transactions/sync
122
- # TODO
122
+ # Provides a paginated feed of transactions, grouped into `created`, `updated`, and `removed` lists. <p>Each call will also return a `next_cursor` value. In subsequent calls, include that value to receive only changes that have occurred since the previous call. <p>Large numbers of transactions will be paginated, and the `has_more` field will be true. You should continue calling this endpoint with each new `next_cursor` value until `has_more` is false. <p>**Note** that this endpoint does **not** trigger a fetch of transactions from the institution; it merely returns transactions that have already been fetched, either because `prefetch` was requested when the link was created, or because of scheduled or on-demand updates. <p>MoneyKit checks for updated account data, including transactions, periodically throughout the day, but the update frequency can vary, depending on the downstream data provider, the institution, and whether one or both provide webhook-based updates. **To force a check for updated transactions, you can use the <a href=#operation/refresh_products>/products</a> endpoint.** <p>Note also that the `transactions.updates_available` webhook will alert you when new data is available.
123
123
  # @param id [String] The unique ID for this link.
124
124
  # @param [Hash] opts the optional parameters
125
- # @option opts [String] :cursor
126
- # @option opts [Integer] :size (default to 50)
127
- # @option opts [SupportedVersion] :moneykit_version
125
+ # @option opts [String] :cursor A cursor value representing the last update requested. If included, the response will only return changes after this update. If omitted, a complete history of updates will be returned. This value must be stored by the client as we do not keep track of customer cursors.
126
+ # @option opts [Integer] :size The number of items to return. (default to 50)
127
+ # @option opts [String] :moneykit_version (default to '2023-02-18')
128
128
  # @return [TransactionSyncResponse]
129
129
  def get_transactions_diff(id, opts = {})
130
130
  data, _status_code, _headers = get_transactions_diff_with_http_info(id, opts)
@@ -132,12 +132,12 @@ module MoneyKit
132
132
  end
133
133
 
134
134
  # /links/{id}/transactions/sync
135
- # TODO
135
+ # Provides a paginated feed of transactions, grouped into &#x60;created&#x60;, &#x60;updated&#x60;, and &#x60;removed&#x60; lists. &lt;p&gt;Each call will also return a &#x60;next_cursor&#x60; value. In subsequent calls, include that value to receive only changes that have occurred since the previous call. &lt;p&gt;Large numbers of transactions will be paginated, and the &#x60;has_more&#x60; field will be true. You should continue calling this endpoint with each new &#x60;next_cursor&#x60; value until &#x60;has_more&#x60; is false. &lt;p&gt;**Note** that this endpoint does **not** trigger a fetch of transactions from the institution; it merely returns transactions that have already been fetched, either because &#x60;prefetch&#x60; was requested when the link was created, or because of scheduled or on-demand updates. &lt;p&gt;MoneyKit checks for updated account data, including transactions, periodically throughout the day, but the update frequency can vary, depending on the downstream data provider, the institution, and whether one or both provide webhook-based updates. **To force a check for updated transactions, you can use the &lt;a href&#x3D;#operation/refresh_products&gt;/products&lt;/a&gt; endpoint.** &lt;p&gt;Note also that the &#x60;transactions.updates_available&#x60; webhook will alert you when new data is available.
136
136
  # @param id [String] The unique ID for this link.
137
137
  # @param [Hash] opts the optional parameters
138
- # @option opts [String] :cursor
139
- # @option opts [Integer] :size (default to 50)
140
- # @option opts [SupportedVersion] :moneykit_version
138
+ # @option opts [String] :cursor A cursor value representing the last update requested. If included, the response will only return changes after this update. If omitted, a complete history of updates will be returned. This value must be stored by the client as we do not keep track of customer cursors.
139
+ # @option opts [Integer] :size The number of items to return. (default to 50)
140
+ # @option opts [String] :moneykit_version (default to '2023-02-18')
141
141
  # @return [Array<(TransactionSyncResponse, Integer, Hash)>] TransactionSyncResponse data, response status code and response headers
142
142
  def get_transactions_diff_with_http_info(id, opts = {})
143
143
  if @api_client.config.debugging
@@ -148,9 +148,9 @@ module MoneyKit
148
148
  raise ArgumentError, "Missing the required parameter 'id' when calling TransactionsApi.get_transactions_diff"
149
149
  end
150
150
 
151
- if @api_client.config.client_side_validation && !opts[:size].nil? && opts[:size] > 100
151
+ if @api_client.config.client_side_validation && !opts[:size].nil? && opts[:size] > 500
152
152
  raise ArgumentError,
153
- 'invalid value for "opts[:"size"]" when calling TransactionsApi.get_transactions_diff, must be smaller than or equal to 100.'
153
+ 'invalid value for "opts[:"size"]" when calling TransactionsApi.get_transactions_diff, must be smaller than or equal to 500.'
154
154
  end
155
155
 
156
156
  if @api_client.config.client_side_validation && !opts[:size].nil? && opts[:size] < 1
@@ -182,7 +182,7 @@ module MoneyKit
182
182
  return_type = opts[:debug_return_type] || 'TransactionSyncResponse'
183
183
 
184
184
  # auth_names
185
- auth_names = opts[:debug_auth_names] || %w[clientId OAuth2ClientCredentials clientSecret]
185
+ auth_names = opts[:debug_auth_names] || ['OAuth2ClientCredentials']
186
186
 
187
187
  new_options = opts.merge(
188
188
  operation: :"TransactionsApi.get_transactions_diff",
@@ -209,11 +209,11 @@ module MoneyKit
209
209
  # @option opts [Array<String>] :category
210
210
  # @option opts [Array<String>] :account_id If present, filters results to transactions in accounts matching the given IDs.
211
211
  # @option opts [Array<String>] :institution_id If present, filters results to transactions at institutions matching the given IDs.
212
- # @option opts [Integer] :page (default to 1)
213
- # @option opts [Integer] :size (default to 50)
212
+ # @option opts [Integer] :page The page number to return. (default to 1)
213
+ # @option opts [Integer] :size The number of items to return per page. (default to 50)
214
214
  # @option opts [String] :start_date The earliest date for which data should be returned, formatted as YYYY-MM-DD. Defaults to 90 days before the &#x60;end_date&#x60;. &lt;p&gt;If you want to retrieve **all** transactions, use &#x60;1900-01-01&#x60;.
215
215
  # @option opts [String] :end_date The latest date for which data should be returned, formatted as YYYY-MM-DD. Defaults to today.
216
- # @option opts [SupportedVersion] :moneykit_version
216
+ # @option opts [String] :moneykit_version (default to '2023-02-18')
217
217
  # @return [GetUserTransactionsResponse]
218
218
  def get_user_transactions(id, opts = {})
219
219
  data, _status_code, _headers = get_user_transactions_with_http_info(id, opts)
@@ -228,11 +228,11 @@ module MoneyKit
228
228
  # @option opts [Array<String>] :category
229
229
  # @option opts [Array<String>] :account_id If present, filters results to transactions in accounts matching the given IDs.
230
230
  # @option opts [Array<String>] :institution_id If present, filters results to transactions at institutions matching the given IDs.
231
- # @option opts [Integer] :page (default to 1)
232
- # @option opts [Integer] :size (default to 50)
231
+ # @option opts [Integer] :page The page number to return. (default to 1)
232
+ # @option opts [Integer] :size The number of items to return per page. (default to 50)
233
233
  # @option opts [String] :start_date The earliest date for which data should be returned, formatted as YYYY-MM-DD. Defaults to 90 days before the &#x60;end_date&#x60;. &lt;p&gt;If you want to retrieve **all** transactions, use &#x60;1900-01-01&#x60;.
234
234
  # @option opts [String] :end_date The latest date for which data should be returned, formatted as YYYY-MM-DD. Defaults to today.
235
- # @option opts [SupportedVersion] :moneykit_version
235
+ # @option opts [String] :moneykit_version (default to '2023-02-18')
236
236
  # @return [Array<(GetUserTransactionsResponse, Integer, Hash)>] GetUserTransactionsResponse data, response status code and response headers
237
237
  def get_user_transactions_with_http_info(id, opts = {})
238
238
  if @api_client.config.debugging
@@ -300,7 +300,7 @@ module MoneyKit
300
300
  return_type = opts[:debug_return_type] || 'GetUserTransactionsResponse'
301
301
 
302
302
  # auth_names
303
- auth_names = opts[:debug_auth_names] || %w[clientId OAuth2ClientCredentials clientSecret]
303
+ auth_names = opts[:debug_auth_names] || ['OAuth2ClientCredentials']
304
304
 
305
305
  new_options = opts.merge(
306
306
  operation: :"TransactionsApi.get_user_transactions",
@@ -5,7 +5,7 @@
5
5
  # The version of the OpenAPI document: 0.1.0
6
6
  #
7
7
  # Generated by: https://openapi-generator.tech
8
- # OpenAPI Generator version: 6.5.0
8
+ # OpenAPI Generator version: 7.1.0
9
9
  #
10
10
 
11
11
  require 'cgi'
@@ -24,7 +24,7 @@ module MoneyKit
24
24
  # @param [Hash] opts the optional parameters
25
25
  # @option opts [Array<String>] :account_id If present, filters results to accounts matching the given IDs.
26
26
  # @option opts [Array<String>] :institution_id If present, filters results to accounts at institutions matching the given IDs.
27
- # @option opts [SupportedVersion] :moneykit_version
27
+ # @option opts [String] :moneykit_version (default to '2023-02-18')
28
28
  # @return [GetUserAccountsResponse]
29
29
  def get_user_accounts(id, opts = {})
30
30
  data, _status_code, _headers = get_user_accounts_with_http_info(id, opts)
@@ -37,7 +37,7 @@ module MoneyKit
37
37
  # @param [Hash] opts the optional parameters
38
38
  # @option opts [Array<String>] :account_id If present, filters results to accounts matching the given IDs.
39
39
  # @option opts [Array<String>] :institution_id If present, filters results to accounts at institutions matching the given IDs.
40
- # @option opts [SupportedVersion] :moneykit_version
40
+ # @option opts [String] :moneykit_version (default to '2023-02-18')
41
41
  # @return [Array<(GetUserAccountsResponse, Integer, Hash)>] GetUserAccountsResponse data, response status code and response headers
42
42
  def get_user_accounts_with_http_info(id, opts = {})
43
43
  @api_client.config.logger.debug 'Calling API: UsersApi.get_user_accounts ...' if @api_client.config.debugging
@@ -76,7 +76,7 @@ module MoneyKit
76
76
  return_type = opts[:debug_return_type] || 'GetUserAccountsResponse'
77
77
 
78
78
  # auth_names
79
- auth_names = opts[:debug_auth_names] || %w[clientId OAuth2ClientCredentials clientSecret]
79
+ auth_names = opts[:debug_auth_names] || ['OAuth2ClientCredentials']
80
80
 
81
81
  new_options = opts.merge(
82
82
  operation: :"UsersApi.get_user_accounts",
@@ -99,7 +99,7 @@ module MoneyKit
99
99
  # Fetches all links belonging to a <a href=#operation/get_user_accounts>user</a>.
100
100
  # @param id [String] The unique ID for this user. This is the same ID provided in the call to &lt;a href&#x3D;#operation/create_link_session&gt;/link-session&lt;/a&gt; to create any link for this user.
101
101
  # @param [Hash] opts the optional parameters
102
- # @option opts [SupportedVersion] :moneykit_version
102
+ # @option opts [String] :moneykit_version (default to '2023-02-18')
103
103
  # @return [GetUserLinksResponse]
104
104
  def get_user_links(id, opts = {})
105
105
  data, _status_code, _headers = get_user_links_with_http_info(id, opts)
@@ -110,7 +110,7 @@ module MoneyKit
110
110
  # Fetches all links belonging to a &lt;a href&#x3D;#operation/get_user_accounts&gt;user&lt;/a&gt;.
111
111
  # @param id [String] The unique ID for this user. This is the same ID provided in the call to &lt;a href&#x3D;#operation/create_link_session&gt;/link-session&lt;/a&gt; to create any link for this user.
112
112
  # @param [Hash] opts the optional parameters
113
- # @option opts [SupportedVersion] :moneykit_version
113
+ # @option opts [String] :moneykit_version (default to '2023-02-18')
114
114
  # @return [Array<(GetUserLinksResponse, Integer, Hash)>] GetUserLinksResponse data, response status code and response headers
115
115
  def get_user_links_with_http_info(id, opts = {})
116
116
  @api_client.config.logger.debug 'Calling API: UsersApi.get_user_links ...' if @api_client.config.debugging
@@ -141,7 +141,7 @@ module MoneyKit
141
141
  return_type = opts[:debug_return_type] || 'GetUserLinksResponse'
142
142
 
143
143
  # auth_names
144
- auth_names = opts[:debug_auth_names] || %w[clientId OAuth2ClientCredentials clientSecret]
144
+ auth_names = opts[:debug_auth_names] || ['OAuth2ClientCredentials']
145
145
 
146
146
  new_options = opts.merge(
147
147
  operation: :"UsersApi.get_user_links",
@@ -168,11 +168,11 @@ module MoneyKit
168
168
  # @option opts [Array<String>] :category
169
169
  # @option opts [Array<String>] :account_id If present, filters results to transactions in accounts matching the given IDs.
170
170
  # @option opts [Array<String>] :institution_id If present, filters results to transactions at institutions matching the given IDs.
171
- # @option opts [Integer] :page (default to 1)
172
- # @option opts [Integer] :size (default to 50)
171
+ # @option opts [Integer] :page The page number to return. (default to 1)
172
+ # @option opts [Integer] :size The number of items to return per page. (default to 50)
173
173
  # @option opts [String] :start_date The earliest date for which data should be returned, formatted as YYYY-MM-DD. Defaults to 90 days before the &#x60;end_date&#x60;. &lt;p&gt;If you want to retrieve **all** transactions, use &#x60;1900-01-01&#x60;.
174
174
  # @option opts [String] :end_date The latest date for which data should be returned, formatted as YYYY-MM-DD. Defaults to today.
175
- # @option opts [SupportedVersion] :moneykit_version
175
+ # @option opts [String] :moneykit_version (default to '2023-02-18')
176
176
  # @return [GetUserTransactionsResponse]
177
177
  def get_user_transactions(id, opts = {})
178
178
  data, _status_code, _headers = get_user_transactions_with_http_info(id, opts)
@@ -187,11 +187,11 @@ module MoneyKit
187
187
  # @option opts [Array<String>] :category
188
188
  # @option opts [Array<String>] :account_id If present, filters results to transactions in accounts matching the given IDs.
189
189
  # @option opts [Array<String>] :institution_id If present, filters results to transactions at institutions matching the given IDs.
190
- # @option opts [Integer] :page (default to 1)
191
- # @option opts [Integer] :size (default to 50)
190
+ # @option opts [Integer] :page The page number to return. (default to 1)
191
+ # @option opts [Integer] :size The number of items to return per page. (default to 50)
192
192
  # @option opts [String] :start_date The earliest date for which data should be returned, formatted as YYYY-MM-DD. Defaults to 90 days before the &#x60;end_date&#x60;. &lt;p&gt;If you want to retrieve **all** transactions, use &#x60;1900-01-01&#x60;.
193
193
  # @option opts [String] :end_date The latest date for which data should be returned, formatted as YYYY-MM-DD. Defaults to today.
194
- # @option opts [SupportedVersion] :moneykit_version
194
+ # @option opts [String] :moneykit_version (default to '2023-02-18')
195
195
  # @return [Array<(GetUserTransactionsResponse, Integer, Hash)>] GetUserTransactionsResponse data, response status code and response headers
196
196
  def get_user_transactions_with_http_info(id, opts = {})
197
197
  @api_client.config.logger.debug 'Calling API: UsersApi.get_user_transactions ...' if @api_client.config.debugging
@@ -257,7 +257,7 @@ module MoneyKit
257
257
  return_type = opts[:debug_return_type] || 'GetUserTransactionsResponse'
258
258
 
259
259
  # auth_names
260
- auth_names = opts[:debug_auth_names] || %w[clientId OAuth2ClientCredentials clientSecret]
260
+ auth_names = opts[:debug_auth_names] || ['OAuth2ClientCredentials']
261
261
 
262
262
  new_options = opts.merge(
263
263
  operation: :"UsersApi.get_user_transactions",
@@ -0,0 +1,97 @@
1
+ # #MoneyKit API
2
+ #
3
+ # No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ #
5
+ # The version of the OpenAPI document: 0.1.0
6
+ #
7
+ # Generated by: https://openapi-generator.tech
8
+ # OpenAPI Generator version: 7.1.0
9
+ #
10
+
11
+ require 'cgi'
12
+
13
+ module MoneyKit
14
+ class WebhooksApi
15
+ attr_accessor :api_client
16
+
17
+ def initialize(api_client = ApiClient.default)
18
+ @api_client = api_client
19
+ end
20
+
21
+ # Trigger a test webhook event for a link (Sandbox only).
22
+ # @param id [String] The unique ID for this link.
23
+ # @param webhook_test_link_request [WebhookTestLinkRequest]
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [String] :moneykit_version (default to '2023-02-18')
26
+ # @return [WebhookTestLinkResponse]
27
+ def trigger_test_link_webhook_event(id, webhook_test_link_request, opts = {})
28
+ data, _status_code, _headers = trigger_test_link_webhook_event_with_http_info(id, webhook_test_link_request, opts)
29
+ data
30
+ end
31
+
32
+ # Trigger a test webhook event for a link (Sandbox only).
33
+ # @param id [String] The unique ID for this link.
34
+ # @param webhook_test_link_request [WebhookTestLinkRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @option opts [String] :moneykit_version (default to '2023-02-18')
37
+ # @return [Array<(WebhookTestLinkResponse, Integer, Hash)>] WebhookTestLinkResponse data, response status code and response headers
38
+ def trigger_test_link_webhook_event_with_http_info(id, webhook_test_link_request, opts = {})
39
+ if @api_client.config.debugging
40
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.trigger_test_link_webhook_event ...'
41
+ end
42
+ # verify the required parameter 'id' is set
43
+ if @api_client.config.client_side_validation && id.nil?
44
+ raise ArgumentError,
45
+ "Missing the required parameter 'id' when calling WebhooksApi.trigger_test_link_webhook_event"
46
+ end
47
+ # verify the required parameter 'webhook_test_link_request' is set
48
+ if @api_client.config.client_side_validation && webhook_test_link_request.nil?
49
+ raise ArgumentError,
50
+ "Missing the required parameter 'webhook_test_link_request' when calling WebhooksApi.trigger_test_link_webhook_event"
51
+ end
52
+
53
+ # resource path
54
+ local_var_path = '/webhooks/test/link/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
55
+
56
+ # query parameters
57
+ query_params = opts[:query_params] || {}
58
+
59
+ # header parameters
60
+ header_params = opts[:header_params] || {}
61
+ # HTTP header 'Accept' (if needed)
62
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
63
+ # HTTP header 'Content-Type'
64
+ content_type = @api_client.select_header_content_type(['application/json'])
65
+ header_params['Content-Type'] = content_type unless content_type.nil?
66
+ header_params[:'moneykit-version'] = opts[:moneykit_version] unless opts[:moneykit_version].nil?
67
+
68
+ # form parameters
69
+ form_params = opts[:form_params] || {}
70
+
71
+ # http body (model)
72
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_test_link_request)
73
+
74
+ # return_type
75
+ return_type = opts[:debug_return_type] || 'WebhookTestLinkResponse'
76
+
77
+ # auth_names
78
+ auth_names = opts[:debug_auth_names] || ['OAuth2ClientCredentials']
79
+
80
+ new_options = opts.merge(
81
+ operation: :"WebhooksApi.trigger_test_link_webhook_event",
82
+ header_params: header_params,
83
+ query_params: query_params,
84
+ form_params: form_params,
85
+ body: post_body,
86
+ auth_names: auth_names,
87
+ return_type: return_type
88
+ )
89
+
90
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
91
+ if @api_client.config.debugging
92
+ @api_client.config.logger.debug "API called: WebhooksApi#trigger_test_link_webhook_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
93
+ end
94
+ [data, status_code, headers]
95
+ end
96
+ end
97
+ end
@@ -5,7 +5,7 @@
5
5
  # The version of the OpenAPI document: 0.1.0
6
6
  #
7
7
  # Generated by: https://openapi-generator.tech
8
- # OpenAPI Generator version: 6.5.0
8
+ # OpenAPI Generator version: 7.1.0
9
9
  #
10
10
 
11
11
  require 'date'
@@ -46,9 +46,11 @@ module MoneyKit
46
46
  # @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
47
47
  # the data deserialized from response body (could be nil), response status code and response headers.
48
48
  def call_api(http_method, path, opts = {})
49
+ stream = nil
49
50
  begin
50
51
  response = connection(opts).public_send(http_method.to_sym.downcase) do |req|
51
52
  build_request(http_method, path, req, opts)
53
+ stream = download_file(request) if opts[:return_type] == 'File' || opts[:return_type] == 'Binary'
52
54
  end
53
55
 
54
56
  config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" if config.debugging
@@ -71,7 +73,11 @@ module MoneyKit
71
73
  raise ApiError, 'Connection failed'
72
74
  end
73
75
 
74
- data = (deserialize(response, opts[:return_type]) if opts[:return_type])
76
+ data = if opts[:return_type] == 'File' || opts[:return_type] == 'Binary'
77
+ deserialize_file(stream)
78
+ elsif opts[:return_type]
79
+ deserialize(response, opts[:return_type])
80
+ end
75
81
  [data, response.status, response.headers]
76
82
  end
77
83
 
@@ -107,7 +113,6 @@ module MoneyKit
107
113
 
108
114
  request.url url
109
115
  request.params = query_params
110
- download_file(request) if opts[:return_type] == 'File' || opts[:return_type] == 'Binary'
111
116
  request
112
117
  end
113
118
 
@@ -144,11 +149,40 @@ module MoneyKit
144
149
  end
145
150
 
146
151
  def download_file(request)
147
- @stream = []
152
+ stream = []
148
153
 
149
154
  # handle streaming Responses
150
155
  request.options.on_data = proc do |chunk, _overall_received_bytes|
151
- @stream << chunk
156
+ stream << chunk
157
+ end
158
+ stream
159
+ end
160
+
161
+ def deserialize_file(response, stream)
162
+ body = response.body
163
+ if @config.return_binary_data == true
164
+ # return byte stream
165
+ encoding = body.encoding
166
+ stream.join.force_encoding(encoding)
167
+ else
168
+ # return file instead of binary data
169
+ content_disposition = response.headers['Content-Disposition']
170
+ if content_disposition && content_disposition =~ /filename=/i
171
+ filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
172
+ prefix = sanitize_filename(filename)
173
+ else
174
+ prefix = 'download-'
175
+ end
176
+ prefix += '-' unless prefix.end_with?('-')
177
+ encoding = body.encoding
178
+ tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
179
+ tempfile.write(stream.join.force_encoding(encoding))
180
+ tempfile.close
181
+ config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
182
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
183
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
184
+ 'explicitly with `tempfile.delete`'
185
+ tempfile
152
186
  end
153
187
  end
154
188
 
@@ -215,40 +249,10 @@ module MoneyKit
215
249
  # @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
216
250
  def deserialize(response, return_type)
217
251
  body = response.body
218
-
219
- # handle file downloading - return the File instance processed in request callbacks
220
- # note that response body is empty when the file is written in chunks in request on_body callback
221
- if return_type == 'File'
222
- if @config.return_binary_data == true
223
- # return byte stream
224
- encoding = body.encoding
225
- return @stream.join.force_encoding(encoding)
226
- else
227
- # return file instead of binary data
228
- content_disposition = response.headers['Content-Disposition']
229
- if content_disposition && content_disposition =~ /filename=/i
230
- filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
231
- prefix = sanitize_filename(filename)
232
- else
233
- prefix = 'download-'
234
- end
235
- prefix += '-' unless prefix.end_with?('-')
236
- encoding = body.encoding
237
- @tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
238
- @tempfile.write(@stream.join.force_encoding(encoding))
239
- @tempfile.close
240
- @config.logger.info "Temp file written to #{@tempfile.path}, please copy the file to a proper folder "\
241
- "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
242
- "will be deleted automatically with GC. It's also recommended to delete the temp file "\
243
- 'explicitly with `tempfile.delete`'
244
- return @tempfile
245
- end
246
- end
247
-
248
252
  return nil if body.nil? || body.empty?
249
253
 
250
254
  # return response body directly for String return type
251
- return body if return_type == 'String'
255
+ return body.to_s if return_type == 'String'
252
256
 
253
257
  # ensuring a default content type
254
258
  content_type = response.headers['Content-Type'] || 'application/json'
@@ -5,7 +5,7 @@
5
5
  # The version of the OpenAPI document: 0.1.0
6
6
  #
7
7
  # Generated by: https://openapi-generator.tech
8
- # OpenAPI Generator version: 6.5.0
8
+ # OpenAPI Generator version: 7.1.0
9
9
  #
10
10
 
11
11
  module MoneyKit
@@ -5,7 +5,7 @@
5
5
  # The version of the OpenAPI document: 0.1.0
6
6
  #
7
7
  # Generated by: https://openapi-generator.tech
8
- # OpenAPI Generator version: 6.5.0
8
+ # OpenAPI Generator version: 7.1.0
9
9
  #
10
10
 
11
11
  module MoneyKit
@@ -144,9 +144,9 @@ module MoneyKit
144
144
 
145
145
  def initialize
146
146
  @scheme = 'https'
147
- @host = 'production.moneykit.com'
147
+ @host = 'api.moneykit.com'
148
148
  @base_path = ''
149
- @server_index = 0
149
+ @server_index = nil
150
150
  @server_operation_index = {}
151
151
  @server_variables = {}
152
152
  @server_operation_variables = {}
@@ -199,11 +199,18 @@ module MoneyKit
199
199
 
200
200
  # Returns base URL for specified operation based on server settings
201
201
  def base_url(operation = nil)
202
- index = server_operation_index.fetch(operation, server_index)
203
- return "#{scheme}://#{[host, base_path].join('/').gsub(%r{/+}, '/')}".sub(%r{/+\z}, '') if index.nil?
204
-
205
- server_url(index, server_operation_variables.fetch(operation, server_variables),
206
- operation_server_settings[operation])
202
+ if operation_server_settings.key?(operation)
203
+ index = server_operation_index.fetch(operation, server_index)
204
+ server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables),
205
+ operation_server_settings[operation])
206
+ elsif server_index.nil?
207
+ "#{scheme}://#{[host, base_path].join('/').gsub(%r{/+}, '/')}".sub(%r{/+\z},
208
+ '')
209
+ else
210
+ server_url(
211
+ server_index, server_variables, nil
212
+ )
213
+ end
207
214
  end
208
215
 
209
216
  # Gets API key (with prefix if set).
@@ -240,20 +247,6 @@ module MoneyKit
240
247
  key: 'Authorization',
241
248
  value: "Bearer #{access_token_with_refresh}"
242
249
  },
243
- 'clientId' =>
244
- {
245
- type: 'api_key',
246
- in: 'header',
247
- key: 'Client-Id',
248
- value: api_key_with_prefix('clientId')
249
- },
250
- 'clientSecret' =>
251
- {
252
- type: 'api_key',
253
- in: 'header',
254
- key: 'Client-Secret',
255
- value: api_key_with_prefix('clientSecret')
256
- },
257
250
  'HTTPBasic' =>
258
251
  {
259
252
  type: 'basic',
@@ -268,12 +261,8 @@ module MoneyKit
268
261
  def server_settings
269
262
  [
270
263
  {
271
- url: 'https://production.moneykit.com',
272
- description: 'MoneyKit production environment (Live institution data)'
273
- },
274
- {
275
- url: 'https://sandbox.moneykit.com',
276
- description: 'MoneyKit sandbox environment (Unrestricted environment with fake institution data)'
264
+ url: 'https://api.moneykit.com',
265
+ description: 'No description provided'
277
266
  }
278
267
  ]
279
268
  end
@@ -290,8 +279,9 @@ module MoneyKit
290
279
  servers = server_settings if servers.nil?
291
280
 
292
281
  # check array index out of bound
293
- if index < 0 || index >= servers.size
294
- raise ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
282
+ if index.nil? || index < 0 || index >= servers.size
283
+ raise ArgumentError,
284
+ "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
295
285
  end
296
286
 
297
287
  server = servers[index]