atrium-ruby 1.3.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +5 -2
  3. data/README.md +132 -66
  4. data/Rakefile +7 -4
  5. data/atrium-ruby.gemspec +40 -32
  6. data/docs/Account.md +35 -0
  7. data/docs/AccountNumber.md +12 -0
  8. data/docs/AccountNumbersResponseBody.md +8 -0
  9. data/docs/AccountOwner.md +18 -0
  10. data/docs/AccountOwnersResponseBody.md +8 -0
  11. data/docs/AccountResponseBody.md +8 -0
  12. data/docs/AccountsApi.md +174 -0
  13. data/docs/AccountsResponseBody.md +9 -0
  14. data/docs/Challenge.md +13 -0
  15. data/docs/ChallengeOption.md +10 -0
  16. data/docs/ChallengesResponseBody.md +8 -0
  17. data/docs/ConnectWidget.md +9 -0
  18. data/docs/ConnectWidgetApi.md +44 -0
  19. data/docs/ConnectWidgetRequestBody.md +11 -0
  20. data/docs/ConnectWidgetResponseBody.md +8 -0
  21. data/docs/CredentialOption.md +9 -0
  22. data/docs/CredentialRequest.md +9 -0
  23. data/docs/CredentialResponse.md +12 -0
  24. data/docs/CredentialsResponseBody.md +8 -0
  25. data/docs/IdentityApi.md +82 -0
  26. data/docs/Institution.md +14 -0
  27. data/docs/InstitutionResponseBody.md +8 -0
  28. data/docs/InstitutionsApi.md +120 -0
  29. data/docs/InstitutionsResponseBody.md +9 -0
  30. data/docs/Member.md +18 -0
  31. data/docs/MemberConnectionStatus.md +16 -0
  32. data/docs/MemberConnectionStatusResponseBody.md +8 -0
  33. data/docs/MemberCreateRequest.md +11 -0
  34. data/docs/MemberCreateRequestBody.md +8 -0
  35. data/docs/MemberResponseBody.md +8 -0
  36. data/docs/MemberResumeRequest.md +8 -0
  37. data/docs/MemberResumeRequestBody.md +8 -0
  38. data/docs/MemberUpdateRequest.md +10 -0
  39. data/docs/MemberUpdateRequestBody.md +8 -0
  40. data/docs/MembersApi.md +487 -0
  41. data/docs/MembersResponseBody.md +9 -0
  42. data/docs/Pagination.md +11 -0
  43. data/docs/Transaction.md +38 -0
  44. data/docs/TransactionCleanseAndCategorizeRequest.md +11 -0
  45. data/docs/TransactionCleanseAndCategorizeResponse.md +20 -0
  46. data/docs/TransactionResponseBody.md +8 -0
  47. data/docs/TransactionsApi.md +126 -0
  48. data/docs/TransactionsCleanseAndCategorizeRequestBody.md +8 -0
  49. data/docs/TransactionsCleanseAndCategorizeResponseBody.md +8 -0
  50. data/docs/TransactionsResponseBody.md +9 -0
  51. data/docs/User.md +11 -0
  52. data/docs/UserCreateRequestBody.md +8 -0
  53. data/docs/UserResponseBody.md +8 -0
  54. data/docs/UserUpdateRequestBody.md +8 -0
  55. data/docs/UsersApi.md +193 -0
  56. data/docs/UsersResponseBody.md +9 -0
  57. data/docs/VerificationApi.md +120 -0
  58. data/git_push.sh +49 -0
  59. data/lib/atrium-ruby.rb +88 -0
  60. data/lib/atrium-ruby/api/accounts_api.rb +272 -0
  61. data/lib/atrium-ruby/api/atrium_client.rb +28 -0
  62. data/lib/atrium-ruby/api/connect_widget_api.rb +82 -0
  63. data/lib/atrium-ruby/api/identity_api.rb +140 -0
  64. data/lib/atrium-ruby/api/institutions_api.rb +181 -0
  65. data/lib/atrium-ruby/api/members_api.rb +749 -0
  66. data/lib/atrium-ruby/api/transactions_api.rb +198 -0
  67. data/lib/atrium-ruby/api/users_api.rb +287 -0
  68. data/lib/atrium-ruby/api/verification_api.rb +198 -0
  69. data/lib/atrium-ruby/api_client.rb +384 -0
  70. data/lib/atrium-ruby/api_error.rb +34 -0
  71. data/lib/atrium-ruby/configuration.rb +212 -0
  72. data/lib/atrium-ruby/models/account.rb +422 -0
  73. data/lib/atrium-ruby/models/account_number.rb +215 -0
  74. data/lib/atrium-ruby/models/account_numbers_response_body.rb +181 -0
  75. data/lib/atrium-ruby/models/account_owner.rb +269 -0
  76. data/lib/atrium-ruby/models/account_owners_response_body.rb +181 -0
  77. data/lib/atrium-ruby/models/account_response_body.rb +179 -0
  78. data/lib/atrium-ruby/models/accounts_response_body.rb +190 -0
  79. data/lib/atrium-ruby/models/challenge.rb +226 -0
  80. data/lib/atrium-ruby/models/challenge_option.rb +197 -0
  81. data/lib/atrium-ruby/models/challenges_response_body.rb +181 -0
  82. data/lib/atrium-ruby/models/connect_widget.rb +188 -0
  83. data/lib/atrium-ruby/models/connect_widget_request_body.rb +206 -0
  84. data/lib/atrium-ruby/models/connect_widget_response_body.rb +179 -0
  85. data/lib/atrium-ruby/models/credential_option.rb +188 -0
  86. data/lib/atrium-ruby/models/credential_request.rb +188 -0
  87. data/lib/atrium-ruby/models/credential_response.rb +217 -0
  88. data/lib/atrium-ruby/models/credentials_response_body.rb +181 -0
  89. data/lib/atrium-ruby/models/institution.rb +233 -0
  90. data/lib/atrium-ruby/models/institution_response_body.rb +179 -0
  91. data/lib/atrium-ruby/models/institutions_response_body.rb +190 -0
  92. data/lib/atrium-ruby/models/member.rb +269 -0
  93. data/lib/atrium-ruby/models/member_connection_status.rb +253 -0
  94. data/lib/atrium-ruby/models/member_connection_status_response_body.rb +179 -0
  95. data/lib/atrium-ruby/models/member_create_request.rb +218 -0
  96. data/lib/atrium-ruby/models/member_create_request_body.rb +179 -0
  97. data/lib/atrium-ruby/models/member_response_body.rb +179 -0
  98. data/lib/atrium-ruby/models/member_resume_request.rb +181 -0
  99. data/lib/atrium-ruby/models/member_resume_request_body.rb +179 -0
  100. data/lib/atrium-ruby/models/member_update_request.rb +199 -0
  101. data/lib/atrium-ruby/models/member_update_request_body.rb +179 -0
  102. data/lib/atrium-ruby/models/members_response_body.rb +190 -0
  103. data/lib/atrium-ruby/models/pagination.rb +206 -0
  104. data/lib/atrium-ruby/models/transaction.rb +449 -0
  105. data/lib/atrium-ruby/models/transaction_cleanse_and_categorize_request.rb +206 -0
  106. data/lib/atrium-ruby/models/transaction_cleanse_and_categorize_response.rb +287 -0
  107. data/lib/atrium-ruby/models/transaction_response_body.rb +179 -0
  108. data/lib/atrium-ruby/models/transactions_cleanse_and_categorize_request_body.rb +181 -0
  109. data/lib/atrium-ruby/models/transactions_cleanse_and_categorize_response_body.rb +181 -0
  110. data/lib/atrium-ruby/models/transactions_response_body.rb +190 -0
  111. data/lib/atrium-ruby/models/user.rb +206 -0
  112. data/lib/atrium-ruby/models/user_create_request_body.rb +179 -0
  113. data/lib/atrium-ruby/models/user_response_body.rb +179 -0
  114. data/lib/atrium-ruby/models/user_update_request_body.rb +179 -0
  115. data/lib/atrium-ruby/models/users_response_body.rb +190 -0
  116. data/lib/atrium-ruby/version.rb +11 -0
  117. data/spec/api/accounts_api_spec.rb +88 -0
  118. data/spec/api/connect_widget_api_spec.rb +43 -0
  119. data/spec/api/identity_api_spec.rb +56 -0
  120. data/spec/api/institutions_api_spec.rb +68 -0
  121. data/spec/api/members_api_spec.rb +195 -0
  122. data/spec/api/transactions_api_spec.rb +71 -0
  123. data/spec/api/users_api_spec.rb +92 -0
  124. data/spec/api/verification_api_spec.rb +69 -0
  125. data/spec/api_client_spec.rb +222 -0
  126. data/spec/configuration_spec.rb +38 -0
  127. data/spec/models/account_number_spec.rb +60 -0
  128. data/spec/models/account_numbers_response_body_spec.rb +36 -0
  129. data/spec/models/account_owner_spec.rb +96 -0
  130. data/spec/models/account_owners_response_body_spec.rb +36 -0
  131. data/spec/models/account_response_body_spec.rb +36 -0
  132. data/spec/models/account_spec.rb +198 -0
  133. data/spec/models/accounts_response_body_spec.rb +42 -0
  134. data/spec/models/challenge_option_spec.rb +48 -0
  135. data/spec/models/challenge_spec.rb +66 -0
  136. data/spec/models/challenges_response_body_spec.rb +36 -0
  137. data/spec/models/connect_widget_request_body_spec.rb +54 -0
  138. data/spec/models/connect_widget_response_body_spec.rb +36 -0
  139. data/spec/models/connect_widget_spec.rb +42 -0
  140. data/spec/models/credential_option_spec.rb +42 -0
  141. data/spec/models/credential_request_spec.rb +42 -0
  142. data/spec/models/credential_response_spec.rb +60 -0
  143. data/spec/models/credentials_response_body_spec.rb +36 -0
  144. data/spec/models/institution_response_body_spec.rb +36 -0
  145. data/spec/models/institution_spec.rb +72 -0
  146. data/spec/models/institutions_response_body_spec.rb +42 -0
  147. data/spec/models/member_connection_status_response_body_spec.rb +36 -0
  148. data/spec/models/member_connection_status_spec.rb +84 -0
  149. data/spec/models/member_create_request_body_spec.rb +36 -0
  150. data/spec/models/member_create_request_spec.rb +54 -0
  151. data/spec/models/member_response_body_spec.rb +36 -0
  152. data/spec/models/member_resume_request_body_spec.rb +36 -0
  153. data/spec/models/member_resume_request_spec.rb +36 -0
  154. data/spec/models/member_spec.rb +96 -0
  155. data/spec/models/member_update_request_body_spec.rb +36 -0
  156. data/spec/models/member_update_request_spec.rb +48 -0
  157. data/spec/models/members_response_body_spec.rb +42 -0
  158. data/spec/models/pagination_spec.rb +54 -0
  159. data/spec/models/transaction_cleanse_and_categorize_request_spec.rb +54 -0
  160. data/spec/models/transaction_cleanse_and_categorize_response_spec.rb +108 -0
  161. data/spec/models/transaction_response_body_spec.rb +36 -0
  162. data/spec/models/transaction_spec.rb +216 -0
  163. data/spec/models/transactions_cleanse_and_categorize_request_body_spec.rb +36 -0
  164. data/spec/models/transactions_cleanse_and_categorize_response_body_spec.rb +36 -0
  165. data/spec/models/transactions_response_body_spec.rb +42 -0
  166. data/spec/models/user_create_request_body_spec.rb +36 -0
  167. data/spec/models/user_response_body_spec.rb +36 -0
  168. data/spec/models/user_spec.rb +54 -0
  169. data/spec/models/user_update_request_body_spec.rb +36 -0
  170. data/spec/models/users_response_body_spec.rb +42 -0
  171. data/spec/spec_helper.rb +107 -0
  172. metadata +323 -91
  173. data/.gitignore +0 -10
  174. data/.rubocop.yml +0 -12
  175. data/.travis.yml +0 -12
  176. data/bin/console +0 -14
  177. data/bin/demo +0 -49
  178. data/bin/setup +0 -8
  179. data/examples/accounts_and_transactions.rb +0 -49
  180. data/examples/all_endpoints.rb +0 -226
  181. data/examples/example_workflow.rb +0 -176
  182. data/examples/multi_factor_authentication.rb +0 -57
  183. data/examples/update_credentials.rb +0 -58
  184. data/examples/user_and_member_creation.rb +0 -53
  185. data/lib/atrium.rb +0 -40
  186. data/lib/atrium/account.rb +0 -100
  187. data/lib/atrium/account_number.rb +0 -13
  188. data/lib/atrium/account_owner.rb +0 -19
  189. data/lib/atrium/challenge.rb +0 -13
  190. data/lib/atrium/client.rb +0 -51
  191. data/lib/atrium/connect.rb +0 -34
  192. data/lib/atrium/credential.rb +0 -11
  193. data/lib/atrium/error.rb +0 -4
  194. data/lib/atrium/institution.rb +0 -38
  195. data/lib/atrium/member.rb +0 -264
  196. data/lib/atrium/pageable.rb +0 -74
  197. data/lib/atrium/paginate.rb +0 -92
  198. data/lib/atrium/ruby.rb +0 -3
  199. data/lib/atrium/transaction.rb +0 -74
  200. data/lib/atrium/user.rb +0 -150
  201. data/lib/atrium/version.rb +0 -3
