moneykit 0.0.3 → 0.0.5
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.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/moneykit/api/access_token_api.rb +9 -9
- data/lib/moneykit/api/account_numbers_api.rb +6 -6
- data/lib/moneykit/api/accounts_api.rb +15 -15
- data/lib/moneykit/api/identity_api.rb +6 -6
- data/lib/moneykit/api/institutions_api.rb +7 -7
- data/lib/moneykit/api/link_session_api.rb +7 -7
- data/lib/moneykit/api/links_api.rb +76 -13
- data/lib/moneykit/api/products_api.rb +6 -6
- data/lib/moneykit/api/transactions_api.rb +28 -28
- data/lib/moneykit/api/users_api.rb +14 -14
- data/lib/moneykit/api/webhooks_api.rb +97 -0
- data/lib/moneykit/api_client.rb +40 -36
- data/lib/moneykit/api_error.rb +1 -1
- data/lib/moneykit/configuration.rb +20 -30
- data/lib/moneykit/models/account.rb +27 -54
- data/lib/moneykit/models/account_balances.rb +18 -27
- data/lib/moneykit/models/account_group.rb +23 -26
- data/lib/moneykit/models/account_identity.rb +34 -59
- data/lib/moneykit/models/account_numbers.rb +75 -51
- data/lib/moneykit/models/account_numbers_link_product.rb +18 -28
- data/lib/moneykit/models/account_numbers_product_settings.rb +16 -21
- data/lib/moneykit/models/account_with_account_numbers.rb +29 -56
- data/lib/moneykit/models/accounts_link_product.rb +17 -25
- data/lib/moneykit/models/ach_number.rb +19 -26
- data/lib/moneykit/models/address.rb +17 -28
- data/lib/moneykit/models/api_error_auth_expired_access_token_response.rb +17 -24
- data/lib/moneykit/models/api_error_auth_unauthorized_response.rb +18 -25
- data/lib/moneykit/models/api_error_rate_limit_exceeded_response.rb +17 -24
- data/lib/moneykit/models/bacs_number.rb +18 -25
- data/lib/moneykit/models/basic_account_details.rb +20 -29
- data/lib/moneykit/models/country.rb +1 -1
- data/lib/moneykit/models/create_link_session_request.rb +48 -45
- data/lib/moneykit/models/create_link_session_response.rb +17 -24
- data/lib/moneykit/models/currency.rb +1 -1
- data/lib/moneykit/models/cursor_pagination.rb +17 -24
- data/lib/moneykit/models/customer_app.rb +18 -25
- data/lib/moneykit/models/eft_number.rb +19 -26
- data/lib/moneykit/models/email.rb +17 -22
- data/lib/moneykit/models/exchange_token_request.rb +17 -24
- data/lib/moneykit/models/exchange_token_response.rb +19 -26
- data/lib/moneykit/models/generate_access_token_response.rb +19 -26
- data/lib/moneykit/models/get_account_numbers_response.rb +23 -26
- data/lib/moneykit/models/get_account_response.rb +19 -26
- data/lib/moneykit/models/get_accounts_response.rb +25 -31
- data/lib/moneykit/models/get_institutions_response.rb +25 -31
- data/lib/moneykit/models/get_transactions_response.rb +34 -39
- data/lib/moneykit/models/get_user_accounts_response.rb +24 -32
- data/lib/moneykit/models/get_user_links_response.rb +24 -32
- data/lib/moneykit/models/get_user_transactions_response.rb +32 -34
- data/lib/moneykit/models/http_validation_error.rb +24 -28
- data/lib/moneykit/models/identity_link_product.rb +18 -28
- data/lib/moneykit/models/identity_product_settings.rb +16 -21
- data/lib/moneykit/models/identity_response.rb +24 -30
- data/lib/moneykit/models/institution.rb +29 -38
- data/lib/moneykit/models/institution_error_not_found_response.rb +17 -24
- data/lib/moneykit/models/international_number.rb +18 -25
- data/lib/moneykit/models/introspect_client_response.rb +22 -29
- data/lib/moneykit/models/jwk_set.rb +23 -26
- data/lib/moneykit/models/link_common.rb +25 -39
- data/lib/moneykit/models/link_error_bad_config_response.rb +269 -0
- data/lib/moneykit/models/link_error_bad_state_response.rb +19 -28
- data/lib/moneykit/models/link_error_deleted_response.rb +17 -24
- data/lib/moneykit/models/link_error_forbidden_action_response.rb +18 -25
- data/lib/moneykit/models/link_error_not_found_response.rb +17 -24
- data/lib/moneykit/models/link_error_unauthorized_access_response.rb +17 -24
- data/lib/moneykit/models/link_permission_scope.rb +1 -1
- data/lib/moneykit/models/link_permissions.rb +23 -33
- data/lib/moneykit/models/link_products.rb +16 -21
- data/lib/moneykit/models/link_response.rb +26 -39
- data/lib/moneykit/models/link_session_customer_user.rb +20 -28
- data/lib/moneykit/models/link_session_customer_user_email.rb +18 -25
- data/lib/moneykit/models/link_session_customer_user_phone.rb +18 -26
- data/lib/moneykit/models/link_session_error_forbidden_config_response.rb +18 -25
- data/lib/moneykit/models/link_session_error_invalid_token_exchange.rb +18 -25
- data/lib/moneykit/models/link_session_setting_overrides.rb +19 -43
- data/lib/moneykit/models/link_state.rb +1 -1
- data/lib/moneykit/models/link_state_changed_webhook.rb +28 -31
- data/lib/moneykit/models/money_link_features.rb +27 -32
- data/lib/moneykit/models/owner.rb +42 -42
- data/lib/moneykit/models/phone_number.rb +18 -25
- data/lib/moneykit/models/phone_number_type.rb +1 -1
- data/lib/moneykit/models/product.rb +1 -1
- data/lib/moneykit/models/products_settings.rb +19 -24
- data/lib/moneykit/models/provider.rb +4 -2
- data/lib/moneykit/models/public_link_error.rb +43 -0
- data/lib/moneykit/models/refresh_products_request.rb +23 -34
- data/lib/moneykit/models/requested_link_permission.rb +19 -26
- data/lib/moneykit/models/response401_disconnect_links_id_delete.rb +75 -269
- data/lib/moneykit/models/response401_exchange_token_link_session_exchange_token_post.rb +74 -267
- data/lib/moneykit/models/response401_get_account_links_id_accounts_account_id_get.rb +75 -269
- data/lib/moneykit/models/response401_get_account_numbers_links_id_accounts_numbers_get.rb +75 -269
- data/lib/moneykit/models/response401_get_accounts_links_id_accounts_get.rb +75 -269
- data/lib/moneykit/models/response401_get_identities_links_id_identity_get.rb +75 -269
- data/lib/moneykit/models/response401_get_institution_institutions_institution_id_get.rb +74 -267
- data/lib/moneykit/models/response401_get_institutions_institutions_get.rb +74 -267
- data/lib/moneykit/models/response401_get_link_links_id_get.rb +75 -269
- data/lib/moneykit/models/response401_get_transactions_diff_links_id_transactions_sync_get.rb +75 -269
- data/lib/moneykit/models/response401_get_transactions_links_id_transactions_get.rb +75 -269
- data/lib/moneykit/models/response401_get_user_accounts_users_id_accounts_get.rb +74 -267
- data/lib/moneykit/models/response401_get_user_links_users_id_links_get.rb +74 -267
- data/lib/moneykit/models/response401_get_user_transactions_users_id_transactions_get.rb +74 -267
- data/lib/moneykit/models/response401_get_well_known_jwks_well_known_jwks_json_get.rb +74 -267
- data/lib/moneykit/models/response401_instrospect_client_auth_introspect_get.rb +74 -267
- data/lib/moneykit/models/response401_refresh_products_links_id_products_post.rb +75 -269
- data/lib/moneykit/models/response401_reset_login_links_id_reset_post.rb +102 -0
- data/lib/moneykit/models/response401_trigger_test_link_webhook_event_webhooks_test_link_id_post.rb +102 -0
- data/lib/moneykit/models/response401_update_link_links_id_patch.rb +75 -269
- data/lib/moneykit/models/transaction.rb +35 -35
- data/lib/moneykit/models/transaction_diff.rb +36 -37
- data/lib/moneykit/models/transaction_sync_response.rb +23 -30
- data/lib/moneykit/models/transaction_type.rb +1 -1
- data/lib/moneykit/models/transaction_type_filter.rb +1 -1
- data/lib/moneykit/models/transactions_link_product.rb +18 -28
- data/lib/moneykit/models/transactions_product_settings.rb +16 -21
- data/lib/moneykit/models/update_link_request.rb +21 -28
- data/lib/moneykit/models/validation_error.rb +25 -28
- data/lib/moneykit/models/validation_error_location_inner.rb +101 -0
- data/lib/moneykit/models/webhook_link_test_event.rb +40 -0
- data/lib/moneykit/models/webhook_test_link_request.rb +252 -0
- data/lib/moneykit/models/webhook_test_link_response.rb +220 -0
- data/lib/moneykit/version.rb +2 -2
- data/lib/moneykit.rb +10 -29
- data/lib/plaid_compatible/money_kit_plaid_compatible/api/plaid_api.rb +684 -679
- data/lib/plaid_compatible/money_kit_plaid_compatible/api_client.rb +330 -330
- data/lib/plaid_compatible/money_kit_plaid_compatible/api_error.rb +33 -33
- data/lib/plaid_compatible/money_kit_plaid_compatible/configuration.rb +245 -245
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/account_balance.rb +198 -198
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/account_base.rb +213 -213
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/account_identity.rb +223 -223
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/account_subtype.rb +89 -89
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/account_type.rb +22 -22
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/accounts_get_request.rb +198 -198
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/accounts_get_request_options.rb +175 -175
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/accounts_get_response.rb +194 -194
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/address.rb +183 -183
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/address_data.rb +209 -209
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/auth_get_numbers.rb +211 -209
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/auth_get_request.rb +198 -198
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/auth_get_request_options.rb +175 -175
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/auth_get_response.rb +200 -200
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/country_code.rb +19 -19
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/email.rb +184 -184
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/http_validation_error.rb +171 -171
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/identity_get_request.rb +198 -198
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/identity_get_request_options.rb +175 -175
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/identity_get_response.rb +194 -194
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/institution.rb +216 -214
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/institutions_get_by_id_request.rb +202 -202
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/institutions_get_by_id_response.rb +183 -183
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/item.rb +246 -245
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_error_webhook.rb +208 -208
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_get_request.rb +192 -192
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_get_response.rb +189 -189
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_public_token_exchange_request.rb +192 -192
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_public_token_exchange_response.rb +193 -193
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_remove_request.rb +192 -192
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_remove_response.rb +175 -175
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_status_investments.rb +182 -182
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_status_last_webhook.rb +182 -182
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_status_nullable.rb +183 -183
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_status_transactions.rb +182 -182
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/link_token_create_request.rb +268 -266
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/link_token_create_request_user.rb +212 -212
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/link_token_create_response.rb +193 -193
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/numbers_ach.rb +202 -202
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/numbers_bacs.rb +193 -193
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/numbers_eft.rb +202 -202
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/numbers_international.rb +193 -193
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/owner.rb +211 -209
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/personal_finance_category.rb +184 -184
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/phone_number.rb +193 -193
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/plaid_error.rb +247 -245
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/plaid_error_type.rb +30 -30
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/products.rb +20 -20
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/removed_transaction.rb +174 -174
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/transaction.rb +283 -283
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_get_request.rb +217 -217
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_get_request_options.rb +211 -211
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_get_response.rb +217 -217
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_refresh_request.rb +192 -192
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_refresh_response.rb +175 -175
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_sync_request.rb +215 -215
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_sync_request_options.rb +184 -184
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_sync_response.rb +228 -228
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/validation_error.rb +187 -187
- data/lib/plaid_compatible/money_kit_plaid_compatible/models/webhook_environment_values.rb +19 -19
- data/lib/plaid_compatible/money_kit_plaid_compatible/version.rb +1 -1
- data/lib/plaid_compatible/money_kit_plaid_compatible.rb +13 -13
- data/moneykit.gemspec +2 -1
- metadata +14 -5
@@ -5,291 +5,97 @@
|
|
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:
|
8
|
+
# OpenAPI Generator version: 7.1.0
|
9
9
|
#
|
10
10
|
|
11
11
|
require 'date'
|
12
12
|
require 'time'
|
13
13
|
|
14
14
|
module MoneyKit
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
when /Integer/i
|
25
|
-
value.to_i
|
26
|
-
when /Float/i
|
27
|
-
value.to_f
|
28
|
-
else
|
29
|
-
value
|
30
|
-
end
|
31
|
-
end
|
15
|
+
module Response401UpdateLinkLinksIdPatch
|
16
|
+
class << self
|
17
|
+
# List of class defined in anyOf (OpenAPI v3)
|
18
|
+
def openapi_any_of
|
19
|
+
%i[
|
20
|
+
APIErrorAuthExpiredAccessTokenResponse
|
21
|
+
APIErrorAuthUnauthorizedResponse
|
22
|
+
LinkErrorUnauthorizedAccessResponse
|
23
|
+
]
|
32
24
|
end
|
33
25
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
attribute_map.values
|
51
|
-
end
|
52
|
-
|
53
|
-
# Attribute type mapping.
|
54
|
-
def self.openapi_types
|
55
|
-
{
|
56
|
-
'error_code': :String,
|
57
|
-
'error_message': :String,
|
58
|
-
'documentation_url': :String
|
59
|
-
}
|
60
|
-
end
|
61
|
-
|
62
|
-
# List of attributes with nullable: true
|
63
|
-
def self.openapi_nullable
|
64
|
-
Set.new([
|
65
|
-
:documentation_url
|
66
|
-
])
|
67
|
-
end
|
68
|
-
|
69
|
-
# List of class defined in anyOf (OpenAPI v3)
|
70
|
-
def self.openapi_any_of
|
71
|
-
%i[
|
72
|
-
APIErrorAuthExpiredAccessTokenResponse
|
73
|
-
APIErrorAuthUnauthorizedResponse
|
74
|
-
LinkErrorUnauthorizedAccessResponse
|
75
|
-
]
|
76
|
-
end
|
77
|
-
|
78
|
-
# Initializes the object
|
79
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
80
|
-
def initialize(attributes = {})
|
81
|
-
unless attributes.is_a?(Hash)
|
82
|
-
raise ArgumentError,
|
83
|
-
'The input argument (attributes) must be a hash in `MoneyKit::Response401UpdateLinkLinksIdPatch` initialize method'
|
84
|
-
end
|
85
|
-
|
86
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
87
|
-
attributes = attributes.each_with_object({}) do |(k, v), h|
|
88
|
-
unless self.class.attribute_map.key?(k.to_sym)
|
89
|
-
raise ArgumentError,
|
90
|
-
"`#{k}` is not a valid attribute in `MoneyKit::Response401UpdateLinkLinksIdPatch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
26
|
+
# Builds the object
|
27
|
+
# @param [Mixed] Data to be matched against the list of anyOf items
|
28
|
+
# @return [Object] Returns the model or the data itself
|
29
|
+
def build(data)
|
30
|
+
# Go through the list of anyOf items and attempt to identify the appropriate one.
|
31
|
+
# Note:
|
32
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
33
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
34
|
+
# - TODO: scalar values are de facto behaving as if they were nullable.
|
35
|
+
# - TODO: logging when debugging is set.
|
36
|
+
openapi_any_of.each do |klass|
|
37
|
+
next if klass == :AnyType # "nullable: true"
|
38
|
+
|
39
|
+
typed_data = find_and_cast_into_type(klass, data)
|
40
|
+
return typed_data if typed_data
|
41
|
+
rescue StandardError # rescue all errors so we keep iterating even if the current item lookup raises
|
91
42
|
end
|
92
43
|
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
self.error_code = if attributes.key?(:error_code)
|
97
|
-
attributes[:error_code]
|
98
|
-
else
|
99
|
-
'link_error.unauthorized_access'
|
100
|
-
end
|
101
|
-
|
102
|
-
self.error_message = if attributes.key?(:error_message)
|
103
|
-
attributes[:error_message]
|
104
|
-
else
|
105
|
-
'Unauthorized link access.'
|
106
|
-
end
|
107
|
-
|
108
|
-
return unless attributes.key?(:documentation_url)
|
109
|
-
|
110
|
-
self.documentation_url = attributes[:documentation_url]
|
111
|
-
end
|
112
|
-
|
113
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
114
|
-
# @return Array for valid properties with the reasons
|
115
|
-
def list_invalid_properties
|
116
|
-
invalid_properties = []
|
117
|
-
invalid_properties.push('invalid value for "error_message", error_message cannot be nil.') if @error_message.nil?
|
118
|
-
|
119
|
-
invalid_properties
|
120
|
-
end
|
121
|
-
|
122
|
-
# Check to see if the all the properties in the model are valid
|
123
|
-
# @return true if the model is valid
|
124
|
-
def valid?
|
125
|
-
error_code_validator = EnumAttributeValidator.new('String', ['link_error.unauthorized_access'])
|
126
|
-
return false unless error_code_validator.valid?(@error_code)
|
127
|
-
return false if @error_message.nil?
|
128
|
-
|
129
|
-
_any_of_found = false
|
130
|
-
self.class.openapi_any_of.each do |_class|
|
131
|
-
_any_of = MoneyKit.const_get(_class).build_from_hash(to_hash)
|
132
|
-
_any_of_found = true if _any_of.valid?
|
133
|
-
end
|
134
|
-
|
135
|
-
return false unless _any_of_found
|
136
|
-
|
137
|
-
true
|
138
|
-
end
|
139
|
-
|
140
|
-
# Custom attribute writer method checking allowed values (enum).
|
141
|
-
# @param [Object] error_code Object to be assigned
|
142
|
-
def error_code=(error_code)
|
143
|
-
validator = EnumAttributeValidator.new('String', ['link_error.unauthorized_access'])
|
144
|
-
unless validator.valid?(error_code)
|
145
|
-
raise ArgumentError, "invalid value for \"error_code\", must be one of #{validator.allowable_values}."
|
44
|
+
openapi_any_of.include?(:AnyType) ? data : nil
|
146
45
|
end
|
147
46
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
176
|
-
# @return [Object] Returns the model itself
|
177
|
-
def self.build_from_hash(attributes)
|
178
|
-
new.build_from_hash(attributes)
|
179
|
-
end
|
180
|
-
|
181
|
-
# Builds the object from hash
|
182
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
183
|
-
# @return [Object] Returns the model itself
|
184
|
-
def build_from_hash(attributes)
|
185
|
-
return nil unless attributes.is_a?(Hash)
|
186
|
-
|
187
|
-
attributes = attributes.transform_keys(&:to_sym)
|
188
|
-
self.class.openapi_types.each_pair do |key, type|
|
189
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
190
|
-
send("#{key}=", nil)
|
191
|
-
elsif type =~ /\AArray<(.*)>/i
|
192
|
-
# check to ensure the input is an array given that the attribute
|
193
|
-
# is documented as an array but the input is not
|
194
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
195
|
-
send("#{key}=", attributes[self.class.attribute_map[key]].map do |v|
|
196
|
-
_deserialize(::Regexp.last_match(1), v)
|
197
|
-
end)
|
47
|
+
private
|
48
|
+
|
49
|
+
SchemaMismatchError = Class.new(StandardError)
|
50
|
+
|
51
|
+
# NOTE: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
52
|
+
def find_and_cast_into_type(klass, data)
|
53
|
+
return if data.nil?
|
54
|
+
|
55
|
+
case klass.to_s
|
56
|
+
when 'Boolean'
|
57
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
58
|
+
when 'Float'
|
59
|
+
return data if data.instance_of?(Float)
|
60
|
+
when 'Integer'
|
61
|
+
return data if data.instance_of?(Integer)
|
62
|
+
when 'Time'
|
63
|
+
return Time.parse(data)
|
64
|
+
when 'Date'
|
65
|
+
return Date.parse(data)
|
66
|
+
when 'String'
|
67
|
+
return data if data.instance_of?(String)
|
68
|
+
when 'Object' # "type: object"
|
69
|
+
return data if data.instance_of?(Hash)
|
70
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
71
|
+
if data.instance_of?(Array)
|
72
|
+
sub_type = Regexp.last_match[:sub_type]
|
73
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
198
74
|
end
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
when :String
|
218
|
-
value.to_s
|
219
|
-
when :Integer
|
220
|
-
value.to_i
|
221
|
-
when :Float
|
222
|
-
value.to_f
|
223
|
-
when :Boolean
|
224
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
225
|
-
true
|
226
|
-
else
|
227
|
-
false
|
228
|
-
end
|
229
|
-
when :Object
|
230
|
-
# generic object (usually a Hash), return directly
|
231
|
-
value
|
232
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
233
|
-
inner_type = Regexp.last_match[:inner_type]
|
234
|
-
value.map { |v| _deserialize(inner_type, v) }
|
235
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
236
|
-
k_type = Regexp.last_match[:k_type]
|
237
|
-
v_type = Regexp.last_match[:v_type]
|
238
|
-
{}.tap do |hash|
|
239
|
-
value.each do |k, v|
|
240
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
75
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
76
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
77
|
+
sub_type = Regexp.last_match[:sub_type]
|
78
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
79
|
+
end
|
80
|
+
else # model
|
81
|
+
const = MoneyKit.const_get(klass)
|
82
|
+
if const
|
83
|
+
if const.respond_to?(:openapi_any_of) # nested anyOf model
|
84
|
+
model = const.build(data)
|
85
|
+
return model if model
|
86
|
+
else
|
87
|
+
# raise if data contains keys that are not known to the model
|
88
|
+
raise unless (data.keys - const.acceptable_attributes).empty?
|
89
|
+
|
90
|
+
model = const.build_from_hash(data)
|
91
|
+
return model if model
|
92
|
+
end
|
241
93
|
end
|
242
|
-
end
|
243
|
-
else # model
|
244
|
-
# models (e.g. Pet) or oneOf
|
245
|
-
klass = MoneyKit.const_get(type)
|
246
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
# Returns the string representation of the object
|
251
|
-
# @return [String] String presentation of the object
|
252
|
-
def to_s
|
253
|
-
to_hash.to_s
|
254
|
-
end
|
255
|
-
|
256
|
-
# to_body is an alias to to_hash (backward compatibility)
|
257
|
-
# @return [Hash] Returns the object in the form of hash
|
258
|
-
def to_body
|
259
|
-
to_hash
|
260
|
-
end
|
261
|
-
|
262
|
-
# Returns the object in the form of hash
|
263
|
-
# @return [Hash] Returns the object in the form of hash
|
264
|
-
def to_hash
|
265
|
-
hash = {}
|
266
|
-
self.class.attribute_map.each_pair do |attr, param|
|
267
|
-
value = send(attr)
|
268
|
-
if value.nil?
|
269
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
270
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
271
94
|
end
|
272
95
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
end
|
277
|
-
|
278
|
-
# Outputs non-array value in the form of hash
|
279
|
-
# For object, use to_hash. Otherwise, just return the value
|
280
|
-
# @param [Object] value Any valid value
|
281
|
-
# @return [Hash] Returns the value in the form of hash
|
282
|
-
def _to_hash(value)
|
283
|
-
if value.is_a?(Array)
|
284
|
-
value.compact.map { |v| _to_hash(v) }
|
285
|
-
elsif value.is_a?(Hash)
|
286
|
-
{}.tap do |hash|
|
287
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
288
|
-
end
|
289
|
-
elsif value.respond_to? :to_hash
|
290
|
-
value.to_hash
|
291
|
-
else
|
292
|
-
value
|
96
|
+
raise # if no match by now, raise
|
97
|
+
rescue StandardError
|
98
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
293
99
|
end
|
294
100
|
end
|
295
101
|
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:
|
8
|
+
# OpenAPI Generator version: 7.1.0
|
9
9
|
#
|
10
10
|
|
11
11
|
require 'date'
|
@@ -27,9 +27,12 @@ module MoneyKit
|
|
27
27
|
# The ISO-4217 currency code of the transaction.
|
28
28
|
attr_accessor :currency
|
29
29
|
|
30
|
-
# The effective (posted) date the transaction, in ISO-8601 format. For pending transactions, this date is when the transaction was initiated.
|
30
|
+
# The effective (posted) date of the transaction, in ISO-8601 format. For pending transactions, this date is when the transaction was initiated.
|
31
31
|
attr_accessor :date
|
32
32
|
|
33
|
+
# 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.
|
34
|
+
attr_accessor :datetime
|
35
|
+
|
33
36
|
# A normalized, cleaned transaction description suitable for presentation to the end user. Commonly this will be the merchant or counterparty name.
|
34
37
|
attr_accessor :description
|
35
38
|
|
@@ -72,6 +75,7 @@ module MoneyKit
|
|
72
75
|
'type': :type,
|
73
76
|
'currency': :currency,
|
74
77
|
'date': :date,
|
78
|
+
'datetime': :datetime,
|
75
79
|
'description': :description,
|
76
80
|
'raw_description': :raw_description,
|
77
81
|
'pending': :pending,
|
@@ -93,6 +97,7 @@ module MoneyKit
|
|
93
97
|
'type': :TransactionType,
|
94
98
|
'currency': :String,
|
95
99
|
'date': :Date,
|
100
|
+
'datetime': :Time,
|
96
101
|
'description': :String,
|
97
102
|
'raw_description': :String,
|
98
103
|
'pending': :Boolean,
|
@@ -102,11 +107,7 @@ module MoneyKit
|
|
102
107
|
|
103
108
|
# List of attributes with nullable: true
|
104
109
|
def self.openapi_nullable
|
105
|
-
Set.new(
|
106
|
-
description
|
107
|
-
raw_description
|
108
|
-
category
|
109
|
-
])
|
110
|
+
Set.new([])
|
110
111
|
end
|
111
112
|
|
112
113
|
# Initializes the object
|
@@ -127,23 +128,25 @@ module MoneyKit
|
|
127
128
|
h[k.to_sym] = v
|
128
129
|
end
|
129
130
|
|
130
|
-
self.transaction_id = attributes[:transaction_id] if attributes.key?(:transaction_id)
|
131
|
+
self.transaction_id = (attributes[:transaction_id] if attributes.key?(:transaction_id))
|
132
|
+
|
133
|
+
self.account_id = (attributes[:account_id] if attributes.key?(:account_id))
|
131
134
|
|
132
|
-
self.
|
135
|
+
self.amount = (attributes[:amount] if attributes.key?(:amount))
|
133
136
|
|
134
|
-
self.
|
137
|
+
self.type = (attributes[:type] if attributes.key?(:type))
|
135
138
|
|
136
|
-
self.
|
139
|
+
self.currency = (attributes[:currency] if attributes.key?(:currency))
|
137
140
|
|
138
|
-
self.
|
141
|
+
self.date = (attributes[:date] if attributes.key?(:date))
|
139
142
|
|
140
|
-
self.
|
143
|
+
self.datetime = attributes[:datetime] if attributes.key?(:datetime)
|
141
144
|
|
142
145
|
self.description = attributes[:description] if attributes.key?(:description)
|
143
146
|
|
144
147
|
self.raw_description = attributes[:raw_description] if attributes.key?(:raw_description)
|
145
148
|
|
146
|
-
self.pending = attributes[:pending] if attributes.key?(:pending)
|
149
|
+
self.pending = (attributes[:pending] if attributes.key?(:pending))
|
147
150
|
|
148
151
|
return unless attributes.key?(:category)
|
149
152
|
|
@@ -153,6 +156,7 @@ module MoneyKit
|
|
153
156
|
# Show invalid properties with the reasons. Usually used together with valid?
|
154
157
|
# @return Array for valid properties with the reasons
|
155
158
|
def list_invalid_properties
|
159
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
156
160
|
invalid_properties = []
|
157
161
|
if @transaction_id.nil?
|
158
162
|
invalid_properties.push('invalid value for "transaction_id", transaction_id cannot be nil.')
|
@@ -176,6 +180,7 @@ module MoneyKit
|
|
176
180
|
# Check to see if the all the properties in the model are valid
|
177
181
|
# @return true if the model is valid
|
178
182
|
def valid?
|
183
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
179
184
|
return false if @transaction_id.nil?
|
180
185
|
return false if @account_id.nil?
|
181
186
|
return false if @amount.nil?
|
@@ -199,6 +204,7 @@ module MoneyKit
|
|
199
204
|
type == other.type &&
|
200
205
|
currency == other.currency &&
|
201
206
|
date == other.date &&
|
207
|
+
datetime == other.datetime &&
|
202
208
|
description == other.description &&
|
203
209
|
raw_description == other.raw_description &&
|
204
210
|
pending == other.pending &&
|
@@ -214,47 +220,41 @@ module MoneyKit
|
|
214
220
|
# Calculates hash code according to all attributes.
|
215
221
|
# @return [Integer] Hash code
|
216
222
|
def hash
|
217
|
-
[transaction_id, account_id, amount, type, currency, date, description, raw_description, pending,
|
223
|
+
[transaction_id, account_id, amount, type, currency, date, datetime, description, raw_description, pending,
|
224
|
+
category].hash
|
218
225
|
end
|
219
226
|
|
220
227
|
# Builds the object from hash
|
221
228
|
# @param [Hash] attributes Model attributes in the form of hash
|
222
229
|
# @return [Object] Returns the model itself
|
223
230
|
def self.build_from_hash(attributes)
|
224
|
-
new.build_from_hash(attributes)
|
225
|
-
end
|
226
|
-
|
227
|
-
# Builds the object from hash
|
228
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
229
|
-
# @return [Object] Returns the model itself
|
230
|
-
def build_from_hash(attributes)
|
231
231
|
return nil unless attributes.is_a?(Hash)
|
232
232
|
|
233
233
|
attributes = attributes.transform_keys(&:to_sym)
|
234
|
-
|
235
|
-
|
236
|
-
|
234
|
+
transformed_hash = {}
|
235
|
+
openapi_types.each_pair do |key, type|
|
236
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
237
|
+
transformed_hash["#{key}"] = nil
|
237
238
|
elsif type =~ /\AArray<(.*)>/i
|
238
239
|
# check to ensure the input is an array given that the attribute
|
239
240
|
# is documented as an array but the input is not
|
240
|
-
if attributes[
|
241
|
-
|
242
|
-
|
243
|
-
|
241
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
242
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map do |v|
|
243
|
+
_deserialize(::Regexp.last_match(1), v)
|
244
|
+
end
|
244
245
|
end
|
245
|
-
elsif !attributes[
|
246
|
-
|
246
|
+
elsif !attributes[attribute_map[key]].nil?
|
247
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
247
248
|
end
|
248
249
|
end
|
249
|
-
|
250
|
-
self
|
250
|
+
new(transformed_hash)
|
251
251
|
end
|
252
252
|
|
253
253
|
# Deserializes the data based on type
|
254
254
|
# @param string type Data type
|
255
255
|
# @param string value Value to be deserialized
|
256
256
|
# @return [Object] Deserialized data
|
257
|
-
def _deserialize(type, value)
|
257
|
+
def self._deserialize(type, value)
|
258
258
|
case type.to_sym
|
259
259
|
when :Time
|
260
260
|
Time.parse(value)
|
@@ -289,7 +289,7 @@ module MoneyKit
|
|
289
289
|
else # model
|
290
290
|
# models (e.g. Pet) or oneOf
|
291
291
|
klass = MoneyKit.const_get(type)
|
292
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
292
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
293
293
|
end
|
294
294
|
end
|
295
295
|
|