moneykit 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/moneykit/api/access_token_api.rb +9 -9
  4. data/lib/moneykit/api/account_numbers_api.rb +6 -6
  5. data/lib/moneykit/api/accounts_api.rb +15 -15
  6. data/lib/moneykit/api/identity_api.rb +6 -6
  7. data/lib/moneykit/api/institutions_api.rb +7 -7
  8. data/lib/moneykit/api/link_session_api.rb +7 -7
  9. data/lib/moneykit/api/links_api.rb +76 -13
  10. data/lib/moneykit/api/products_api.rb +6 -6
  11. data/lib/moneykit/api/transactions_api.rb +28 -28
  12. data/lib/moneykit/api/users_api.rb +14 -14
  13. data/lib/moneykit/api/webhooks_api.rb +97 -0
  14. data/lib/moneykit/api_client.rb +40 -36
  15. data/lib/moneykit/api_error.rb +1 -1
  16. data/lib/moneykit/configuration.rb +20 -30
  17. data/lib/moneykit/models/account.rb +27 -54
  18. data/lib/moneykit/models/account_balances.rb +18 -27
  19. data/lib/moneykit/models/account_group.rb +23 -26
  20. data/lib/moneykit/models/account_identity.rb +34 -59
  21. data/lib/moneykit/models/account_numbers.rb +75 -51
  22. data/lib/moneykit/models/account_numbers_link_product.rb +18 -28
  23. data/lib/moneykit/models/account_numbers_product_settings.rb +16 -21
  24. data/lib/moneykit/models/account_with_account_numbers.rb +29 -56
  25. data/lib/moneykit/models/accounts_link_product.rb +17 -25
  26. data/lib/moneykit/models/ach_number.rb +19 -26
  27. data/lib/moneykit/models/address.rb +17 -28
  28. data/lib/moneykit/models/api_error_auth_expired_access_token_response.rb +17 -24
  29. data/lib/moneykit/models/api_error_auth_unauthorized_response.rb +18 -25
  30. data/lib/moneykit/models/api_error_rate_limit_exceeded_response.rb +17 -24
  31. data/lib/moneykit/models/bacs_number.rb +18 -25
  32. data/lib/moneykit/models/basic_account_details.rb +20 -29
  33. data/lib/moneykit/models/country.rb +1 -1
  34. data/lib/moneykit/models/create_link_session_request.rb +48 -45
  35. data/lib/moneykit/models/create_link_session_response.rb +17 -24
  36. data/lib/moneykit/models/currency.rb +1 -1
  37. data/lib/moneykit/models/cursor_pagination.rb +17 -24
  38. data/lib/moneykit/models/customer_app.rb +18 -25
  39. data/lib/moneykit/models/eft_number.rb +19 -26
  40. data/lib/moneykit/models/email.rb +17 -22
  41. data/lib/moneykit/models/exchange_token_request.rb +17 -24
  42. data/lib/moneykit/models/exchange_token_response.rb +19 -26
  43. data/lib/moneykit/models/generate_access_token_response.rb +19 -26
  44. data/lib/moneykit/models/get_account_numbers_response.rb +23 -26
  45. data/lib/moneykit/models/get_account_response.rb +19 -26
  46. data/lib/moneykit/models/get_accounts_response.rb +25 -31
  47. data/lib/moneykit/models/get_institutions_response.rb +25 -31
  48. data/lib/moneykit/models/get_transactions_response.rb +34 -39
  49. data/lib/moneykit/models/get_user_accounts_response.rb +24 -32
  50. data/lib/moneykit/models/get_user_links_response.rb +24 -32
  51. data/lib/moneykit/models/get_user_transactions_response.rb +32 -34
  52. data/lib/moneykit/models/http_validation_error.rb +24 -28
  53. data/lib/moneykit/models/identity_link_product.rb +18 -28
  54. data/lib/moneykit/models/identity_product_settings.rb +16 -21
  55. data/lib/moneykit/models/identity_response.rb +24 -30
  56. data/lib/moneykit/models/institution.rb +29 -38
  57. data/lib/moneykit/models/institution_error_not_found_response.rb +17 -24
  58. data/lib/moneykit/models/international_number.rb +18 -25
  59. data/lib/moneykit/models/introspect_client_response.rb +22 -29
  60. data/lib/moneykit/models/jwk_set.rb +23 -26
  61. data/lib/moneykit/models/link_common.rb +25 -39
  62. data/lib/moneykit/models/link_error_bad_config_response.rb +269 -0
  63. data/lib/moneykit/models/link_error_bad_state_response.rb +19 -28
  64. data/lib/moneykit/models/link_error_deleted_response.rb +17 -24
  65. data/lib/moneykit/models/link_error_forbidden_action_response.rb +18 -25
  66. data/lib/moneykit/models/link_error_not_found_response.rb +17 -24
  67. data/lib/moneykit/models/link_error_unauthorized_access_response.rb +17 -24
  68. data/lib/moneykit/models/link_permission_scope.rb +1 -1
  69. data/lib/moneykit/models/link_permissions.rb +23 -33
  70. data/lib/moneykit/models/link_products.rb +16 -21
  71. data/lib/moneykit/models/link_response.rb +26 -39
  72. data/lib/moneykit/models/link_session_customer_user.rb +20 -28
  73. data/lib/moneykit/models/link_session_customer_user_email.rb +18 -25
  74. data/lib/moneykit/models/link_session_customer_user_phone.rb +18 -26
  75. data/lib/moneykit/models/link_session_error_forbidden_config_response.rb +18 -25
  76. data/lib/moneykit/models/link_session_error_invalid_token_exchange.rb +18 -25
  77. data/lib/moneykit/models/link_session_setting_overrides.rb +19 -43
  78. data/lib/moneykit/models/link_state.rb +1 -1
  79. data/lib/moneykit/models/link_state_changed_webhook.rb +28 -31
  80. data/lib/moneykit/models/money_link_features.rb +27 -32
  81. data/lib/moneykit/models/owner.rb +42 -42
  82. data/lib/moneykit/models/phone_number.rb +18 -25
  83. data/lib/moneykit/models/phone_number_type.rb +1 -1
  84. data/lib/moneykit/models/product.rb +1 -1
  85. data/lib/moneykit/models/products_settings.rb +19 -24
  86. data/lib/moneykit/models/provider.rb +4 -2
  87. data/lib/moneykit/models/public_link_error.rb +43 -0
  88. data/lib/moneykit/models/refresh_products_request.rb +23 -34
  89. data/lib/moneykit/models/requested_link_permission.rb +19 -26
  90. data/lib/moneykit/models/response401_disconnect_links_id_delete.rb +75 -269
  91. data/lib/moneykit/models/response401_exchange_token_link_session_exchange_token_post.rb +74 -267
  92. data/lib/moneykit/models/response401_get_account_links_id_accounts_account_id_get.rb +75 -269
  93. data/lib/moneykit/models/response401_get_account_numbers_links_id_accounts_numbers_get.rb +75 -269
  94. data/lib/moneykit/models/response401_get_accounts_links_id_accounts_get.rb +75 -269
  95. data/lib/moneykit/models/response401_get_identities_links_id_identity_get.rb +75 -269
  96. data/lib/moneykit/models/response401_get_institution_institutions_institution_id_get.rb +74 -267
  97. data/lib/moneykit/models/response401_get_institutions_institutions_get.rb +74 -267
  98. data/lib/moneykit/models/response401_get_link_links_id_get.rb +75 -269
  99. data/lib/moneykit/models/response401_get_transactions_diff_links_id_transactions_sync_get.rb +75 -269
  100. data/lib/moneykit/models/response401_get_transactions_links_id_transactions_get.rb +75 -269
  101. data/lib/moneykit/models/response401_get_user_accounts_users_id_accounts_get.rb +74 -267
  102. data/lib/moneykit/models/response401_get_user_links_users_id_links_get.rb +74 -267
  103. data/lib/moneykit/models/response401_get_user_transactions_users_id_transactions_get.rb +74 -267
  104. data/lib/moneykit/models/response401_get_well_known_jwks_well_known_jwks_json_get.rb +74 -267
  105. data/lib/moneykit/models/response401_instrospect_client_auth_introspect_get.rb +74 -267
  106. data/lib/moneykit/models/response401_refresh_products_links_id_products_post.rb +75 -269
  107. data/lib/moneykit/models/response401_reset_login_links_id_reset_post.rb +102 -0
  108. data/lib/moneykit/models/response401_trigger_test_link_webhook_event_webhooks_test_link_id_post.rb +102 -0
  109. data/lib/moneykit/models/response401_update_link_links_id_patch.rb +75 -269
  110. data/lib/moneykit/models/transaction.rb +35 -35
  111. data/lib/moneykit/models/transaction_diff.rb +36 -37
  112. data/lib/moneykit/models/transaction_sync_response.rb +23 -30
  113. data/lib/moneykit/models/transaction_type.rb +1 -1
  114. data/lib/moneykit/models/transaction_type_filter.rb +1 -1
  115. data/lib/moneykit/models/transactions_link_product.rb +18 -28
  116. data/lib/moneykit/models/transactions_product_settings.rb +16 -21
  117. data/lib/moneykit/models/update_link_request.rb +21 -28
  118. data/lib/moneykit/models/validation_error.rb +25 -28
  119. data/lib/moneykit/models/validation_error_location_inner.rb +101 -0
  120. data/lib/moneykit/models/webhook_link_test_event.rb +40 -0
  121. data/lib/moneykit/models/webhook_test_link_request.rb +252 -0
  122. data/lib/moneykit/models/webhook_test_link_response.rb +220 -0
  123. data/lib/moneykit/version.rb +2 -2
  124. data/lib/moneykit.rb +10 -29
  125. data/lib/plaid_compatible/money_kit_plaid_compatible/api/plaid_api.rb +684 -679
  126. data/lib/plaid_compatible/money_kit_plaid_compatible/api_client.rb +330 -330
  127. data/lib/plaid_compatible/money_kit_plaid_compatible/api_error.rb +33 -33
  128. data/lib/plaid_compatible/money_kit_plaid_compatible/configuration.rb +245 -245
  129. data/lib/plaid_compatible/money_kit_plaid_compatible/models/account_balance.rb +198 -198
  130. data/lib/plaid_compatible/money_kit_plaid_compatible/models/account_base.rb +213 -213
  131. data/lib/plaid_compatible/money_kit_plaid_compatible/models/account_identity.rb +223 -223
  132. data/lib/plaid_compatible/money_kit_plaid_compatible/models/account_subtype.rb +89 -89
  133. data/lib/plaid_compatible/money_kit_plaid_compatible/models/account_type.rb +22 -22
  134. data/lib/plaid_compatible/money_kit_plaid_compatible/models/accounts_get_request.rb +198 -198
  135. data/lib/plaid_compatible/money_kit_plaid_compatible/models/accounts_get_request_options.rb +175 -175
  136. data/lib/plaid_compatible/money_kit_plaid_compatible/models/accounts_get_response.rb +194 -194
  137. data/lib/plaid_compatible/money_kit_plaid_compatible/models/address.rb +183 -183
  138. data/lib/plaid_compatible/money_kit_plaid_compatible/models/address_data.rb +209 -209
  139. data/lib/plaid_compatible/money_kit_plaid_compatible/models/auth_get_numbers.rb +211 -209
  140. data/lib/plaid_compatible/money_kit_plaid_compatible/models/auth_get_request.rb +198 -198
  141. data/lib/plaid_compatible/money_kit_plaid_compatible/models/auth_get_request_options.rb +175 -175
  142. data/lib/plaid_compatible/money_kit_plaid_compatible/models/auth_get_response.rb +200 -200
  143. data/lib/plaid_compatible/money_kit_plaid_compatible/models/country_code.rb +19 -19
  144. data/lib/plaid_compatible/money_kit_plaid_compatible/models/email.rb +184 -184
  145. data/lib/plaid_compatible/money_kit_plaid_compatible/models/http_validation_error.rb +171 -171
  146. data/lib/plaid_compatible/money_kit_plaid_compatible/models/identity_get_request.rb +198 -198
  147. data/lib/plaid_compatible/money_kit_plaid_compatible/models/identity_get_request_options.rb +175 -175
  148. data/lib/plaid_compatible/money_kit_plaid_compatible/models/identity_get_response.rb +194 -194
  149. data/lib/plaid_compatible/money_kit_plaid_compatible/models/institution.rb +216 -214
  150. data/lib/plaid_compatible/money_kit_plaid_compatible/models/institutions_get_by_id_request.rb +202 -202
  151. data/lib/plaid_compatible/money_kit_plaid_compatible/models/institutions_get_by_id_response.rb +183 -183
  152. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item.rb +246 -245
  153. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_error_webhook.rb +208 -208
  154. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_get_request.rb +192 -192
  155. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_get_response.rb +189 -189
  156. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_public_token_exchange_request.rb +192 -192
  157. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_public_token_exchange_response.rb +193 -193
  158. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_remove_request.rb +192 -192
  159. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_remove_response.rb +175 -175
  160. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_status_investments.rb +182 -182
  161. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_status_last_webhook.rb +182 -182
  162. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_status_nullable.rb +183 -183
  163. data/lib/plaid_compatible/money_kit_plaid_compatible/models/item_status_transactions.rb +182 -182
  164. data/lib/plaid_compatible/money_kit_plaid_compatible/models/link_token_create_request.rb +268 -266
  165. data/lib/plaid_compatible/money_kit_plaid_compatible/models/link_token_create_request_user.rb +212 -212
  166. data/lib/plaid_compatible/money_kit_plaid_compatible/models/link_token_create_response.rb +193 -193
  167. data/lib/plaid_compatible/money_kit_plaid_compatible/models/numbers_ach.rb +202 -202
  168. data/lib/plaid_compatible/money_kit_plaid_compatible/models/numbers_bacs.rb +193 -193
  169. data/lib/plaid_compatible/money_kit_plaid_compatible/models/numbers_eft.rb +202 -202
  170. data/lib/plaid_compatible/money_kit_plaid_compatible/models/numbers_international.rb +193 -193
  171. data/lib/plaid_compatible/money_kit_plaid_compatible/models/owner.rb +211 -209
  172. data/lib/plaid_compatible/money_kit_plaid_compatible/models/personal_finance_category.rb +184 -184
  173. data/lib/plaid_compatible/money_kit_plaid_compatible/models/phone_number.rb +193 -193
  174. data/lib/plaid_compatible/money_kit_plaid_compatible/models/plaid_error.rb +247 -245
  175. data/lib/plaid_compatible/money_kit_plaid_compatible/models/plaid_error_type.rb +30 -30
  176. data/lib/plaid_compatible/money_kit_plaid_compatible/models/products.rb +20 -20
  177. data/lib/plaid_compatible/money_kit_plaid_compatible/models/removed_transaction.rb +174 -174
  178. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transaction.rb +283 -283
  179. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_get_request.rb +217 -217
  180. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_get_request_options.rb +211 -211
  181. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_get_response.rb +217 -217
  182. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_refresh_request.rb +192 -192
  183. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_refresh_response.rb +175 -175
  184. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_sync_request.rb +215 -215
  185. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_sync_request_options.rb +184 -184
  186. data/lib/plaid_compatible/money_kit_plaid_compatible/models/transactions_sync_response.rb +228 -228
  187. data/lib/plaid_compatible/money_kit_plaid_compatible/models/validation_error.rb +187 -187
  188. data/lib/plaid_compatible/money_kit_plaid_compatible/models/webhook_environment_values.rb +19 -19
  189. data/lib/plaid_compatible/money_kit_plaid_compatible/version.rb +1 -1
  190. data/lib/plaid_compatible/money_kit_plaid_compatible.rb +13 -13
  191. data/moneykit.gemspec +2 -1
  192. metadata +14 -5
