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.
- checksums.yaml +5 -5
- data/Gemfile +5 -2
- data/README.md +132 -66
- data/Rakefile +7 -4
- data/atrium-ruby.gemspec +40 -32
- data/docs/Account.md +35 -0
- data/docs/AccountNumber.md +12 -0
- data/docs/AccountNumbersResponseBody.md +8 -0
- data/docs/AccountOwner.md +18 -0
- data/docs/AccountOwnersResponseBody.md +8 -0
- data/docs/AccountResponseBody.md +8 -0
- data/docs/AccountsApi.md +174 -0
- data/docs/AccountsResponseBody.md +9 -0
- data/docs/Challenge.md +13 -0
- data/docs/ChallengeOption.md +10 -0
- data/docs/ChallengesResponseBody.md +8 -0
- data/docs/ConnectWidget.md +9 -0
- data/docs/ConnectWidgetApi.md +44 -0
- data/docs/ConnectWidgetRequestBody.md +11 -0
- data/docs/ConnectWidgetResponseBody.md +8 -0
- data/docs/CredentialOption.md +9 -0
- data/docs/CredentialRequest.md +9 -0
- data/docs/CredentialResponse.md +12 -0
- data/docs/CredentialsResponseBody.md +8 -0
- data/docs/IdentityApi.md +82 -0
- data/docs/Institution.md +14 -0
- data/docs/InstitutionResponseBody.md +8 -0
- data/docs/InstitutionsApi.md +120 -0
- data/docs/InstitutionsResponseBody.md +9 -0
- data/docs/Member.md +18 -0
- data/docs/MemberConnectionStatus.md +16 -0
- data/docs/MemberConnectionStatusResponseBody.md +8 -0
- data/docs/MemberCreateRequest.md +11 -0
- data/docs/MemberCreateRequestBody.md +8 -0
- data/docs/MemberResponseBody.md +8 -0
- data/docs/MemberResumeRequest.md +8 -0
- data/docs/MemberResumeRequestBody.md +8 -0
- data/docs/MemberUpdateRequest.md +10 -0
- data/docs/MemberUpdateRequestBody.md +8 -0
- data/docs/MembersApi.md +487 -0
- data/docs/MembersResponseBody.md +9 -0
- data/docs/Pagination.md +11 -0
- data/docs/Transaction.md +38 -0
- data/docs/TransactionCleanseAndCategorizeRequest.md +11 -0
- data/docs/TransactionCleanseAndCategorizeResponse.md +20 -0
- data/docs/TransactionResponseBody.md +8 -0
- data/docs/TransactionsApi.md +126 -0
- data/docs/TransactionsCleanseAndCategorizeRequestBody.md +8 -0
- data/docs/TransactionsCleanseAndCategorizeResponseBody.md +8 -0
- data/docs/TransactionsResponseBody.md +9 -0
- data/docs/User.md +11 -0
- data/docs/UserCreateRequestBody.md +8 -0
- data/docs/UserResponseBody.md +8 -0
- data/docs/UserUpdateRequestBody.md +8 -0
- data/docs/UsersApi.md +193 -0
- data/docs/UsersResponseBody.md +9 -0
- data/docs/VerificationApi.md +120 -0
- data/git_push.sh +49 -0
- data/lib/atrium-ruby.rb +88 -0
- data/lib/atrium-ruby/api/accounts_api.rb +272 -0
- data/lib/atrium-ruby/api/atrium_client.rb +28 -0
- data/lib/atrium-ruby/api/connect_widget_api.rb +82 -0
- data/lib/atrium-ruby/api/identity_api.rb +140 -0
- data/lib/atrium-ruby/api/institutions_api.rb +181 -0
- data/lib/atrium-ruby/api/members_api.rb +749 -0
- data/lib/atrium-ruby/api/transactions_api.rb +198 -0
- data/lib/atrium-ruby/api/users_api.rb +287 -0
- data/lib/atrium-ruby/api/verification_api.rb +198 -0
- data/lib/atrium-ruby/api_client.rb +384 -0
- data/lib/atrium-ruby/api_error.rb +34 -0
- data/lib/atrium-ruby/configuration.rb +212 -0
- data/lib/atrium-ruby/models/account.rb +422 -0
- data/lib/atrium-ruby/models/account_number.rb +215 -0
- data/lib/atrium-ruby/models/account_numbers_response_body.rb +181 -0
- data/lib/atrium-ruby/models/account_owner.rb +269 -0
- data/lib/atrium-ruby/models/account_owners_response_body.rb +181 -0
- data/lib/atrium-ruby/models/account_response_body.rb +179 -0
- data/lib/atrium-ruby/models/accounts_response_body.rb +190 -0
- data/lib/atrium-ruby/models/challenge.rb +226 -0
- data/lib/atrium-ruby/models/challenge_option.rb +197 -0
- data/lib/atrium-ruby/models/challenges_response_body.rb +181 -0
- data/lib/atrium-ruby/models/connect_widget.rb +188 -0
- data/lib/atrium-ruby/models/connect_widget_request_body.rb +206 -0
- data/lib/atrium-ruby/models/connect_widget_response_body.rb +179 -0
- data/lib/atrium-ruby/models/credential_option.rb +188 -0
- data/lib/atrium-ruby/models/credential_request.rb +188 -0
- data/lib/atrium-ruby/models/credential_response.rb +217 -0
- data/lib/atrium-ruby/models/credentials_response_body.rb +181 -0
- data/lib/atrium-ruby/models/institution.rb +233 -0
- data/lib/atrium-ruby/models/institution_response_body.rb +179 -0
- data/lib/atrium-ruby/models/institutions_response_body.rb +190 -0
- data/lib/atrium-ruby/models/member.rb +269 -0
- data/lib/atrium-ruby/models/member_connection_status.rb +253 -0
- data/lib/atrium-ruby/models/member_connection_status_response_body.rb +179 -0
- data/lib/atrium-ruby/models/member_create_request.rb +218 -0
- data/lib/atrium-ruby/models/member_create_request_body.rb +179 -0
- data/lib/atrium-ruby/models/member_response_body.rb +179 -0
- data/lib/atrium-ruby/models/member_resume_request.rb +181 -0
- data/lib/atrium-ruby/models/member_resume_request_body.rb +179 -0
- data/lib/atrium-ruby/models/member_update_request.rb +199 -0
- data/lib/atrium-ruby/models/member_update_request_body.rb +179 -0
- data/lib/atrium-ruby/models/members_response_body.rb +190 -0
- data/lib/atrium-ruby/models/pagination.rb +206 -0
- data/lib/atrium-ruby/models/transaction.rb +449 -0
- data/lib/atrium-ruby/models/transaction_cleanse_and_categorize_request.rb +206 -0
- data/lib/atrium-ruby/models/transaction_cleanse_and_categorize_response.rb +287 -0
- data/lib/atrium-ruby/models/transaction_response_body.rb +179 -0
- data/lib/atrium-ruby/models/transactions_cleanse_and_categorize_request_body.rb +181 -0
- data/lib/atrium-ruby/models/transactions_cleanse_and_categorize_response_body.rb +181 -0
- data/lib/atrium-ruby/models/transactions_response_body.rb +190 -0
- data/lib/atrium-ruby/models/user.rb +206 -0
- data/lib/atrium-ruby/models/user_create_request_body.rb +179 -0
- data/lib/atrium-ruby/models/user_response_body.rb +179 -0
- data/lib/atrium-ruby/models/user_update_request_body.rb +179 -0
- data/lib/atrium-ruby/models/users_response_body.rb +190 -0
- data/lib/atrium-ruby/version.rb +11 -0
- data/spec/api/accounts_api_spec.rb +88 -0
- data/spec/api/connect_widget_api_spec.rb +43 -0
- data/spec/api/identity_api_spec.rb +56 -0
- data/spec/api/institutions_api_spec.rb +68 -0
- data/spec/api/members_api_spec.rb +195 -0
- data/spec/api/transactions_api_spec.rb +71 -0
- data/spec/api/users_api_spec.rb +92 -0
- data/spec/api/verification_api_spec.rb +69 -0
- data/spec/api_client_spec.rb +222 -0
- data/spec/configuration_spec.rb +38 -0
- data/spec/models/account_number_spec.rb +60 -0
- data/spec/models/account_numbers_response_body_spec.rb +36 -0
- data/spec/models/account_owner_spec.rb +96 -0
- data/spec/models/account_owners_response_body_spec.rb +36 -0
- data/spec/models/account_response_body_spec.rb +36 -0
- data/spec/models/account_spec.rb +198 -0
- data/spec/models/accounts_response_body_spec.rb +42 -0
- data/spec/models/challenge_option_spec.rb +48 -0
- data/spec/models/challenge_spec.rb +66 -0
- data/spec/models/challenges_response_body_spec.rb +36 -0
- data/spec/models/connect_widget_request_body_spec.rb +54 -0
- data/spec/models/connect_widget_response_body_spec.rb +36 -0
- data/spec/models/connect_widget_spec.rb +42 -0
- data/spec/models/credential_option_spec.rb +42 -0
- data/spec/models/credential_request_spec.rb +42 -0
- data/spec/models/credential_response_spec.rb +60 -0
- data/spec/models/credentials_response_body_spec.rb +36 -0
- data/spec/models/institution_response_body_spec.rb +36 -0
- data/spec/models/institution_spec.rb +72 -0
- data/spec/models/institutions_response_body_spec.rb +42 -0
- data/spec/models/member_connection_status_response_body_spec.rb +36 -0
- data/spec/models/member_connection_status_spec.rb +84 -0
- data/spec/models/member_create_request_body_spec.rb +36 -0
- data/spec/models/member_create_request_spec.rb +54 -0
- data/spec/models/member_response_body_spec.rb +36 -0
- data/spec/models/member_resume_request_body_spec.rb +36 -0
- data/spec/models/member_resume_request_spec.rb +36 -0
- data/spec/models/member_spec.rb +96 -0
- data/spec/models/member_update_request_body_spec.rb +36 -0
- data/spec/models/member_update_request_spec.rb +48 -0
- data/spec/models/members_response_body_spec.rb +42 -0
- data/spec/models/pagination_spec.rb +54 -0
- data/spec/models/transaction_cleanse_and_categorize_request_spec.rb +54 -0
- data/spec/models/transaction_cleanse_and_categorize_response_spec.rb +108 -0
- data/spec/models/transaction_response_body_spec.rb +36 -0
- data/spec/models/transaction_spec.rb +216 -0
- data/spec/models/transactions_cleanse_and_categorize_request_body_spec.rb +36 -0
- data/spec/models/transactions_cleanse_and_categorize_response_body_spec.rb +36 -0
- data/spec/models/transactions_response_body_spec.rb +42 -0
- data/spec/models/user_create_request_body_spec.rb +36 -0
- data/spec/models/user_response_body_spec.rb +36 -0
- data/spec/models/user_spec.rb +54 -0
- data/spec/models/user_update_request_body_spec.rb +36 -0
- data/spec/models/users_response_body_spec.rb +42 -0
- data/spec/spec_helper.rb +107 -0
- metadata +323 -91
- data/.gitignore +0 -10
- data/.rubocop.yml +0 -12
- data/.travis.yml +0 -12
- data/bin/console +0 -14
- data/bin/demo +0 -49
- data/bin/setup +0 -8
- data/examples/accounts_and_transactions.rb +0 -49
- data/examples/all_endpoints.rb +0 -226
- data/examples/example_workflow.rb +0 -176
- data/examples/multi_factor_authentication.rb +0 -57
- data/examples/update_credentials.rb +0 -58
- data/examples/user_and_member_creation.rb +0 -53
- data/lib/atrium.rb +0 -40
- data/lib/atrium/account.rb +0 -100
- data/lib/atrium/account_number.rb +0 -13
- data/lib/atrium/account_owner.rb +0 -19
- data/lib/atrium/challenge.rb +0 -13
- data/lib/atrium/client.rb +0 -51
- data/lib/atrium/connect.rb +0 -34
- data/lib/atrium/credential.rb +0 -11
- data/lib/atrium/error.rb +0 -4
- data/lib/atrium/institution.rb +0 -38
- data/lib/atrium/member.rb +0 -264
- data/lib/atrium/pageable.rb +0 -74
- data/lib/atrium/paginate.rb +0 -92
- data/lib/atrium/ruby.rb +0 -3
- data/lib/atrium/transaction.rb +0 -74
- data/lib/atrium/user.rb +0 -150
- data/lib/atrium/version.rb +0 -3
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
data/.travis.yml
DELETED
data/bin/console
DELETED
@@ -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,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
|
data/examples/all_endpoints.rb
DELETED
@@ -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
|