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
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- /.bundle
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc
5
- /coverage
6
- /doc
7
- /pkg
8
- /spec/reports
9
- /tmp
10
- *.gem
@@ -1,12 +0,0 @@
1
- # inherit_from: .rubocop_todo.yml
2
- inherit_gem:
3
- mad_rubocop: .rubocop.yml
4
- AllCops:
5
- TargetRubyVersion: 2.3
6
- Include:
7
- - 'Gemfile'
8
- - 'Rakefile'
9
- Style/FileName:
10
- Enabled: false
11
- Style/FrozenStringLiteralComment:
12
- Enabled: false
@@ -1,12 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.4
4
- - 2.3
5
- sudo: false
6
- cache: bundler
7
- before_script:
8
- - bundle exec rubocop
9
- notifications:
10
- email:
11
- on_success: never
12
- on_failure: always
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "atrium"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start
data/bin/demo DELETED
@@ -1,49 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require "bundler/setup"
3
- require "atrium"
4
- require "pry"
5
- require "yaml"
6
-
7
- def load_settings
8
- if ::File.exist?("tmp/settings.yml")
9
- puts "=> Using key and ID in tmp/settings.yml ¬"
10
- ::YAML.safe_load(::File.read("tmp/settings.yml"))
11
- else
12
- settings = {}
13
- puts "What is your MX-API-KEY?"
14
- settings[:mx_api_key] = gets.chomp
15
-
16
- puts "What is your Client ID?"
17
- settings[:mx_client_id] = gets.chomp
18
-
19
- puts "Would you like to save API key and client ID for future use?"
20
- case gets.chomp
21
- when /y/i
22
- ::File.open("tmp/settings.yml", "w") { |f| f.write(settings.to_yaml) }
23
- puts "Settings written to tmp/settings.yml ¬"
24
- settings
25
- when /n/i
26
- puts "One-time use settings ¬"
27
- settings
28
- end
29
- end
30
- end
31
-
32
- settings = load_settings
33
- settings.each { |k, v| puts "\t#{k}: #{v}" }
34
-
35
- ::Atrium.configure do |config|
36
- config.mx_client_id = settings[:mx_client_id]
37
- config.mx_api_key = settings[:mx_api_key]
38
- end
39
-
40
- ## Example flow
41
- #
42
- # 1. Create a User
43
- # 2. Read that user data via GUID
44
- # 3. List Institutions
45
- # 4. Get credentials for institution
46
- # 5. Create member on user
47
- # 6. Check member aggregation status
48
- # 7. Read other user data (accounts, members, transactions)
49
- #
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,49 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require "atrium"
3
-
4
- ::Atrium.configure do |config|
5
- config.mx_client_id = "YOUR_MX_CLIENT_ID"
6
- config.mx_api_key = "YOUR_MX_API_KEY"
7
- end
8
-
9
- puts "\n* Creating test user and member *"
10
- user = ::Atrium::User.create :identifier => nil, :is_disabled => nil, :metadata => nil
11
- puts "Created user: " + user.guid
12
-
13
- credential_one = {}
14
- credential_one[:guid] = "CRD-9f61fb4c-912c-bd1e-b175-ccc7f0275cc1"
15
- credential_one[:value] = "test_atrium"
16
-
17
- credential_two = {}
18
- credential_two[:guid] = "CRD-e3d7ea81-aac7-05e9-fbdd-4b493c6e474d"
19
- credential_two[:value] = "password"
20
-
21
- credential_array = []
22
- credential_array.push(credential_one)
23
- credential_array.push(credential_two)
24
-
25
- member = ::Atrium::Member.create :user_guid => user.guid, :institution_code => "mxbank", :credentials => credential_array
26
- puts "Created member: " + member.guid
27
-
28
- sleep(1)
29
-
30
- puts "\n* Aggregating Member *"
31
- member.aggregate
32
-
33
- sleep(4)
34
- puts "Member aggregation status: " + member.status
35
-
36
- puts "\n* Listing all member accounts and transactions *"
37
- accounts = member.accounts
38
- accounts.each do |account|
39
- puts "\nType: " + account.type + "\tName: " + account.name + "\tAvailable Balance: " + account.available_balance.to_s + "\tAvailable Credit: " + account.available_credit.to_s
40
- puts "Transactions"
41
- transactions = account.transactions
42
- transactions.each do |transaction|
43
- puts "\tDate: " + transaction.date + "\tDescription: " + transaction.description + "\tAmount: " + transaction.amount.to_s
44
- end
45
- end
46
-
47
- puts "\n* Deleting test user *"
48
- user.delete
49
- puts "Deleted user: " + user.guid
@@ -1,226 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require "atrium"
3
-
4
- ::Atrium.configure do |config|
5
- config.mx_client_id = "YOUR_MX_CLIENT_ID"
6
- config.mx_api_key = "YOUR_MX_API_KEY"
7
- end
8
-
9
- puts "\n************************** Create User **************************"
10
- user = ::Atrium::User.create :identifier => nil, :is_disabled => "", :metadata => "{\"first_name\": \"Steven\"}"
11
- puts user.attributes
12
- user_guid = user.guid
13
-
14
- puts "\n************************** Read User **************************"
15
- user = ::Atrium::User.read :guid => user_guid
16
- puts user.attributes
17
-
18
- puts "\n************************** Update User **************************"
19
- user = ::Atrium::User.read :guid => user_guid
20
- user = user.update :metadata => "{\"first_name\": \"Steven\", \"last_name\": \"Universe\"}"
21
- puts user.attributes
22
-
23
- puts "\n************************** List Users **************************"
24
- users = ::Atrium::User.list
25
- users.each do |a_user|
26
- puts a_user.attributes
27
- end
28
-
29
- puts "\n************************** List Institutions **************************"
30
- name = "bank"
31
- params = { :name => name }
32
- institutions = ::Atrium::Institution.list :query_params => params
33
- institutions.each do |institution|
34
- puts institution.attributes
35
- end
36
-
37
- puts "\n************************** Read Institution **************************"
38
- institution = ::Atrium::Institution.read :institution_code => "mxbank"
39
- puts institution.attributes
40
-
41
- puts "\n************************** Read Institution Credentials ************************** "
42
- credentials = ::Atrium::Institution.credentials "mxbank"
43
- credentials.each do |credential|
44
- puts credential.attributes
45
- end
46
-
47
- puts "\n************************** Create Member **************************"
48
- # Create credential JSON object
49
- credential_one = {}
50
- credential_one[:guid] = "CRD-9f61fb4c-912c-bd1e-b175-ccc7f0275cc1"
51
- credential_one[:value] = "test_atrium1"
52
-
53
- # Create another credential JSON object
54
- credential_two = {}
55
- credential_two[:guid] = "CRD-e3d7ea81-aac7-05e9-fbdd-4b493c6e474d"
56
- credential_two[:value] = "challenge1"
57
-
58
- # Create credential array from credential JSON Objects
59
- credential_array = []
60
- credential_array.push(credential_one)
61
- credential_array.push(credential_two)
62
-
63
- member = ::Atrium::Member.create :user_guid => user_guid, :institution_code => "mxbank", :credentials => credential_array
64
- puts member.attributes
65
- member_guid = member.guid
66
-
67
- puts "\n************************** Read Member **************************"
68
- member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
69
- puts member.attributes
70
-
71
- puts "\n************************** Update Member **************************"
72
- member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
73
-
74
- username_credential = {}
75
- username_credential[:guid] = "CRD-9f61fb4c-912c-bd1e-b175-ccc7f0275cc1"
76
- username_credential[:value] = "test_atrium"
77
-
78
- password_credential = {}
79
- password_credential[:guid] = "CRD-e3d7ea81-aac7-05e9-fbdd-4b493c6e474d"
80
- password_credential[:value] = "challenge"
81
-
82
- updated_credentials = []
83
- updated_credentials.push(username_credential)
84
- updated_credentials.push(password_credential)
85
-
86
- member = member.update(:metadata => "{\"credentials_last_refreshed_at\": \"2015-10-16\"}", :credentials => updated_credentials)
87
- puts member.attributes
88
-
89
- puts "\n************************** List Members **************************"
90
- members = ::Atrium::Member.list :user_guid => user_guid
91
- members.each do |a_member|
92
- puts a_member.attributes
93
- end
94
-
95
- puts "\n************************** Aggregate Member **************************"
96
- member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
97
- member = member.aggregate
98
- puts member.attributes
99
-
100
- puts "\n************************** Read Member Status **************************"
101
- sleep(5)
102
- member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
103
- member = member.aggregation_status
104
- puts member.attributes
105
-
106
- puts "\n************************** List Member MFA Challenges **************************"
107
- member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
108
- challenges = member.mfa_challenges
109
- challenges.each do |challenge|
110
- puts challenge.attributes
111
- end
112
- challenge_guid = challenges[0].guid
113
-
114
- puts "\n************************** Resume Aggregation **************************"
115
- member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
116
-
117
- credential_one = {}
118
- credential_one[:guid] = challenge_guid
119
- credential_one[:value] = "correct"
120
-
121
- challenge_responses = []
122
- challenge_responses.push(credential_one)
123
-
124
- member = member.resume challenge_responses
125
- puts member.attributes
126
-
127
- puts "\n************************** List Member Credentials **************************"
128
- member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
129
- credentials = member.credentials
130
- credentials.each do |credential|
131
- puts credential.attributes
132
- end
133
-
134
- puts "\n************************** List Member Accounts **************************"
135
- sleep(5)
136
- member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
137
- accounts = member.accounts
138
- accounts.each do |account|
139
- puts account.attributes
140
- end
141
- account_guid = accounts[0].guid
142
-
143
- puts "\n************************** List Member Transactions **************************"
144
- member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
145
- transactions = member.transactions
146
- transactions.each do |transaction|
147
- puts transaction.attributes
148
- end
149
-
150
- puts "\n************************** Read Account **************************"
151
- account = ::Atrium::Account.read :user_guid => user_guid, :account_guid => account_guid
152
- puts account.attributes
153
-
154
- puts "\n************************** List Accounts for User **************************"
155
- user_guid = user_guid
156
- params = { :user_guid => user_guid }
157
- accounts = ::Atrium::Account.list params
158
- accounts.each do |an_account|
159
- puts an_account.attributes
160
- end
161
-
162
- puts "\n************************** List Account Transactions **************************"
163
- account = ::Atrium::Account.read :user_guid => user_guid, :account_guid => account_guid
164
-
165
- user_guid = user_guid
166
- guid = account_guid
167
- params = { :user_guid => user_guid, :guid => guid }
168
-
169
- transactions = account.transactions params
170
- transactions.each do |transaction|
171
- puts transaction.attributes
172
- end
173
- transaction_guid = transactions[0].guid
174
-
175
- puts "\n************************** Read a Transaction **************************"
176
- transaction = ::Atrium::Transaction.read :user_guid => user_guid, :transaction_guid => transaction_guid
177
- puts transaction.attributes
178
-
179
- puts "\n************************** List Transactions **************************"
180
- user_guid = user_guid
181
- account_guid = account_guid
182
- params = { :user_guid => user_guid, :account_guid => account_guid }
183
-
184
- transactions = ::Atrium::Transaction.list params
185
- transactions.each do |a_transaction|
186
- puts a_transaction.attributes
187
- end
188
-
189
- puts "\n*********************** Categorize Transactions ***********************"
190
- transactions_to_categorize = ::JSON.parse('[
191
- {
192
- "amount": 11.22,
193
- "description": "BEER BAR 65000000764SALT LAKE C",
194
- "id": "12",
195
- "type": "DEBIT"
196
- },
197
- {
198
- "amount": 21.33,
199
- "description": "IN-N-OUT BURGER #239AMERICAN FO",
200
- "id": "13",
201
- "type": "DEBIT"
202
- },
203
- {
204
- "amount": 1595.33,
205
- "description": "ONLINE PAYMENT - THANK YOU",
206
- "id": "14",
207
- "type": "CREDIT"
208
- }
209
- ]')
210
-
211
- transactions = ::Atrium::Transaction.categorize_and_describe transactions_to_categorize
212
- transactions.each do |a_transaction|
213
- puts a_transaction.attributes
214
- end
215
-
216
- puts "\n************************** Connect Widget **************************"
217
- widget = ::Atrium::Connect.create :user_guid => user_guid
218
- puts widget.attributes
219
-
220
- puts "\n************************** Delete Member **************************"
221
- member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
222
- puts member.delete
223
-
224
- puts "\n************************** Delete User **************************"
225
- user = ::Atrium::User.read :guid => user_guid
226
- puts user.delete
@@ -1,176 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require "atrium"
3
-
4
- def check_job_status(user_guid, member_guid, counter)
5
- puts "\n2 second delay..."
6
- sleep(2)
7
-
8
- member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
9
- member_response = member.aggregation_status
10
- status = member_response.status
11
-
12
- puts "\nJOB STATUS: " + status
13
- case status
14
- when "COMPLETED"
15
- read_aggregation_data(user_guid, member_guid)
16
- when "HALTED", "FAILED"
17
- current_time = Time.now.utc.iso8601.chomp("Z") + "+00:00"
18
-
19
- member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
20
- last_success_time = member.aggregation_status
21
-
22
- # Check if last successful aggregation over 3 days aggregation
23
- if !last_success_time.nil? && ((current_time[8, 2] - last_success_time[8, 2]).abs > 3 || (current_time[5, 2] - last_success_time[5, 2]).abs > 0 || (current_time[0, 4] - last_success_time[0, 4]).abs > 0)
24
- puts "\nClient should contact MX Support to resolve issue."
25
- else
26
- puts "\nAn update is currently unavailable. Please try again tomorrow"
27
- end
28
- when "CREATED", "UPDATED", "RESUMED", "CONNECTED", "DEGRADED", "DELAYED", "INITIATED", "REQUESTED", "AUTHENTICATED", "RECEIVED", "TRANSFERRED"
29
- check_job_status(user_guid, member_guid, counter)
30
- when "PREVENTED", "DENIED", "IMPAIRED"
31
- member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
32
- institution_code = member.institution_code
33
-
34
- puts "\nPlease update credentials"
35
- credentials = ::Atrium::Institution.credentials institution_code
36
- updated_credentials = []
37
- credentials.each do |credential|
38
- puts "\nPlease enter in " + credential.label + ":"
39
- response = gets.chomp
40
- cred_pair = {}
41
- cred_pair[:guid] = credential.guid
42
- cred_pair[:value] = response
43
- updated_credentials.push(cred_pair)
44
- end
45
-
46
- member.update(:credentials => updated_credentials)
47
-
48
- check_job_status(user_guid, member_guid, counter)
49
- when "CHALLENGED"
50
- member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
51
- puts "\nPlease answer the following challenges:"
52
- challenges = member.challenges
53
- challenge_array = []
54
- challenges.each do |challenge|
55
- puts challenge.label
56
- answer = gets.chomp
57
- cred_pair = {}
58
- cred_pair[:guid] = challenge.guid
59
- cred_pair[:value] = answer
60
- challenge_array.push(cred_pair)
61
- end
62
-
63
- member.resume challenge_array
64
-
65
- check_job_status(user_guid, member_guid, counter)
66
- when "REJECTED"
67
- member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
68
- member.aggregate
69
-
70
- check_job_status(user_guid, member_guid, counter)
71
- when "EXPIRED"
72
- puts "\nUser did not answer MFA in time. Please try again tomorrow."
73
- when "LOCKED"
74
- puts "\nUser's account is locked at FI"
75
- when "IMPEDED"
76
- puts "\nUser's attention is required at FI website in order for aggregation to complete"
77
- when "DISCONTINUED"
78
- puts "\nConnection to institution is no longer available."
79
- when "CLOSED", "DISABLED"
80
- puts "\nAggregation is purposely turned off for this user."
81
- when "TERMINATED", "ABORTED", "STOPPED", "THROTTLED", "SUSPENDED", "ERRORED"
82
- if counter < 3
83
- counter += 1
84
- check_job_status(user_guid, member_guid, counter)
85
- else
86
- puts "\nAn update is currently unavailable. Please try again tomorrow and contact support if unsuccessful after 3 days."
87
- end
88
- else
89
- puts status
90
- end
91
- end
92
-
93
- def read_aggregation_data(user_guid, member_guid)
94
- member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
95
-
96
- puts "\n* Listing all member accounts and transactions *"
97
- accounts = member.accounts
98
- accounts.each do |account|
99
- puts "\nType: " + account.type + "\tName: " + account.name + "\tAvailable Balance: " + account.available_balance.to_s + "\tAvailable Credit: " + account.available_credit.to_s
100
- puts "Transactions"
101
- transactions = account.transactions
102
- transactions.each do |transaction|
103
- puts "\tDate: " + transaction.date + "\tDescription: " + transaction.description + "\tAmount: " + transaction.amount.to_s
104
- end
105
- end
106
- end
107
-
108
- ::Atrium.configure do |config|
109
- config.mx_client_id = "YOUR_MX_CLIENT_ID"
110
- config.mx_api_key = "YOUR_MX_API_KEY"
111
- end
112
-
113
- counter = 0
114
-
115
- puts "Please enter in user GUID. If not yet created just press enter key: "
116
- user_guid = gets.chomp
117
-
118
- puts "\nPlease enter in member GUID. If not yet created just press enter key: "
119
- member_guid = gets.chomp
120
-
121
- puts "\nPlease enter in if end user is present (true or false): "
122
- end_user_present = gets.chomp
123
-
124
- if user_guid == "" && member_guid != ""
125
- puts "\nMust include user GUID when member GUID is entered."
126
- exit
127
- end
128
-
129
- if user_guid == "" && end_user_present == "true"
130
- puts "\n* Creating user *"
131
-
132
- puts "\nPlease enter in an unique id: "
133
- identifier = gets.chomp
134
-
135
- user = ::Atrium::User.create :identifier => identifier, :is_disabled => nil, :metadata => nil
136
- user_guid = user.guid
137
- puts "\nCreated user: " + user_guid
138
- end
139
-
140
- if member_guid != "" && end_user_present == "true"
141
- member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
142
- member.aggregate
143
- check_job_status(user_guid, member_guid, counter)
144
- elsif member_guid != ""
145
- read_aggregation_data(user_guid, member_guid)
146
- elsif end_user_present == "true"
147
- puts "\n* Creating member *"
148
-
149
- institutions = ::Atrium::Institution.list
150
- institutions.each do |institution|
151
- puts institution.name + " : institution code = " + institution.code
152
- end
153
-
154
- puts "\nPlease enter in desired institution code: "
155
- institution_code = gets.chomp
156
-
157
- credentials = ::Atrium::Institution.credentials institution_code
158
- credential_array = []
159
- credentials.each do |credential|
160
- puts "\nPlease enter in " + credential.label + ":"
161
- response = gets.chomp
162
- cred_pair = {}
163
- cred_pair[:guid] = credential.guid
164
- cred_pair[:value] = response
165
- credential_array.push(cred_pair)
166
- end
167
-
168
- member = ::Atrium::Member.create :user_guid => user_guid, :institution_code => institution_code, :credentials => credential_array
169
- member_guid = member.guid
170
- puts "\nCreated member: " + member_guid
171
-
172
- check_job_status(user_guid, member_guid, counter)
173
- else
174
- puts "\nEnd user must be present to create a new member"
175
- exit
176
- end