@@ -13,222 +13,222 @@ require 'time'
13
13
 
14
14
  module MoneyKit
15
15
  module PlaidCompatible
16
- # Information about the last successful and failed investments update for the Item.
17
- class ItemStatusInvestments
18
- # [ISO 8601](https://wikipedia.org/wiki/ISO_8601) timestamp of the last successful investments update for the Item. The status will update each time Plaid successfully connects with the institution, regardless of whether any new data is available in the update.
19
- attr_accessor :last_successful_update
20
-
21
- # [ISO 8601](https://wikipedia.org/wiki/ISO_8601) timestamp of the last failed investments update for the Item. The status will update each time Plaid fails an attempt to connect with the institution, regardless of whether any new data is available in the update.
22
- attr_accessor :last_failed_update
23
-
24
- # Attribute mapping from ruby-style variable name to JSON key.
25
- def self.attribute_map
26
- {
27
- 'last_successful_update': :last_successful_update,
28
- 'last_failed_update': :last_failed_update
29
- }
30
- end
31
-
32
- # Returns all the JSON keys this model knows about
33
- def self.acceptable_attributes
34
- attribute_map.values
35
- end
16
+ # Information about the last successful and failed investments update for the Item.
17
+ class ItemStatusInvestments
18
+ # [ISO 8601](https://wikipedia.org/wiki/ISO_8601) timestamp of the last successful investments update for the Item. The status will update each time Plaid successfully connects with the institution, regardless of whether any new data is available in the update.
19
+ attr_accessor :last_successful_update
20
+
21
+ # [ISO 8601](https://wikipedia.org/wiki/ISO_8601) timestamp of the last failed investments update for the Item. The status will update each time Plaid fails an attempt to connect with the institution, regardless of whether any new data is available in the update.
22
+ attr_accessor :last_failed_update
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ 'last_successful_update': :last_successful_update,
28
+ 'last_failed_update': :last_failed_update
29
+ }
30
+ end
36
31
 