@@ -0,0 +1,34 @@
1
+ =begin
2
+ #MX API
3
+
4
+ #The MX Atrium API supports over 48,000 data connections to thousands of financial institutions. It provides secure access to your users' accounts and transactions with industry-leading cleansing, categorization, and classification. Atrium is designed according to resource-oriented REST architecture and responds with JSON bodies and HTTP response codes. Use Atrium's development environment, vestibule.mx.com, to quickly get up and running. The development environment limits are 100 users, 25 members per user, and access to the top 15 institutions. Contact MX to purchase production access.
5
+
6
+
7
+ =end
8
+
9
+ module Atrium
10
+ class ApiError < StandardError
11
+ attr_reader :code, :response_headers, :response_body
12
+
13
+ # Usage examples:
14
+ # ApiError.new
15
+ # ApiError.new("message")
16
+ # ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
17
+ # ApiError.new(:code => 404, :message => "Not Found")
18
+ def initialize(arg = nil)
19
+ if arg.is_a? Hash
20
+ if arg.key?(:message) || arg.key?('message')
21
+ super(arg[:message] || arg['message'])
22
+ else
23
+ super arg
24
+ end
25
+
26
+ arg.each do |k, v|
27
+ instance_variable_set "@#{k}", v
28
+ end
29
+ else
30
+ super arg
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,212 @@
1
+ =begin
2
+ #MX API
3
+
4
+ #The MX Atrium API supports over 48,000 data connections to thousands of financial institutions. It provides secure access to your users' accounts and transactions with industry-leading cleansing, categorization, and classification. Atrium is designed according to resource-oriented REST architecture and responds with JSON bodies and HTTP response codes. Use Atrium's development environment, vestibule.mx.com, to quickly get up and running. The development environment limits are 100 users, 25 members per user, and access to the top 15 institutions. Contact MX to purchase production access.
5
+
6
+
7
+ =end
8
+
9
+ require 'uri'
10
+
11
+ module Atrium
12
+ class Configuration
13
+ # Defines url scheme
14
+ attr_accessor :scheme
15
+
16
+ # Defines url host
17
+ attr_accessor :host
18
+
19
+ # Defines url base path
20
+ attr_accessor :base_path
21
+
22
+ # Defines API keys used with API Key authentications.
23
+ #
24
+ # @return [Hash] key: parameter name, value: parameter value (API key)
25
+ #
26
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
27
+ # config.api_key['api_key'] = 'xxx'
28
+ attr_accessor :api_key
29
+
30
+ # Defines API key prefixes used with API Key authentications.
31
+ #
32
+ # @return [Hash] key: parameter name, value: API key prefix
33
+ #
34
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
35
+ # config.api_key_prefix['api_key'] = 'Token'
36
+ attr_accessor :api_key_prefix
37
+
38
+ # Defines the username used with HTTP basic authentication.
39
+ #
40
+ # @return [String]
41
+ attr_accessor :username
42
+
43
+ # Defines the password used with HTTP basic authentication.
44
+ #
45
+ # @return [String]
46
+ attr_accessor :password
47
+
48
+ # Defines the access token (Bearer) used with OAuth2.
49
+ attr_accessor :access_token
50
+
51
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
52
+ # details will be logged with `logger.debug` (see the `logger` attribute).
53
+ # Default to false.
54
+ #
55
+ # @return [true, false]
56
+ attr_accessor :debugging
57
+
58
+ # Defines the logger used for debugging.
59
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
60
+ #
61
+ # @return [#debug]
62
+ attr_accessor :logger
63
+
64
+ # Defines the temporary folder to store downloaded files
65
+ # (for API endpoints that have file response).
66
+ # Default to use `Tempfile`.
67
+ #
68
+ # @return [String]
69
+ attr_accessor :temp_folder_path
70
+
71
+ # The time limit for HTTP request in seconds.
72
+ # Default to 0 (never times out).
73
+ attr_accessor :timeout
74
+
75
+ # Set this to false to skip client side validation in the operation.
76
+ # Default to true.
77
+ # @return [true, false]
78
+ attr_accessor :client_side_validation
79
+
80
+ ### TLS/SSL setting
81
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
82
+ # Default to true.
83
+ #
84
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
85
+ #
86
+ # @return [true, false]
87
+ attr_accessor :verify_ssl
88
+
89
+ ### TLS/SSL setting
90
+ # Set this to false to skip verifying SSL host name
91
+ # Default to true.
92
+ #
93
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
94
+ #
95
+ # @return [true, false]
96
+ attr_accessor :verify_ssl_host
97
+
98
+ ### TLS/SSL setting
99
+ # Set this to customize the certificate file to verify the peer.
100
+ #
101
+ # @return [String] the path to the certificate file
102
+ #
103
+ # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
104
+ # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
105
+ attr_accessor :ssl_ca_cert
106
+
107
+ ### TLS/SSL setting
108
+ # Client certificate file (for client certificate)
109
+ attr_accessor :cert_file
110
+
111
+ ### TLS/SSL setting
112
+ # Client private key file (for client certificate)
113
+ attr_accessor :key_file
114
+
115
+ # Set this to customize parameters encoding of array parameter with multi collectionFormat.
116
+ # Default to nil.
117
+ #
118
+ # @see The params_encoding option of Ethon. Related source code:
119
+ # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
120
+ attr_accessor :params_encoding
121
+
122
+ attr_accessor :inject_format
123
+
124
+ attr_accessor :force_ending_format
125
+
126
+ def initialize
127
+ @scheme = 'https'
128
+ @host = 'vestibule.mx.com'
129
+ @base_path = ''
130
+ @api_key = {}
131
+ @api_key_prefix = {}
132
+ @timeout = 0
133
+ @client_side_validation = true
134
+ @verify_ssl = true
135
+ @verify_ssl_host = true
136
+ @params_encoding = nil
137
+ @cert_file = nil
138
+ @key_file = nil
139
+ @debugging = false
140
+ @inject_format = false
141
+ @force_ending_format = false
142
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
143
+
144
+ yield(self) if block_given?
145
+ end
146
+
147
+ # The default Configuration object.
148
+ def self.default
149
+ @@default ||= Configuration.new
150
+ end
151
+
152
+ def configure
153
+ yield(self) if block_given?
154
+ end
155
+
156
+ def scheme=(scheme)
157
+ # remove :// from scheme
158
+ @scheme = scheme.sub(/:\/\//, '')
159
+ end
160
+
161
+ def host=(host)
162
+ # remove http(s):// and anything after a slash
163
+ @host = host.sub(/https?:\/\//, '').split('/').first
164
+ end
165
+
166
+ def base_path=(base_path)
167
+ # Add leading and trailing slashes to base_path
168
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
169
+ @base_path = '' if @base_path == '/'
170
+ end
171
+
172
+ def base_url
173
+ url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
174
+ URI.encode(url)
175
+ end
176
+
177
+ # Gets API key (with prefix if set).
178
+ # @param [String] param_name the parameter name of API key auth
179
+ def api_key_with_prefix(param_name)
180
+ if @api_key_prefix[param_name]
181
+ "#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
182
+ else
183
+ @api_key[param_name]
184
+ end
185
+ end
186
+
187
+ # Gets Basic Auth token string
188
+ def basic_auth_token
189
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
190
+ end
191
+
192
+ # Returns Auth Settings hash for api client.
193
+ def auth_settings
194
+ {
195
+ 'apiKey' =>
196
+ {
197
+ type: 'api_key',
198
+ in: 'header',
199
+ key: 'MX-API-Key',
200
+ value: api_key_with_prefix('MX-API-Key')
201
+ },
202
+ 'clientID' =>
203
+ {
204
+ type: 'api_key',
205
+ in: 'header',
206
+ key: 'MX-Client-ID',
207
+ value: api_key_with_prefix('MX-Client-ID')
208
+ },
209
+ }
210
+ end
211
+ end
212
+ end
@@ -0,0 +1,422 @@
1
+ =begin
2
+ #MX API
3
+
4
+ #The MX Atrium API supports over 48,000 data connections to thousands of financial institutions. It provides secure access to your users' accounts and transactions with industry-leading cleansing, categorization, and classification. Atrium is designed according to resource-oriented REST architecture and responds with JSON bodies and HTTP response codes. Use Atrium's development environment, vestibule.mx.com, to quickly get up and running. The development environment limits are 100 users, 25 members per user, and access to the top 15 institutions. Contact MX to purchase production access.
5
+
6
+
7
+ =end
8
+
9
+ require 'date'
10
+
11
+ module Atrium
12
+ class Account
13
+ attr_accessor :apr
14
+
15
+ attr_accessor :apy
16
+
17
+ attr_accessor :available_balance
18
+
19
+ attr_accessor :available_credit
20
+
21
+ attr_accessor :balance
22
+
23
+ attr_accessor :created_at
24
+
25
+ attr_accessor :credit_limit
26
+
27
+ attr_accessor :currency_code
28
+
29
+ attr_accessor :day_payment_is_due
30
+
31
+ attr_accessor :guid
32
+
33
+ attr_accessor :institution_code
34
+
35
+ attr_accessor :interest_rate
36
+
37
+ attr_accessor :is_closed
38
+
39
+ attr_accessor :last_payment
40
+
41
+ attr_accessor :matures_on
42
+
43
+ attr_accessor :member_guid
44
+
45
+ attr_accessor :minimum_balance
46
+
47
+ attr_accessor :minimum_payment
48
+
49
+ attr_accessor :name
50
+
51
+ attr_accessor :original_balance
52
+
53
+ attr_accessor :payment_due_at
54
+
55
+ attr_accessor :payoff_balance
56
+
57
+ attr_accessor :started_on
58
+
59
+ attr_accessor :subtype
60
+
61
+ attr_accessor :total_account_value
62
+
63
+ attr_accessor :type
64
+
65
+ attr_accessor :updated_at
66
+
67
+ attr_accessor :user_guid
68
+
69
+ # Attribute mapping from ruby-style variable name to JSON key.
70
+ def self.attribute_map
71
+ {
72
+ :'apr' => :'apr',
73
+ :'apy' => :'apy',
74
+ :'available_balance' => :'available_balance',
75
+ :'available_credit' => :'available_credit',
76
+ :'balance' => :'balance',
77
+ :'created_at' => :'created_at',
78
+ :'credit_limit' => :'credit_limit',
79
+ :'currency_code' => :'currency_code',
80
+ :'day_payment_is_due' => :'day_payment_is_due',
81
+ :'guid' => :'guid',
82
+ :'institution_code' => :'institution_code',
83
+ :'interest_rate' => :'interest_rate',
84
+ :'is_closed' => :'is_closed',
85
+ :'last_payment' => :'last_payment',
86
+ :'matures_on' => :'matures_on',
87
+ :'member_guid' => :'member_guid',
88
+ :'minimum_balance' => :'minimum_balance',
89
+ :'minimum_payment' => :'minimum_payment',
90
+ :'name' => :'name',
91
+ :'original_balance' => :'original_balance',
92
+ :'payment_due_at' => :'payment_due_at',
93
+ :'payoff_balance' => :'payoff_balance',
94
+ :'started_on' => :'started_on',
95
+ :'subtype' => :'subtype',
96
+ :'total_account_value' => :'total_account_value',
97
+ :'type' => :'type',
98
+ :'updated_at' => :'updated_at',
99
+ :'user_guid' => :'user_guid'
100
+ }
101
+ end
102
+
103
+ # Attribute type mapping.
104
+ def self.mx_types
105
+ {
106
+ :'apr' => :'Float',
107
+ :'apy' => :'Float',
108
+ :'available_balance' => :'Float',
109
+ :'available_credit' => :'Float',
110
+ :'balance' => :'Float',
111
+ :'created_at' => :'String',
112
+ :'credit_limit' => :'Float',
113
+ :'currency_code' => :'String',
114
+ :'day_payment_is_due' => :'Integer',
115
+ :'guid' => :'String',
116
+ :'institution_code' => :'String',
117
+ :'interest_rate' => :'Float',
118
+ :'is_closed' => :'BOOLEAN',
119
+ :'last_payment' => :'Float',
120
+ :'matures_on' => :'String',
121
+ :'member_guid' => :'String',
122
+ :'minimum_balance' => :'Float',
123
+ :'minimum_payment' => :'Float',
124
+ :'name' => :'String',
125
+ :'original_balance' => :'Float',
126
+ :'payment_due_at' => :'String',
127
+ :'payoff_balance' => :'Float',
128
+ :'started_on' => :'String',
129
+ :'subtype' => :'String',
130
+ :'total_account_value' => :'Float',
131
+ :'type' => :'String',
132
+ :'updated_at' => :'String',
133
+ :'user_guid' => :'String'
134
+ }
135
+ end
136
+
137
+ # Initializes the object
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ def initialize(attributes = {})
140
+ return unless attributes.is_a?(Hash)
141
+
142
+ # convert string to symbol for hash key
143
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
144
+
145
+ if attributes.has_key?(:'apr')
146
+ self.apr = attributes[:'apr']
147
+ end
148
+
149
+ if attributes.has_key?(:'apy')
150
+ self.apy = attributes[:'apy']
151
+ end
152
+
153
+ if attributes.has_key?(:'available_balance')
154
+ self.available_balance = attributes[:'available_balance']
155
+ end
156
+
157
+ if attributes.has_key?(:'available_credit')
158
+ self.available_credit = attributes[:'available_credit']
159
+ end
160
+
161
+ if attributes.has_key?(:'balance')
162
+ self.balance = attributes[:'balance']
163
+ end
164
+
165
+ if attributes.has_key?(:'created_at')
166
+ self.created_at = attributes[:'created_at']
167
+ end
168
+
169
+ if attributes.has_key?(:'credit_limit')
170
+ self.credit_limit = attributes[:'credit_limit']
171
+ end
172
+
173
+ if attributes.has_key?(:'currency_code')
174
+ self.currency_code = attributes[:'currency_code']
175
+ end
176
+
177
+ if attributes.has_key?(:'day_payment_is_due')
178
+ self.day_payment_is_due = attributes[:'day_payment_is_due']
179
+ end
180
+
181
+ if attributes.has_key?(:'guid')
182
+ self.guid = attributes[:'guid']
183
+ end
184
+
185
+ if attributes.has_key?(:'institution_code')
186
+ self.institution_code = attributes[:'institution_code']
187
+ end
188
+
189
+ if attributes.has_key?(:'interest_rate')
190
+ self.interest_rate = attributes[:'interest_rate']
191
+ end
192
+
193
+ if attributes.has_key?(:'is_closed')
194
+ self.is_closed = attributes[:'is_closed']
195
+ end
196
+
197
+ if attributes.has_key?(:'last_payment')
198
+ self.last_payment = attributes[:'last_payment']
199
+ end
200
+
201
+ if attributes.has_key?(:'matures_on')
202
+ self.matures_on = attributes[:'matures_on']
203
+ end
204
+
205
+ if attributes.has_key?(:'member_guid')
206
+ self.member_guid = attributes[:'member_guid']
207
+ end
208
+
209
+ if attributes.has_key?(:'minimum_balance')
210
+ self.minimum_balance = attributes[:'minimum_balance']
211
+ end
212
+
213
+ if attributes.has_key?(:'minimum_payment')
214
+ self.minimum_payment = attributes[:'minimum_payment']
215
+ end
216
+
217
+ if attributes.has_key?(:'name')
218
+ self.name = attributes[:'name']
219
+ end
220
+
221
+ if attributes.has_key?(:'original_balance')
222
+ self.original_balance = attributes[:'original_balance']
223
+ end
224
+
225
+ if attributes.has_key?(:'payment_due_at')
226
+ self.payment_due_at = attributes[:'payment_due_at']
227
+ end
228
+
229
+ if attributes.has_key?(:'payoff_balance')
230
+ self.payoff_balance = attributes[:'payoff_balance']
231
+ end
232
+
233
+ if attributes.has_key?(:'started_on')
234
+ self.started_on = attributes[:'started_on']
235
+ end
236
+
237
+ if attributes.has_key?(:'subtype')
238
+ self.subtype = attributes[:'subtype']
239
+ end
240
+
241
+ if attributes.has_key?(:'total_account_value')
242
+ self.total_account_value = attributes[:'total_account_value']
243
+ end
244
+
245
+ if attributes.has_key?(:'type')
246
+ self.type = attributes[:'type']
247
+ end
248
+
249
+ if attributes.has_key?(:'updated_at')
250
+ self.updated_at = attributes[:'updated_at']
251
+ end
252
+
253
+ if attributes.has_key?(:'user_guid')
254
+ self.user_guid = attributes[:'user_guid']
255
+ end
256
+ end
257
+
258
+ # Show invalid properties with the reasons. Usually used together with valid?
259
+ # @return Array for valid properties with the reasons
260
+ def list_invalid_properties
261
+ invalid_properties = Array.new
262
+ invalid_properties
263
+ end
264
+
265
+ # Check to see if the all the properties in the model are valid
266
+ # @return true if the model is valid
267
+ def valid?
268
+ true
269
+ end
270
+
271
+ # Checks equality by comparing each attribute.
272
+ # @param [Object] Object to be compared
273
+ def ==(o)
274
+ return true if self.equal?(o)
275
+ self.class == o.class &&
276
+ apr == o.apr &&
277
+ apy == o.apy &&
278
+ available_balance == o.available_balance &&
279
+ available_credit == o.available_credit &&
280
+ balance == o.balance &&
281
+ created_at == o.created_at &&
282
+ credit_limit == o.credit_limit &&
283
+ currency_code == o.currency_code &&
284
+ day_payment_is_due == o.day_payment_is_due &&
285
+ guid == o.guid &&
286
+ institution_code == o.institution_code &&
287
+ interest_rate == o.interest_rate &&
288
+ is_closed == o.is_closed &&
289
+ last_payment == o.last_payment &&
290
+ matures_on == o.matures_on &&
291
+ member_guid == o.member_guid &&
292
+ minimum_balance == o.minimum_balance &&
293
+ minimum_payment == o.minimum_payment &&
294
+ name == o.name &&
295
+ original_balance == o.original_balance &&
296
+ payment_due_at == o.payment_due_at &&
297
+ payoff_balance == o.payoff_balance &&
298
+ started_on == o.started_on &&
299
+ subtype == o.subtype &&
300
+ total_account_value == o.total_account_value &&
301
+ type == o.type &&
302
+ updated_at == o.updated_at &&
303
+ user_guid == o.user_guid
304
+ end
305
+
306
+ # @see the `==` method
307
+ # @param [Object] Object to be compared
308
+ def eql?(o)
309
+ self == o
310
+ end
311
+
312
+ # Calculates hash code according to all attributes.
313
+ # @return [Fixnum] Hash code
314
+ def hash
315
+ [apr, apy, available_balance, available_credit, balance, created_at, credit_limit, currency_code, day_payment_is_due, guid, institution_code, interest_rate, is_closed, last_payment, matures_on, member_guid, minimum_balance, minimum_payment, name, original_balance, payment_due_at, payoff_balance, started_on, subtype, total_account_value, type, updated_at, user_guid].hash
316
+ end
317
+
318
+ # Builds the object from hash
319
+ # @param [Hash] attributes Model attributes in the form of hash
320
+ # @return [Object] Returns the model itself
321
+ def build_from_hash(attributes)
322
+ return nil unless attributes.is_a?(Hash)
323
+ self.class.mx_types.each_pair do |key, type|
324
+ if type =~ /\AArray<(.*)>/i
325
+ # check to ensure the input is an array given that the the attribute
326
+ # is documented as an array but the input is not
327
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
328
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
329
+ end
330
+ elsif !attributes[self.class.attribute_map[key]].nil?
331
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
332
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
333
+ end
334
+
335
+ self
336
+ end
337
+
338
+ # Deserializes the data based on type
339
+ # @param string type Data type
340
+ # @param string value Value to be deserialized
341
+ # @return [Object] Deserialized data
342
+ def _deserialize(type, value)
343
+ case type.to_sym
344
+ when :DateTime
345
+ DateTime.parse(value)
346
+ when :Date
347
+ Date.parse(value)
348
+ when :String
349
+ value.to_s
350
+ when :Integer
351
+ value.to_i
352
+ when :Float
353
+ value.to_f
354
+ when :BOOLEAN
355
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
356
+ true
357
+ else
358
+ false
359
+ end
360
+ when :Object
361
+ # generic object (usually a Hash), return directly
362
+ value
363
+ when /\AArray<(?<inner_type>.+)>\z/
364
+ inner_type = Regexp.last_match[:inner_type]
365
+ value.map { |v| _deserialize(inner_type, v) }
366
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
367
+ k_type = Regexp.last_match[:k_type]
368
+ v_type = Regexp.last_match[:v_type]
369
+ {}.tap do |hash|
370
+ value.each do |k, v|
371
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
372
+ end
373
+ end
374
+ else # model
375
+ temp_model = Atrium.const_get(type).new
376
+ temp_model.build_from_hash(value)
377
+ end
378
+ end
379
+
380
+ # Returns the string representation of the object
381
+ # @return [String] String presentation of the object
382
+ def to_s
383
+ to_hash.to_s
384
+ end
385
+
386
+ # to_body is an alias to to_hash (backward compatibility)
387
+ # @return [Hash] Returns the object in the form of hash
388
+ def to_body
389
+ to_hash
390
+ end
391
+
392
+ # Returns the object in the form of hash
393
+ # @return [Hash] Returns the object in the form of hash
394
+ def to_hash
395
+ hash = {}
396
+ self.class.attribute_map.each_pair do |attr, param|
397
+ value = self.send(attr)
398
+ next if value.nil?
399
+ hash[param] = _to_hash(value)
400
+ end
401
+ hash
402
+ end
403
+
404
+ # Outputs non-array value in the form of hash
405
+ # For object, use to_hash. Otherwise, just return the value
406
+ # @param [Object] value Any valid value
407
+ # @return [Hash] Returns the value in the form of hash
408
+ def _to_hash(value)
409
+ if value.is_a?(Array)
410
+ value.compact.map { |v| _to_hash(v) }
411
+ elsif value.is_a?(Hash)
412
+ {}.tap do |hash|
413
+ value.each { |k, v| hash[k] = _to_hash(v) }
414
+ end
415
+ elsif value.respond_to? :to_hash
416
+ value.to_hash
417
+ else
418
+ value
419
+ end
420
+ end
421
+ end
422
+ end