moneykit 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- 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,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'
|
@@ -32,7 +32,7 @@ module MoneyKit
|
|
32
32
|
# Attribute type mapping.
|
33
33
|
def self.openapi_types
|
34
34
|
{
|
35
|
-
'location': :'Array<
|
35
|
+
'location': :'Array<ValidationErrorLocationInner>',
|
36
36
|
'message': :String,
|
37
37
|
'type': :String
|
38
38
|
}
|
@@ -61,20 +61,23 @@ module MoneyKit
|
|
61
61
|
h[k.to_sym] = v
|
62
62
|
end
|
63
63
|
|
64
|
-
if attributes.key?(:location)
|
65
|
-
|
64
|
+
if attributes.key?(:location)
|
65
|
+
if (value = attributes[:location]).is_a?(Array)
|
66
|
+
self.location = value
|
67
|
+
end
|
68
|
+
else
|
69
|
+
self.location = nil
|
66
70
|
end
|
67
71
|
|
68
|
-
self.message = attributes[:message] if attributes.key?(:message)
|
69
|
-
|
70
|
-
return unless attributes.key?(:type)
|
72
|
+
self.message = (attributes[:message] if attributes.key?(:message))
|
71
73
|
|
72
|
-
self.type = attributes[:type]
|
74
|
+
self.type = (attributes[:type] if attributes.key?(:type))
|
73
75
|
end
|
74
76
|
|
75
77
|
# Show invalid properties with the reasons. Usually used together with valid?
|
76
78
|
# @return Array for valid properties with the reasons
|
77
79
|
def list_invalid_properties
|
80
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
78
81
|
invalid_properties = []
|
79
82
|
invalid_properties.push('invalid value for "location", location cannot be nil.') if @location.nil?
|
80
83
|
|
@@ -88,6 +91,7 @@ module MoneyKit
|
|
88
91
|
# Check to see if the all the properties in the model are valid
|
89
92
|
# @return true if the model is valid
|
90
93
|
def valid?
|
94
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
91
95
|
return false if @location.nil?
|
92
96
|
return false if @message.nil?
|
93
97
|
return false if @type.nil?
|
@@ -122,40 +126,33 @@ module MoneyKit
|
|
122
126
|
# @param [Hash] attributes Model attributes in the form of hash
|
123
127
|
# @return [Object] Returns the model itself
|
124
128
|
def self.build_from_hash(attributes)
|
125
|
-
new.build_from_hash(attributes)
|
126
|
-
end
|
127
|
-
|
128
|
-
# Builds the object from hash
|
129
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
130
|
-
# @return [Object] Returns the model itself
|
131
|
-
def build_from_hash(attributes)
|
132
129
|
return nil unless attributes.is_a?(Hash)
|
133
130
|
|
134
131
|
attributes = attributes.transform_keys(&:to_sym)
|
135
|
-
|
136
|
-
|
137
|
-
|
132
|
+
transformed_hash = {}
|
133
|
+
openapi_types.each_pair do |key, type|
|
134
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
135
|
+
transformed_hash["#{key}"] = nil
|
138
136
|
elsif type =~ /\AArray<(.*)>/i
|
139
137
|
# check to ensure the input is an array given that the attribute
|
140
138
|
# is documented as an array but the input is not
|
141
|
-
if attributes[
|
142
|
-
|
143
|
-
|
144
|
-
|
139
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
140
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map do |v|
|
141
|
+
_deserialize(::Regexp.last_match(1), v)
|
142
|
+
end
|
145
143
|
end
|
146
|
-
elsif !attributes[
|
147
|
-
|
144
|
+
elsif !attributes[attribute_map[key]].nil?
|
145
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
148
146
|
end
|
149
147
|
end
|
150
|
-
|
151
|
-
self
|
148
|
+
new(transformed_hash)
|
152
149
|
end
|
153
150
|
|
154
151
|
# Deserializes the data based on type
|
155
152
|
# @param string type Data type
|
156
153
|
# @param string value Value to be deserialized
|
157
154
|
# @return [Object] Deserialized data
|
158
|
-
def _deserialize(type, value)
|
155
|
+
def self._deserialize(type, value)
|
159
156
|
case type.to_sym
|
160
157
|
when :Time
|
161
158
|
Time.parse(value)
|
@@ -190,7 +187,7 @@ module MoneyKit
|
|
190
187
|
else # model
|
191
188
|
# models (e.g. Pet) or oneOf
|
192
189
|
klass = MoneyKit.const_get(type)
|
193
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
190
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
194
191
|
end
|
195
192
|
end
|
196
193
|
|
@@ -0,0 +1,101 @@
|
|
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 'date'
|
12
|
+
require 'time'
|
13
|
+
|
14
|
+
module MoneyKit
|
15
|
+
module ValidationErrorLocationInner
|
16
|
+
class << self
|
17
|
+
# List of class defined in anyOf (OpenAPI v3)
|
18
|
+
def openapi_any_of
|
19
|
+
%i[
|
20
|
+
Integer
|
21
|
+
String
|
22
|
+
]
|
23
|
+
end
|
24
|
+
|
25
|
+
# Builds the object
|
26
|
+
# @param [Mixed] Data to be matched against the list of anyOf items
|
27
|
+
# @return [Object] Returns the model or the data itself
|
28
|
+
def build(data)
|
29
|
+
# Go through the list of anyOf items and attempt to identify the appropriate one.
|
30
|
+
# Note:
|
31
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
32
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
33
|
+
# - TODO: scalar values are de facto behaving as if they were nullable.
|
34
|
+
# - TODO: logging when debugging is set.
|
35
|
+
openapi_any_of.each do |klass|
|
36
|
+
next if klass == :AnyType # "nullable: true"
|
37
|
+
|
38
|
+
typed_data = find_and_cast_into_type(klass, data)
|
39
|
+
return typed_data if typed_data
|
40
|
+
rescue StandardError # rescue all errors so we keep iterating even if the current item lookup raises
|
41
|
+
end
|
42
|
+
|
43
|
+
openapi_any_of.include?(:AnyType) ? data : nil
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
SchemaMismatchError = Class.new(StandardError)
|
49
|
+
|
50
|
+
# NOTE: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
51
|
+
def find_and_cast_into_type(klass, data)
|
52
|
+
return if data.nil?
|
53
|
+
|
54
|
+
case klass.to_s
|
55
|
+
when 'Boolean'
|
56
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
57
|
+
when 'Float'
|
58
|
+
return data if data.instance_of?(Float)
|
59
|
+
when 'Integer'
|
60
|
+
return data if data.instance_of?(Integer)
|
61
|
+
when 'Time'
|
62
|
+
return Time.parse(data)
|
63
|
+
when 'Date'
|
64
|
+
return Date.parse(data)
|
65
|
+
when 'String'
|
66
|
+
return data if data.instance_of?(String)
|
67
|
+
when 'Object' # "type: object"
|
68
|
+
return data if data.instance_of?(Hash)
|
69
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
70
|
+
if data.instance_of?(Array)
|
71
|
+
sub_type = Regexp.last_match[:sub_type]
|
72
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
73
|
+
end
|
74
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
75
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
76
|
+
sub_type = Regexp.last_match[:sub_type]
|
77
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
78
|
+
end
|
79
|
+
else # model
|
80
|
+
const = MoneyKit.const_get(klass)
|
81
|
+
if const
|
82
|
+
if const.respond_to?(:openapi_any_of) # nested anyOf model
|
83
|
+
model = const.build(data)
|
84
|
+
return model if model
|
85
|
+
else
|
86
|
+
# raise if data contains keys that are not known to the model
|
87
|
+
raise unless (data.keys - const.acceptable_attributes).empty?
|
88
|
+
|
89
|
+
model = const.build_from_hash(data)
|
90
|
+
return model if model
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
raise # if no match by now, raise
|
96
|
+
rescue StandardError
|
97
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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 'date'
|
12
|
+
require 'time'
|
13
|
+
|
14
|
+
module MoneyKit
|
15
|
+
class WebhookLinkTestEvent
|
16
|
+
LINK_STATE_CHANGED = 'link.state_changed'.freeze
|
17
|
+
LINK_PRODUCT_REFRESH = 'link.product_refresh'.freeze
|
18
|
+
TRANSACTIONS_UPDATES_AVAILABLE = 'transactions.updates_available'.freeze
|
19
|
+
|
20
|
+
def self.all_vars
|
21
|
+
@all_vars ||= [LINK_STATE_CHANGED, LINK_PRODUCT_REFRESH, TRANSACTIONS_UPDATES_AVAILABLE].freeze
|
22
|
+
end
|
23
|
+
|
24
|
+
# Builds the enum from string
|
25
|
+
# @param [String] The enum value in the form of the string
|
26
|
+
# @return [String] The enum value
|
27
|
+
def self.build_from_hash(value)
|
28
|
+
new.build_from_hash(value)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Builds the enum from string
|
32
|
+
# @param [String] The enum value in the form of the string
|
33
|
+
# @return [String] The enum value
|
34
|
+
def build_from_hash(value)
|
35
|
+
return value if WebhookLinkTestEvent.all_vars.include?(value)
|
36
|
+
|
37
|
+
raise "Invalid ENUM value #{value} for class #WebhookLinkTestEvent"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,252 @@
|
|
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 'date'
|
12
|
+
require 'time'
|
13
|
+
|
14
|
+
module MoneyKit
|
15
|
+
class WebhookTestLinkRequest
|
16
|
+
attr_accessor :webhook_event
|
17
|
+
|
18
|
+
# Set this to a unique value that you can check against the delivered webhook payload (`webhook_idempotency_key`).
|
19
|
+
attr_accessor :webhook_idempotency_key
|
20
|
+
|
21
|
+
class EnumAttributeValidator
|
22
|
+
attr_reader :datatype, :allowable_values
|
23
|
+
|
24
|
+
def initialize(datatype, allowable_values)
|
25
|
+
@allowable_values = allowable_values.map do |value|
|
26
|
+
case datatype.to_s
|
27
|
+
when /Integer/i
|
28
|
+
value.to_i
|
29
|
+
when /Float/i
|
30
|
+
value.to_f
|
31
|
+
else
|
32
|
+
value
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def valid?(value)
|
38
|
+
!value || allowable_values.include?(value)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
43
|
+
def self.attribute_map
|
44
|
+
{
|
45
|
+
'webhook_event': :webhook_event,
|
46
|
+
'webhook_idempotency_key': :webhook_idempotency_key
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns all the JSON keys this model knows about
|
51
|
+
def self.acceptable_attributes
|
52
|
+
attribute_map.values
|
53
|
+
end
|
54
|
+
|
55
|
+
# Attribute type mapping.
|
56
|
+
def self.openapi_types
|
57
|
+
{
|
58
|
+
'webhook_event': :WebhookLinkTestEvent,
|
59
|
+
'webhook_idempotency_key': :String
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
# List of attributes with nullable: true
|
64
|
+
def self.openapi_nullable
|
65
|
+
Set.new([])
|
66
|
+
end
|
67
|
+
|
68
|
+
# Initializes the object
|
69
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
70
|
+
def initialize(attributes = {})
|
71
|
+
unless attributes.is_a?(Hash)
|
72
|
+
raise ArgumentError,
|
73
|
+
'The input argument (attributes) must be a hash in `MoneyKit::WebhookTestLinkRequest` initialize method'
|
74
|
+
end
|
75
|
+
|
76
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
77
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
78
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
79
|
+
raise ArgumentError,
|
80
|
+
"`#{k}` is not a valid attribute in `MoneyKit::WebhookTestLinkRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
81
|
+
end
|
82
|
+
|
83
|
+
h[k.to_sym] = v
|
84
|
+
end
|
85
|
+
|
86
|
+
self.webhook_event = (attributes[:webhook_event] if attributes.key?(:webhook_event))
|
87
|
+
|
88
|
+
self.webhook_idempotency_key = (attributes[:webhook_idempotency_key] if attributes.key?(:webhook_idempotency_key))
|
89
|
+
end
|
90
|
+
|
91
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
92
|
+
# @return Array for valid properties with the reasons
|
93
|
+
def list_invalid_properties
|
94
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
95
|
+
invalid_properties = []
|
96
|
+
invalid_properties.push('invalid value for "webhook_event", webhook_event cannot be nil.') if @webhook_event.nil?
|
97
|
+
|
98
|
+
if @webhook_idempotency_key.nil?
|
99
|
+
invalid_properties.push('invalid value for "webhook_idempotency_key", webhook_idempotency_key cannot be nil.')
|
100
|
+
end
|
101
|
+
|
102
|
+
invalid_properties
|
103
|
+
end
|
104
|
+
|
105
|
+
# Check to see if the all the properties in the model are valid
|
106
|
+
# @return true if the model is valid
|
107
|
+
def valid?
|
108
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
109
|
+
return false if @webhook_event.nil?
|
110
|
+
return false if @webhook_idempotency_key.nil?
|
111
|
+
|
112
|
+
true
|
113
|
+
end
|
114
|
+
|
115
|
+
# Checks equality by comparing each attribute.
|
116
|
+
# @param [Object] Object to be compared
|
117
|
+
def ==(other)
|
118
|
+
return true if equal?(other)
|
119
|
+
|
120
|
+
self.class == other.class &&
|
121
|
+
webhook_event == other.webhook_event &&
|
122
|
+
webhook_idempotency_key == other.webhook_idempotency_key
|
123
|
+
end
|
124
|
+
|
125
|
+
# @see the `==` method
|
126
|
+
# @param [Object] Object to be compared
|
127
|
+
def eql?(other)
|
128
|
+
self == other
|
129
|
+
end
|
130
|
+
|
131
|
+
# Calculates hash code according to all attributes.
|
132
|
+
# @return [Integer] Hash code
|
133
|
+
def hash
|
134
|
+
[webhook_event, webhook_idempotency_key].hash
|
135
|
+
end
|
136
|
+
|
137
|
+
# Builds the object from hash
|
138
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
139
|
+
# @return [Object] Returns the model itself
|
140
|
+
def self.build_from_hash(attributes)
|
141
|
+
return nil unless attributes.is_a?(Hash)
|
142
|
+
|
143
|
+
attributes = attributes.transform_keys(&:to_sym)
|
144
|
+
transformed_hash = {}
|
145
|
+
openapi_types.each_pair do |key, type|
|
146
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
147
|
+
transformed_hash["#{key}"] = nil
|
148
|
+
elsif type =~ /\AArray<(.*)>/i
|
149
|
+
# check to ensure the input is an array given that the attribute
|
150
|
+
# is documented as an array but the input is not
|
151
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
152
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map do |v|
|
153
|
+
_deserialize(::Regexp.last_match(1), v)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
elsif !attributes[attribute_map[key]].nil?
|
157
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
158
|
+
end
|
159
|
+
end
|
160
|
+
new(transformed_hash)
|
161
|
+
end
|
162
|
+
|
163
|
+
# Deserializes the data based on type
|
164
|
+
# @param string type Data type
|
165
|
+
# @param string value Value to be deserialized
|
166
|
+
# @return [Object] Deserialized data
|
167
|
+
def self._deserialize(type, value)
|
168
|
+
case type.to_sym
|
169
|
+
when :Time
|
170
|
+
Time.parse(value)
|
171
|
+
when :Date
|
172
|
+
Date.parse(value)
|
173
|
+
when :String
|
174
|
+
value.to_s
|
175
|
+
when :Integer
|
176
|
+
value.to_i
|
177
|
+
when :Float
|
178
|
+
value.to_f
|
179
|
+
when :Boolean
|
180
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
181
|
+
true
|
182
|
+
else
|
183
|
+
false
|
184
|
+
end
|
185
|
+
when :Object
|
186
|
+
# generic object (usually a Hash), return directly
|
187
|
+
value
|
188
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
189
|
+
inner_type = Regexp.last_match[:inner_type]
|
190
|
+
value.map { |v| _deserialize(inner_type, v) }
|
191
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
192
|
+
k_type = Regexp.last_match[:k_type]
|
193
|
+
v_type = Regexp.last_match[:v_type]
|
194
|
+
{}.tap do |hash|
|
195
|
+
value.each do |k, v|
|
196
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
else # model
|
200
|
+
# models (e.g. Pet) or oneOf
|
201
|
+
klass = MoneyKit.const_get(type)
|
202
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
# Returns the string representation of the object
|
207
|
+
# @return [String] String presentation of the object
|
208
|
+
def to_s
|
209
|
+
to_hash.to_s
|
210
|
+
end
|
211
|
+
|
212
|
+
# to_body is an alias to to_hash (backward compatibility)
|
213
|
+
# @return [Hash] Returns the object in the form of hash
|
214
|
+
def to_body
|
215
|
+
to_hash
|
216
|
+
end
|
217
|
+
|
218
|
+
# Returns the object in the form of hash
|
219
|
+
# @return [Hash] Returns the object in the form of hash
|
220
|
+
def to_hash
|
221
|
+
hash = {}
|
222
|
+
self.class.attribute_map.each_pair do |attr, param|
|
223
|
+
value = send(attr)
|
224
|
+
if value.nil?
|
225
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
226
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
227
|
+
end
|
228
|
+
|
229
|
+
hash[param] = _to_hash(value)
|
230
|
+
end
|
231
|
+
hash
|
232
|
+
end
|
233
|
+
|
234
|
+
# Outputs non-array value in the form of hash
|
235
|
+
# For object, use to_hash. Otherwise, just return the value
|
236
|
+
# @param [Object] value Any valid value
|
237
|
+
# @return [Hash] Returns the value in the form of hash
|
238
|
+
def _to_hash(value)
|
239
|
+
if value.is_a?(Array)
|
240
|
+
value.compact.map { |v| _to_hash(v) }
|
241
|
+
elsif value.is_a?(Hash)
|
242
|
+
{}.tap do |hash|
|
243
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
244
|
+
end
|
245
|
+
elsif value.respond_to? :to_hash
|
246
|
+
value.to_hash
|
247
|
+
else
|
248
|
+
value
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|