37
- # Attribute type mapping.
38
- def self.openapi_types
39
- {
40
- 'last_successful_update': :Time,
41
- 'last_failed_update': :Time
42
- }
43
- end
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
44
36
 
45
- # List of attributes with nullable: true
46
- def self.openapi_nullable
47
- Set.new(%i[
48
- last_successful_update
49
- last_failed_update
50
- ])
51
- end
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ 'last_successful_update': :Time,
41
+ 'last_failed_update': :Time
42
+ }
43
+ end
52
44
 
53
- # Initializes the object
54
- # @param [Hash] attributes Model attributes in the form of hash
55
- def initialize(attributes = {})
56
- unless attributes.is_a?(Hash)
57
- raise ArgumentError,
58
- 'The input argument (attributes) must be a hash in `MoneyKit::PlaidCompatible::ItemStatusInvestments` initialize method'
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new(%i[
48
+ last_successful_update
49
+ last_failed_update
50
+ ])
59
51
  end
60
52
 
61
- # check to see if the attribute exists and convert string to symbol for hash key
62
- attributes = attributes.each_with_object({}) do |(k, v), h|
63
- unless self.class.attribute_map.key?(k.to_sym)
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ unless attributes.is_a?(Hash)
64
57
  raise ArgumentError,
65
- "`#{k}` is not a valid attribute in `MoneyKit::PlaidCompatible::ItemStatusInvestments`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ 'The input argument (attributes) must be a hash in `MoneyKit::PlaidCompatible::ItemStatusInvestments` initialize method'
66
59
  end
