moneykit 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +1 -1
  4. data/docs/AccessTokenApi.md +10 -22
  5. data/docs/AccountNumbersApi.md +4 -8
  6. data/docs/AccountNumbersLinkProduct.md +4 -0
  7. data/docs/AccountNumbersProductSettings.md +1 -3
  8. data/docs/AccountsApi.md +10 -22
  9. data/docs/AccountsLinkProduct.md +5 -1
  10. data/docs/Body.md +1 -1
  11. data/docs/GetHoldingsResponse.md +24 -0
  12. data/docs/GetInvestmentTransactionsResponse.md +30 -0
  13. data/docs/HoldingResponse.md +30 -0
  14. data/docs/IdentityApi.md +1 -3
  15. data/docs/IdentityLinkProduct.md +4 -0
  16. data/docs/IdentityProductSettings.md +1 -3
  17. data/docs/InstitutionsApi.md +5 -11
  18. data/docs/InvestmentTransactionResponse.md +40 -0
  19. data/docs/InvestmentsApi.md +163 -0
  20. data/docs/InvestmentsLinkProduct.md +26 -0
  21. data/docs/InvestmentsProductSettings.md +1 -3
  22. data/docs/LinkCommon.md +1 -1
  23. data/docs/LinkError.md +15 -0
  24. data/docs/LinkProductFailureReasons.md +15 -0
  25. data/docs/LinkProducts.md +3 -1
  26. data/docs/LinkResponse.md +1 -1
  27. data/docs/LinkSessionApi.md +8 -16
  28. data/docs/LinkStateChangedWebhook.md +1 -1
  29. data/docs/LinksApi.md +20 -40
  30. data/docs/MoneyKitConnectFeatures.md +1 -1
  31. data/docs/ProductsApi.md +4 -8
  32. data/docs/Response401GetHoldingsLinksIdInvestmentsHoldingsGet.md +22 -0
  33. data/docs/Response401GetInvestmentTransactionsLinksIdInvestmentsTransactionsGet.md +22 -0
  34. data/docs/Response401GetTransactions.md +22 -0
  35. data/docs/Response401GetUserTransactions.md +22 -0
  36. data/docs/ResponseHandleLinkWebhookEventRequestBodyWebhookPost.md +1 -1
  37. data/docs/SecurityResponse.md +34 -0
  38. data/docs/TransactionSyncResponse.md +1 -1
  39. data/docs/TransactionsApi.md +5 -11
  40. data/docs/TransactionsLinkProduct.md +4 -0
  41. data/docs/TransactionsProductSettings.md +0 -2
  42. data/docs/UsersApi.md +6 -14
  43. data/docs/WebhooksApi.md +4 -8
  44. data/lib/moneykit/api/access_token_api.rb +1 -10
  45. data/lib/moneykit/api/account_numbers_api.rb +1 -4
  46. data/lib/moneykit/api/accounts_api.rb +1 -13
  47. data/lib/moneykit/api/identity_api.rb +1 -4
  48. data/lib/moneykit/api/institutions_api.rb +1 -7
  49. data/lib/moneykit/api/investments_api.rb +178 -0
  50. data/lib/moneykit/api/link_session_api.rb +1 -7
  51. data/lib/moneykit/api/links_api.rb +1 -16
  52. data/lib/moneykit/api/products_api.rb +1 -4
  53. data/lib/moneykit/api/transactions_api.rb +5 -14
  54. data/lib/moneykit/api/users_api.rb +1 -10
  55. data/lib/moneykit/api/webhooks_api.rb +1 -4
  56. data/lib/moneykit/api_client.rb +1 -1
  57. data/lib/moneykit/api_error.rb +1 -1
  58. data/lib/moneykit/configuration.rb +1 -1
  59. data/lib/moneykit/models/account.rb +1 -1
  60. data/lib/moneykit/models/account_balances.rb +1 -1
  61. data/lib/moneykit/models/account_group.rb +1 -1
  62. data/lib/moneykit/models/account_identity.rb +1 -1
  63. data/lib/moneykit/models/account_numbers.rb +1 -1
  64. data/lib/moneykit/models/account_numbers_link_product.rb +43 -2
  65. data/lib/moneykit/models/account_numbers_product_settings.rb +5 -36
  66. data/lib/moneykit/models/account_with_account_numbers.rb +1 -1
  67. data/lib/moneykit/models/accounts_link_product.rb +46 -5
  68. data/lib/moneykit/models/ach_number.rb +1 -1
  69. data/lib/moneykit/models/address.rb +1 -1
  70. data/lib/moneykit/models/api_error_auth_expired_access_token_response.rb +1 -1
  71. data/lib/moneykit/models/api_error_auth_unauthorized_response.rb +1 -1
  72. data/lib/moneykit/models/api_error_rate_limit_exceeded_response.rb +1 -1
  73. data/lib/moneykit/models/bacs_number.rb +1 -1
  74. data/lib/moneykit/models/basic_account_details.rb +1 -1
  75. data/lib/moneykit/models/body.rb +1 -1
  76. data/lib/moneykit/models/country.rb +1 -1
  77. data/lib/moneykit/models/create_link_session_request.rb +1 -1
  78. data/lib/moneykit/models/create_link_session_response.rb +1 -1
  79. data/lib/moneykit/models/currency.rb +1 -1
  80. data/lib/moneykit/models/cursor_pagination.rb +1 -1
  81. data/lib/moneykit/models/customer_app.rb +1 -1
  82. data/lib/moneykit/models/eft_number.rb +1 -1
  83. data/lib/moneykit/models/email.rb +1 -1
  84. data/lib/moneykit/models/exchange_token_request.rb +1 -1
  85. data/lib/moneykit/models/exchange_token_response.rb +1 -1
  86. data/lib/moneykit/models/generate_access_token_response.rb +1 -1
  87. data/lib/moneykit/models/get_account_numbers_response.rb +1 -1
  88. data/lib/moneykit/models/get_account_response.rb +1 -1
  89. data/lib/moneykit/models/get_accounts_response.rb +1 -1
  90. data/lib/moneykit/models/get_holdings_response.rb +273 -0
  91. data/lib/moneykit/models/get_institutions_response.rb +1 -1
  92. data/lib/moneykit/models/get_investment_transactions_response.rb +324 -0
  93. data/lib/moneykit/models/get_transactions_response.rb +1 -1
  94. data/lib/moneykit/models/get_user_accounts_response.rb +1 -1
  95. data/lib/moneykit/models/get_user_links_response.rb +1 -1
  96. data/lib/moneykit/models/get_user_transactions_response.rb +1 -1
  97. data/lib/moneykit/models/holding_response.rb +294 -0
  98. data/lib/moneykit/models/http_validation_error.rb +1 -1
  99. data/lib/moneykit/models/identity_link_product.rb +43 -2
  100. data/lib/moneykit/models/identity_product_settings.rb +5 -36
  101. data/lib/moneykit/models/identity_response.rb +1 -1
  102. data/lib/moneykit/models/institution.rb +1 -1
  103. data/lib/moneykit/models/institution_error_not_found_response.rb +1 -1
  104. data/lib/moneykit/models/international_number.rb +1 -1
  105. data/lib/moneykit/models/introspect_client_response.rb +1 -1
  106. data/lib/moneykit/models/investment_transaction_response.rb +365 -0
  107. data/lib/moneykit/models/investments_link_product.rb +280 -0
  108. data/lib/moneykit/models/investments_product_settings.rb +5 -36
  109. data/lib/moneykit/models/jwk_set.rb +1 -1
  110. data/lib/moneykit/models/link_common.rb +2 -2
  111. data/lib/moneykit/models/link_error.rb +44 -0
  112. data/lib/moneykit/models/link_error_bad_config_response.rb +1 -1
  113. data/lib/moneykit/models/link_error_bad_state_response.rb +1 -1
  114. data/lib/moneykit/models/link_error_deleted_response.rb +1 -1
  115. data/lib/moneykit/models/link_error_forbidden_action_response.rb +1 -1
  116. data/lib/moneykit/models/link_error_not_found_response.rb +1 -1
  117. data/lib/moneykit/models/link_error_unauthorized_access_response.rb +1 -1
  118. data/lib/moneykit/models/link_permission_scope.rb +1 -1
  119. data/lib/moneykit/models/link_permissions.rb +1 -1
  120. data/lib/moneykit/models/link_product_failure_reasons.rb +44 -0
  121. data/lib/moneykit/models/link_product_refresh_webhook.rb +1 -1
  122. data/lib/moneykit/models/link_product_state.rb +1 -1
  123. data/lib/moneykit/models/link_products.rb +14 -5
  124. data/lib/moneykit/models/link_response.rb +2 -2
  125. data/lib/moneykit/models/link_session_customer_user.rb +1 -1
  126. data/lib/moneykit/models/link_session_customer_user_email.rb +1 -1
  127. data/lib/moneykit/models/link_session_customer_user_phone.rb +1 -1
  128. data/lib/moneykit/models/link_session_error_forbidden_config_response.rb +1 -1
  129. data/lib/moneykit/models/link_session_error_invalid_token_exchange.rb +1 -1
  130. data/lib/moneykit/models/link_session_setting_overrides.rb +1 -1
  131. data/lib/moneykit/models/link_state.rb +1 -1
  132. data/lib/moneykit/models/link_state_changed_webhook.rb +2 -2
  133. data/lib/moneykit/models/money_kit_connect_features.rb +2 -2
  134. data/lib/moneykit/models/owner.rb +1 -1
  135. data/lib/moneykit/models/phone_number.rb +1 -1
  136. data/lib/moneykit/models/phone_number_type.rb +1 -1
  137. data/lib/moneykit/models/product.rb +1 -1
  138. data/lib/moneykit/models/products_settings.rb +1 -1
  139. data/lib/moneykit/models/provider.rb +1 -1
  140. data/lib/moneykit/models/refresh_products_request.rb +1 -1
  141. data/lib/moneykit/models/requested_link_permission.rb +1 -1
  142. data/lib/moneykit/models/response401_disconnect_links_id_delete.rb +1 -1
  143. data/lib/moneykit/models/response401_exchange_token_link_session_exchange_token_post.rb +1 -1
  144. data/lib/moneykit/models/response401_get_account_links_id_accounts_account_id_get.rb +1 -1
  145. data/lib/moneykit/models/response401_get_account_numbers_links_id_accounts_numbers_get.rb +1 -1
  146. data/lib/moneykit/models/response401_get_accounts_links_id_accounts_get.rb +1 -1
  147. data/lib/moneykit/models/response401_get_holdings_links_id_investments_holdings_get.rb +104 -0
  148. data/lib/moneykit/models/response401_get_identities_links_id_identity_get.rb +1 -1
  149. data/lib/moneykit/models/response401_get_institution_institutions_institution_id_get.rb +1 -1
  150. data/lib/moneykit/models/response401_get_institutions_institutions_get.rb +1 -1
  151. data/lib/moneykit/models/response401_get_investment_transactions_links_id_investments_transactions_get.rb +104 -0
  152. data/lib/moneykit/models/response401_get_link_links_id_get.rb +1 -1
  153. data/lib/moneykit/models/response401_get_transactions.rb +104 -0
  154. data/lib/moneykit/models/response401_get_transactions_diff_links_id_transactions_sync_get.rb +1 -1
  155. data/lib/moneykit/models/response401_get_user_accounts_users_id_accounts_get.rb +1 -1
  156. data/lib/moneykit/models/response401_get_user_links_users_id_links_get.rb +1 -1
  157. data/lib/moneykit/models/response401_get_user_transactions.rb +103 -0
  158. data/lib/moneykit/models/response401_get_well_known_jwks_well_known_jwks_json_get.rb +1 -1
  159. data/lib/moneykit/models/response401_instrospect_client_auth_introspect_get.rb +1 -1
  160. data/lib/moneykit/models/response401_refresh_products_links_id_products_post.rb +1 -1
  161. data/lib/moneykit/models/response401_reset_login_links_id_reset_post.rb +1 -1
  162. data/lib/moneykit/models/response401_trigger_test_link_webhook_event_webhooks_test_link_id_post.rb +1 -1
  163. data/lib/moneykit/models/response401_update_link_links_id_patch.rb +1 -1
  164. data/lib/moneykit/models/response_handle_link_webhook_event_request_body_webhook_post.rb +1 -1
  165. data/lib/moneykit/models/security_response.rb +321 -0
  166. data/lib/moneykit/models/transaction.rb +1 -1
  167. data/lib/moneykit/models/transaction_diff.rb +1 -1
  168. data/lib/moneykit/models/transaction_sync_response.rb +2 -2
  169. data/lib/moneykit/models/transaction_type.rb +1 -1
  170. data/lib/moneykit/models/transaction_type_filter.rb +1 -1
  171. data/lib/moneykit/models/transaction_updates_available_webhook.rb +1 -1
  172. data/lib/moneykit/models/transactions_link_product.rb +43 -2
  173. data/lib/moneykit/models/transactions_product_settings.rb +2 -33
  174. data/lib/moneykit/models/update_link_request.rb +1 -1
  175. data/lib/moneykit/models/validation_error.rb +1 -1
  176. data/lib/moneykit/models/validation_error_location_inner.rb +1 -1
  177. data/lib/moneykit/models/webhook_link_test_event.rb +1 -1
  178. data/lib/moneykit/models/webhook_test_link_request.rb +1 -1
  179. data/lib/moneykit/models/webhook_test_link_response.rb +1 -1
  180. data/lib/moneykit/version.rb +2 -2
  181. data/lib/moneykit.rb +14 -4
  182. data/moneykit.gemspec +1 -1
  183. data/spec/api/investments_api_spec.rb +65 -0
  184. data/spec/api_client_spec.rb +1 -1
  185. data/spec/configuration_spec.rb +1 -1
  186. data/spec/models/get_holdings_response_spec.rb +54 -0
  187. data/spec/models/get_investment_transactions_response_spec.rb +72 -0
  188. data/spec/models/holding_response_spec.rb +72 -0
  189. data/spec/models/investment_transaction_response_spec.rb +102 -0
  190. data/spec/models/investments_link_product_spec.rb +60 -0
  191. data/spec/models/link_error_spec.rb +30 -0
  192. data/spec/models/link_product_failure_reasons_spec.rb +30 -0
  193. data/spec/models/response401_get_holdings_links_id_investments_holdings_get_spec.rb +21 -0
  194. data/spec/models/response401_get_investment_transactions_links_id_investments_transactions_get_spec.rb +21 -0
  195. data/spec/models/response401_get_transactions_spec.rb +21 -0
  196. data/spec/models/response401_get_user_transactions_spec.rb +21 -0
  197. data/spec/models/security_response_spec.rb +84 -0
  198. data/spec/spec_helper.rb +1 -1
  199. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/gem_make.out +5 -5
  200. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
  201. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.1.1.1/gem_make.out +5 -5
  202. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.7.3/gem_make.out +5 -5
  203. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.1.0/gem_make.out +5 -5
  204. metadata +54 -2