67
60
 
68
- h[k.to_sym] = v
69
- end
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) do |(k, v), h|
63
+ unless self.class.attribute_map.key?(k.to_sym)
64
+ raise ArgumentError,
65
+ "`#{k}` is not a valid attribute in `MoneyKit::PlaidCompatible::ItemStatusInvestments`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
70
67
 
71
- self.last_successful_update = attributes[:last_successful_update] if attributes.key?(:last_successful_update)
68
+ h[k.to_sym] = v
69
+ end
72
70
 
73
- return unless attributes.key?(:last_failed_update)
71
+ self.last_successful_update = attributes[:last_successful_update] if attributes.key?(:last_successful_update)
74
72
 
75
- self.last_failed_update = attributes[:last_failed_update]
76
- end
73
+ return unless attributes.key?(:last_failed_update)
77
74
 
78
- # Show invalid properties with the reasons. Usually used together with valid?
79
- # @return Array for valid properties with the reasons
80
- def list_invalid_properties
81
- []
82
- end
75
+ self.last_failed_update = attributes[:last_failed_update]
76
+ end
83
77
 
84
- # Check to see if the all the properties in the model are valid
85
- # @return true if the model is valid
86
- def valid?
87
- true
88
- end
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properties with the reasons
80
+ def list_invalid_properties
81
+ []
82
+ end
89
83
 
90
- # Checks equality by comparing each attribute.
91
- # @param [Object] Object to be compared
92
- def ==(other)
93
- return true if equal?(other)
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ true
88
+ end
94
89
 
95
- self.class == other.class &&
96
- last_successful_update == other.last_successful_update &&
97
- last_failed_update == other.last_failed_update
98
- end
90
+ # Checks equality by comparing each attribute.
91
+ # @param [Object] Object to be compared
92
+ def ==(other)
93
+ return true if equal?(other)
99
94
 
100
- # @see the `==` method
101
- # @param [Object] Object to be compared
102
- def eql?(other)
103
- self == other
104
- end
95
+ self.class == other.class &&
96
+ last_successful_update == other.last_successful_update &&
97
+ last_failed_update == other.last_failed_update
98
+ end
105
99
 
106
- # Calculates hash code according to all attributes.
107
- # @return [Integer] Hash code
108
- def hash
109
- [last_successful_update, last_failed_update].hash
110
- end
100
+ # @see the `==` method
101
+ # @param [Object] Object to be compared
102
+ def eql?(other)
103
+ self == other
104
+ end
111
105
 
112
- # Builds the object from hash
113
- # @param [Hash] attributes Model attributes in the form of hash
114
- # @return [Object] Returns the model itself
115
- def self.build_from_hash(attributes)
116
- new.build_from_hash(attributes)
117
- end
106
+ # Calculates hash code according to all attributes.
107
+ # @return [Integer] Hash code
108
+ def hash
109
+ [last_successful_update, last_failed_update].hash
110
+ end
111
+
112
+ # Builds the object from hash
113
+ # @param [Hash] attributes Model attributes in the form of hash
114
+ # @return [Object] Returns the model itself
115
+ def self.build_from_hash(attributes)
116
+ new.build_from_hash(attributes)
117
+ end
118
118
 