@@ -0,0 +1,365 @@
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 InvestmentTransactionResponse
18
+ # The unique ID for this investment transaction.
19
+ attr_accessor :id
20
+
21
+ # The ID of the account in which this investment transaction occurred.
22
+ attr_accessor :account_id
23
+
24
+ # The total value of this transaction, denominated in account currency. Positive values indicate debits (deposits); negative values are credits (withdrawals). For example, for a `buy` transaction, the amount will be equal to `-(quantity * price + fees)`.
25
+ attr_accessor :amount
26
+
27
+ # The effective (posted) date of the transaction, in ISO-8601 format.
28
+ attr_accessor :date
29
+
30
+ # If the institution has provided the actual time of the transaction, this field contains the full date and time of the transaction, in ISO-8601 format. If the time is not available, this field will be null. <p>Note that the time is generally reported in the timezone of the institution or the account holder.
31
+ attr_accessor :datetime
32
+
33
+ # A normalized, cleaned transaction description suitable for presentation to the end user.
34
+ attr_accessor :description
35
+
36
+ # The type of transaction (buy, sell, cash, fee, transfer). May include a dotted subtype, for example, `buy.buy_to_cover` or `fee.transfer_fee`.
37
+ attr_accessor :type
38
+
39
+ # The combined value of any fees applied to the transaction. Fees are subtracted from the total transaction amount, and are reported as positive values; refunds are reported as negative values.
40
+ attr_accessor :fees
41
+
42
+ # The currency exchange rate applied. Only present for transactions involving a security that is denominated in a currency other than the account currency.
43
+ attr_accessor :forex_rate
44
+
45
+ # The price per share, denominated in account currency. Omitted for transactions not involving a security.
46
+ attr_accessor :price
47
+
48
+ # The units of security (aka \"shares\") bought, sold, or transferred. Omitted for transactions not involving a security. Positive values indicate shares added to the account.
49
+ attr_accessor :quantity
50
+
51
+ # The MoneyKit ID of the security involved in this transaction (for example, the security bought or sold, or upon which interest or dividends are paid.
52
+ attr_accessor :security_id
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'id' => :'id',
58
+ :'account_id' => :'account_id',
59
+ :'amount' => :'amount',
60
+ :'date' => :'date',
61
+ :'datetime' => :'datetime',
62
+ :'description' => :'description',
63
+ :'type' => :'type',
64
+ :'fees' => :'fees',
65
+ :'forex_rate' => :'forex_rate',
66
+ :'price' => :'price',
67
+ :'quantity' => :'quantity',
68
+ :'security_id' => :'security_id'
69
+ }
70
+ end
71
+
72
+ # Returns all the JSON keys this model knows about
73
+ def self.acceptable_attributes
74
+ attribute_map.values
75
+ end
76
+
77
+ # Attribute type mapping.
78
+ def self.openapi_types
79
+ {
80
+ :'id' => :'String',
81
+ :'account_id' => :'String',
82
+ :'amount' => :'String',
83
+ :'date' => :'Date',
84
+ :'datetime' => :'Time',
85
+ :'description' => :'String',
86
+ :'type' => :'String',
87
+ :'fees' => :'String',
88
+ :'forex_rate' => :'String',
89
+ :'price' => :'String',
90
+ :'quantity' => :'String',
91
+ :'security_id' => :'String'
92
+ }
93
+ end
94
+
95
+ # List of attributes with nullable: true
96
+ def self.openapi_nullable
97
+ Set.new([
98
+ ])
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MoneyKit::InvestmentTransactionResponse` initialize method"
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ attributes = attributes.each_with_object({}) { |(k, v), h|
110
+ if (!self.class.attribute_map.key?(k.to_sym))
111
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MoneyKit::InvestmentTransactionResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
112
+ end
113
+ h[k.to_sym] = v
114
+ }
115
+
116
+ if attributes.key?(:'id')
117
+ self.id = attributes[:'id']
118
+ else
119
+ self.id = nil
120
+ end
121
+
122
+ if attributes.key?(:'account_id')
123
+ self.account_id = attributes[:'account_id']
124
+ else
125
+ self.account_id = nil
126
+ end
127
+
128
+ if attributes.key?(:'amount')
129
+ self.amount = attributes[:'amount']
130
+ else
131
+ self.amount = nil
132
+ end
133
+
134
+ if attributes.key?(:'date')
135
+ self.date = attributes[:'date']
136
+ else
137
+ self.date = nil
138
+ end
139
+
140
+ if attributes.key?(:'datetime')
141
+ self.datetime = attributes[:'datetime']
142
+ end
143
+
144
+ if attributes.key?(:'description')
145
+ self.description = attributes[:'description']
146
+ else
147
+ self.description = nil
148
+ end
149
+
150
+ if attributes.key?(:'type')
151
+ self.type = attributes[:'type']
152
+ else
153
+ self.type = nil
154
+ end
155
+
156
+ if attributes.key?(:'fees')
157
+ self.fees = attributes[:'fees']
158
+ end
159
+
160
+ if attributes.key?(:'forex_rate')
161
+ self.forex_rate = attributes[:'forex_rate']
162
+ end
163
+
164
+ if attributes.key?(:'price')
165
+ self.price = attributes[:'price']
166
+ end
167
+
168
+ if attributes.key?(:'quantity')
169
+ self.quantity = attributes[:'quantity']
170
+ end
171
+
172
+ if attributes.key?(:'security_id')
173
+ self.security_id = attributes[:'security_id']
174
+ end
175
+ end
176
+
177
+ # Show invalid properties with the reasons. Usually used together with valid?
178
+ # @return Array for valid properties with the reasons
179
+ def list_invalid_properties
180
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
181
+ invalid_properties = Array.new
182
+ if @id.nil?
183
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
184
+ end
185
+
186
+ if @account_id.nil?
187
+ invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
188
+ end
189
+
190
+ if @amount.nil?
191
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
192
+ end
193
+
194
+ if @date.nil?
195
+ invalid_properties.push('invalid value for "date", date cannot be nil.')
196
+ end
197
+
198
+ if @description.nil?
199
+ invalid_properties.push('invalid value for "description", description cannot be nil.')
200
+ end
201
+
202
+ if @type.nil?
203
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
204
+ end
205
+
206
+ invalid_properties
207
+ end
208
+
209
+ # Check to see if the all the properties in the model are valid
210
+ # @return true if the model is valid
211
+ def valid?
212
+ warn '[DEPRECATED] the `valid?` method is obsolete'
213
+ return false if @id.nil?
214
+ return false if @account_id.nil?
215
+ return false if @amount.nil?
216
+ return false if @date.nil?
217
+ return false if @description.nil?
218
+ return false if @type.nil?
219
+ true
220
+ end
221
+
222
+ # Checks equality by comparing each attribute.
223
+ # @param [Object] Object to be compared
224
+ def ==(o)
225
+ return true if self.equal?(o)
226
+ self.class == o.class &&
227
+ id == o.id &&
228
+ account_id == o.account_id &&
229
+ amount == o.amount &&
230
+ date == o.date &&
231
+ datetime == o.datetime &&
232
+ description == o.description &&
233
+ type == o.type &&
234
+ fees == o.fees &&
235
+ forex_rate == o.forex_rate &&
236
+ price == o.price &&
237
+ quantity == o.quantity &&
238
+ security_id == o.security_id
239
+ end
240
+
241
+ # @see the `==` method
242
+ # @param [Object] Object to be compared
243
+ def eql?(o)
244
+ self == o
245
+ end
246
+
247
+ # Calculates hash code according to all attributes.
248
+ # @return [Integer] Hash code
249
+ def hash
250
+ [id, account_id, amount, date, datetime, description, type, fees, forex_rate, price, quantity, security_id].hash
251
+ end
252
+
253
+ # Builds the object from hash
254
+ # @param [Hash] attributes Model attributes in the form of hash
255
+ # @return [Object] Returns the model itself
256
+ def self.build_from_hash(attributes)
257
+ return nil unless attributes.is_a?(Hash)
258
+ attributes = attributes.transform_keys(&:to_sym)
259
+ transformed_hash = {}
260
+ openapi_types.each_pair do |key, type|
261
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
262
+ transformed_hash["#{key}"] = nil
263
+ elsif type =~ /\AArray<(.*)>/i
264
+ # check to ensure the input is an array given that the attribute
265
+ # is documented as an array but the input is not
266
+ if attributes[attribute_map[key]].is_a?(Array)
267
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
268
+ end
269
+ elsif !attributes[attribute_map[key]].nil?
270
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
271
+ end
272
+ end
273
+ new(transformed_hash)
274
+ end
275
+
276
+ # Deserializes the data based on type
277
+ # @param string type Data type
278
+ # @param string value Value to be deserialized
279
+ # @return [Object] Deserialized data
280
+ def self._deserialize(type, value)
281
+ case type.to_sym
282
+ when :Time
283
+ Time.parse(value)
284
+ when :Date
285
+ Date.parse(value)
286
+ when :String
287
+ value.to_s
288
+ when :Integer
289
+ value.to_i
290
+ when :Float
291
+ value.to_f
292
+ when :Boolean
293
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
294
+ true
295
+ else
296
+ false
297
+ end
298
+ when :Object
299
+ # generic object (usually a Hash), return directly
300
+ value
301
+ when /\AArray<(?<inner_type>.+)>\z/
302
+ inner_type = Regexp.last_match[:inner_type]
303
+ value.map { |v| _deserialize(inner_type, v) }
304
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
305
+ k_type = Regexp.last_match[:k_type]
306
+ v_type = Regexp.last_match[:v_type]
307
+ {}.tap do |hash|
308
+ value.each do |k, v|
309
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
310
+ end
311
+ end
312
+ else # model
313
+ # models (e.g. Pet) or oneOf
314
+ klass = MoneyKit.const_get(type)
315
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
316
+ end
317
+ end
318
+
319
+ # Returns the string representation of the object
320
+ # @return [String] String presentation of the object
321
+ def to_s
322
+ to_hash.to_s
323
+ end
324
+
325
+ # to_body is an alias to to_hash (backward compatibility)
326
+ # @return [Hash] Returns the object in the form of hash
327
+ def to_body
328
+ to_hash
329
+ end
330
+
331
+ # Returns the object in the form of hash
332
+ # @return [Hash] Returns the object in the form of hash
333
+ def to_hash
334
+ hash = {}
335
+ self.class.attribute_map.each_pair do |attr, param|
336
+ value = self.send(attr)
337
+ if value.nil?
338
+ is_nullable = self.class.openapi_nullable.include?(attr)
339
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
340
+ end
341
+
342
+ hash[param] = _to_hash(value)
343
+ end
344
+ hash
345
+ end
346
+
347
+ # Outputs non-array value in the form of hash
348
+ # For object, use to_hash. Otherwise, just return the value
349
+ # @param [Object] value Any valid value
350
+ # @return [Hash] Returns the value in the form of hash
351
+ def _to_hash(value)
352
+ if value.is_a?(Array)
353
+ value.compact.map { |v| _to_hash(v) }
354
+ elsif value.is_a?(Hash)
355
+ {}.tap do |hash|
356
+ value.each { |k, v| hash[k] = _to_hash(v) }
357
+ end
358
+ elsif value.respond_to? :to_hash
359
+ value.to_hash
360
+ else
361
+ value
362
+ end
363
+ end
364
+ end
365
+ end
@@ -0,0 +1,280 @@
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 InvestmentsLinkProduct
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
+ attr_accessor :settings
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'refreshed_at' => :'refreshed_at',
57
+ :'last_attempted_at' => :'last_attempted_at',
58
+ :'error_code' => :'error_code',
59
+ :'error_message' => :'error_message',
60
+ :'settings' => :'settings'
61
+ }
62
+ end
63
+
64
+ # Returns all the JSON keys this model knows about
65
+ def self.acceptable_attributes
66
+ attribute_map.values
67
+ end
68
+
69
+ # Attribute type mapping.
70
+ def self.openapi_types
71
+ {
72
+ :'refreshed_at' => :'Time',
73
+ :'last_attempted_at' => :'Time',
74
+ :'error_code' => :'LinkProductFailureReasons',
75
+ :'error_message' => :'String',
76
+ :'settings' => :'InvestmentsProductSettings'
77
+ }
78
+ end
79
+
80
+ # List of attributes with nullable: true
81
+ def self.openapi_nullable
82
+ Set.new([
83
+ ])
84
+ end
85
+
86
+ # Initializes the object
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ def initialize(attributes = {})
89
+ if (!attributes.is_a?(Hash))
90
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MoneyKit::InvestmentsLinkProduct` initialize method"
91
+ end
92
+
93
+ # check to see if the attribute exists and convert string to symbol for hash key
94
+ attributes = attributes.each_with_object({}) { |(k, v), h|
95
+ if (!self.class.attribute_map.key?(k.to_sym))
96
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MoneyKit::InvestmentsLinkProduct`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
97
+ end
98
+ h[k.to_sym] = v
99
+ }
100
+
101
+ if attributes.key?(:'refreshed_at')
102
+ self.refreshed_at = attributes[:'refreshed_at']
103
+ end
104
+
105
+ if attributes.key?(:'last_attempted_at')
106
+ self.last_attempted_at = attributes[:'last_attempted_at']
107
+ end
108
+
109
+ if attributes.key?(:'error_code')
110
+ self.error_code = attributes[:'error_code']
111
+ end
112
+
113
+ if attributes.key?(:'error_message')
114
+ self.error_message = attributes[:'error_message']
115
+ end
116
+
117
+ if attributes.key?(:'settings')
118
+ self.settings = attributes[:'settings']
119
+ else
120
+ self.settings = nil
121
+ end
122
+ end
123
+
124
+ # Show invalid properties with the reasons. Usually used together with valid?
125
+ # @return Array for valid properties with the reasons
126
+ def list_invalid_properties
127
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
128
+ invalid_properties = Array.new
129
+ if @settings.nil?
130
+ invalid_properties.push('invalid value for "settings", settings cannot be nil.')
131
+ end
132
+
133
+ invalid_properties
134
+ end
135
+
136
+ # Check to see if the all the properties in the model are valid
137
+ # @return true if the model is valid
138
+ def valid?
139
+ warn '[DEPRECATED] the `valid?` method is obsolete'
140
+ return false if @settings.nil?
141
+ true
142
+ end
143
+
144
+ # Checks equality by comparing each attribute.
145
+ # @param [Object] Object to be compared
146
+ def ==(o)
147
+ return true if self.equal?(o)
148
+ self.class == o.class &&
149
+ refreshed_at == o.refreshed_at &&
150
+ last_attempted_at == o.last_attempted_at &&
151
+ error_code == o.error_code &&
152
+ error_message == o.error_message &&
153
+ settings == o.settings
154
+ end
155
+
156
+ # @see the `==` method
157
+ # @param [Object] Object to be compared
158
+ def eql?(o)
159
+ self == o
160
+ end
161
+
162
+ # Calculates hash code according to all attributes.
163
+ # @return [Integer] Hash code
164
+ def hash
165
+ [refreshed_at, last_attempted_at, error_code, error_message, settings].hash
166
+ end
167
+
168
+ # Builds the object from hash
169
+ # @param [Hash] attributes Model attributes in the form of hash
170
+ # @return [Object] Returns the model itself
171
+ def self.build_from_hash(attributes)
172
+ return nil unless attributes.is_a?(Hash)
173
+ attributes = attributes.transform_keys(&:to_sym)
174
+ transformed_hash = {}
175
+ openapi_types.each_pair do |key, type|
176
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
177
+ transformed_hash["#{key}"] = nil
178
+ elsif type =~ /\AArray<(.*)>/i
179
+ # check to ensure the input is an array given that the attribute
180
+ # is documented as an array but the input is not
181
+ if attributes[attribute_map[key]].is_a?(Array)
182
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
183
+ end
184
+ elsif !attributes[attribute_map[key]].nil?
185
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
186
+ end
187
+ end
188
+ new(transformed_hash)
189
+ end
190
+
191
+ # Deserializes the data based on type
192
+ # @param string type Data type
193
+ # @param string value Value to be deserialized
194
+ # @return [Object] Deserialized data
195
+ def self._deserialize(type, value)
196
+ case type.to_sym
197
+ when :Time
198
+ Time.parse(value)
199
+ when :Date
200
+ Date.parse(value)
201
+ when :String
202
+ value.to_s
203
+ when :Integer
204
+ value.to_i
205
+ when :Float
206
+ value.to_f
207
+ when :Boolean
208
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
209
+ true
210
+ else
211
+ false
212
+ end
213
+ when :Object
214
+ # generic object (usually a Hash), return directly
215
+ value
216
+ when /\AArray<(?<inner_type>.+)>\z/
217
+ inner_type = Regexp.last_match[:inner_type]
218
+ value.map { |v| _deserialize(inner_type, v) }
219
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
220
+ k_type = Regexp.last_match[:k_type]
221
+ v_type = Regexp.last_match[:v_type]
222
+ {}.tap do |hash|
223
+ value.each do |k, v|
224
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
225
+ end
226
+ end
227
+ else # model
228
+ # models (e.g. Pet) or oneOf
229
+ klass = MoneyKit.const_get(type)
230
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
231
+ end
232
+ end
233
+
234
+ # Returns the string representation of the object
235
+ # @return [String] String presentation of the object
236
+ def to_s
237
+ to_hash.to_s
238
+ end
239
+
240
+ # to_body is an alias to to_hash (backward compatibility)
241
+ # @return [Hash] Returns the object in the form of hash
242
+ def to_body
243
+ to_hash
244
+ end
245
+
246
+ # Returns the object in the form of hash
247
+ # @return [Hash] Returns the object in the form of hash
248
+ def to_hash
249
+ hash = {}
250
+ self.class.attribute_map.each_pair do |attr, param|
251
+ value = self.send(attr)
252
+ if value.nil?
253
+ is_nullable = self.class.openapi_nullable.include?(attr)
254
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
255
+ end
256
+
257
+ hash[param] = _to_hash(value)
258
+ end
259
+ hash
260
+ end
261
+
262
+ # Outputs non-array value in the form of hash
263
+ # For object, use to_hash. Otherwise, just return the value
264
+ # @param [Object] value Any valid value
265
+ # @return [Hash] Returns the value in the form of hash
266
+ def _to_hash(value)
267
+ if value.is_a?(Array)
268
+ value.compact.map { |v| _to_hash(v) }
269
+ elsif value.is_a?(Hash)
270
+ {}.tap do |hash|
271
+ value.each { |k, v| hash[k] = _to_hash(v) }
272
+ end
273
+ elsif value.respond_to? :to_hash
274
+ value.to_hash
275
+ else
276
+ value
277
+ end
278
+ end
279
+ end
280
+ end