119
- # Builds the object from hash
120
- # @param [Hash] attributes Model attributes in the form of hash
121
- # @return [Object] Returns the model itself
122
- def build_from_hash(attributes)
123
- return nil unless attributes.is_a?(Hash)
124
-
125
- self.class.openapi_types.each_pair do |key, type|
126
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
127
- send("#{key}=", nil)
128
- elsif type =~ /\AArray<(.*)>/i
129
- # check to ensure the input is an array given that the attribute
130
- # is documented as an array but the input is not
131
- if attributes[self.class.attribute_map[key]].is_a?(Array)
132
- send("#{key}=", attributes[self.class.attribute_map[key]].map do |v|
133
- _deserialize(::Regexp.last_match(1), v)
134
- end)
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+
125
+ self.class.openapi_types.each_pair do |key, type|
126
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
127
+ send("#{key}=", nil)
128
+ elsif type =~ /\AArray<(.*)>/i
129
+ # check to ensure the input is an array given that the attribute
130
+ # is documented as an array but the input is not
131
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
132
+ send("#{key}=", attributes[self.class.attribute_map[key]].map do |v|
133
+ _deserialize(::Regexp.last_match(1), v)
134
+ end)
135
+ end
136
+ elsif !attributes[self.class.attribute_map[key]].nil?
137
+ send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
135
138
  end
136
- elsif !attributes[self.class.attribute_map[key]].nil?
137
- send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
138
139
  end
139
- end
140
140
 
141
- self
142
- end
141
+ self
142
+ end
143
143
 
144
- # Deserializes the data based on type
145
- # @param string type Data type
146
- # @param string value Value to be deserialized
147
- # @return [Object] Deserialized data
148
- def _deserialize(type, value)
149
- case type.to_sym
150
- when :Time
151
- Time.parse(value)
152
- when :Date
153
- Date.parse(value)
154
- when :String
155
- value.to_s
156
- when :Integer
157
- value.to_i
158
- when :Float
159
- value.to_f
160
- when :Boolean
161
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
- true
163
- else
164
- false
165
- end
166
- when :Object
167
- # generic object (usually a Hash), return directly
168
- value
169
- when /\AArray<(?<inner_type>.+)>\z/
170
- inner_type = Regexp.last_match[:inner_type]
171
- value.map { |v| _deserialize(inner_type, v) }
172
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
173
- k_type = Regexp.last_match[:k_type]
174
- v_type = Regexp.last_match[:v_type]
175
- {}.tap do |hash|
176
- value.each do |k, v|
177
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
144
+ # Deserializes the data based on type
145
+ # @param string type Data type
146
+ # @param string value Value to be deserialized
147
+ # @return [Object] Deserialized data
148
+ def _deserialize(type, value)
149
+ case type.to_sym
150
+ when :Time
151
+ Time.parse(value)
152
+ when :Date
153
+ Date.parse(value)
154
+ when :String
155
+ value.to_s
156
+ when :Integer
157
+ value.to_i
158
+ when :Float
159
+ value.to_f
160
+ when :Boolean
161
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
+ true
163
+ else
164
+ false
178
165
  end
166
+ when :Object
167
+ # generic object (usually a Hash), return directly
168
+ value
169
+ when /\AArray<(?<inner_type>.+)>\z/
170
+ inner_type = Regexp.last_match[:inner_type]
171
+ value.map { |v| _deserialize(inner_type, v) }
172
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
173
+ k_type = Regexp.last_match[:k_type]
174
+ v_type = Regexp.last_match[:v_type]
175
+ {}.tap do |hash|
176
+ value.each do |k, v|
177
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
178
+ end
179
+ end
180
+ else # model
181
+ # models (e.g. Pet) or oneOf
182
+ klass = MoneyKit::PlaidCompatible.const_get(type)
183
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
179
184
  end
180
- else # model
181
- # models (e.g. Pet) or oneOf
182
- klass = MoneyKit::PlaidCompatible.const_get(type)
183
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
184
185
  end
185
- end
186
186
 
187
- # Returns the string representation of the object
188
- # @return [String] String presentation of the object
189
- def to_s
190
- to_hash.to_s
191
- end
187
+ # Returns the string representation of the object
188
+ # @return [String] String presentation of the object
189
+ def to_s
190
+ to_hash.to_s
191
+ end
192
192
 
193
- # to_body is an alias to to_hash (backward compatibility)
194
- # @return [Hash] Returns the object in the form of hash
195
- def to_body
196
- to_hash
197
- end
193
+ # to_body is an alias to to_hash (backward compatibility)
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_body
196
+ to_hash
197
+ end
198
198
 
199
- # Returns the object in the form of hash
200
- # @return [Hash] Returns the object in the form of hash
201
- def to_hash
202
- hash = {}
203
- self.class.attribute_map.each_pair do |attr, param|
204
- value = send(attr)
205
- if value.nil?
206
- is_nullable = self.class.openapi_nullable.include?(attr)
207
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
208
- end
199
+ # Returns the object in the form of hash
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_hash
202
+ hash = {}
203
+ self.class.attribute_map.each_pair do |attr, param|
204
+ value = send(attr)
205
+ if value.nil?
206
+ is_nullable = self.class.openapi_nullable.include?(attr)
207
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
208
+ end
209
209
 
210
- hash[param] = _to_hash(value)
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
211
213
  end
212
- hash
213
- end
214
214
 
215
- # Outputs non-array value in the form of hash
216
- # For object, use to_hash. Otherwise, just return the value
217
- # @param [Object] value Any valid value
218
- # @return [Hash] Returns the value in the form of hash
219
- def _to_hash(value)
220
- if value.is_a?(Array)
221
- value.compact.map { |v| _to_hash(v) }
222
- elsif value.is_a?(Hash)
223
- {}.tap do |hash|
224
- value.each { |k, v| hash[k] = _to_hash(v) }
215
+ # Outputs non-array value in the form of hash
216
+ # For object, use to_hash. Otherwise, just return the value
217
+ # @param [Object] value Any valid value
218
+ # @return [Hash] Returns the value in the form of hash
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map { |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
225
230
  end
226
- elsif value.respond_to? :to_hash
227
- value.to_hash
228
- else
229
- value
230
231
  end
231
232
  end
232
233
  end
233
- end
234
234
  end