atrium-ruby 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/accounts_and_transactions.rb +49 -0
- data/examples/all_endpoints.rb +201 -0
- data/examples/example_workflow.rb +181 -0
- data/examples/multi_factor_authentication.rb +57 -0
- data/examples/update_credentials.rb +58 -0
- data/examples/user_and_member_creation.rb +53 -0
- data/lib/atrium/member.rb +9 -1
- data/lib/atrium/version.rb +1 -1
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca8b3c1777657ac0ebf861e6285519e16017d4b0
|
4
|
+
data.tar.gz: a042a427fc4967d1cb1c89119cd22591b4ea0cb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 616d9849a244e8bd8b7cc7183807578e44dc2415d3f853b13a3d94733400ea2e8c61bb1a88c0ae9df8f09046e61d81fb5e75924ab4caf5e507e62d2e37473144
|
7
|
+
data.tar.gz: 642b7d89f8feafb5dceb47fa48c952a18a0d56c745004ee3792146cf240bd81a952f2a24affa299341ba15547b2c93b4f1b841aad8e19f0f0688852e5168bfa8
|
@@ -0,0 +1,49 @@
|
|
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
|
@@ -0,0 +1,201 @@
|
|
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 => "unique_id", :is_disabled => "", :metadata => "{\"first_name\": \"Steven\"}"
|
11
|
+
puts user.guid
|
12
|
+
user_guid = user.guid
|
13
|
+
|
14
|
+
puts "\n************************** Read User **************************"
|
15
|
+
user = ::Atrium::User.read :guid => user_guid
|
16
|
+
puts user.guid
|
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.guid
|
22
|
+
|
23
|
+
puts "\n************************** List Users **************************"
|
24
|
+
users = ::Atrium::User.list
|
25
|
+
users.each do |a_user|
|
26
|
+
puts a_user.guid
|
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.name
|
35
|
+
end
|
36
|
+
|
37
|
+
puts "\n************************** Read Institution **************************"
|
38
|
+
institution = ::Atrium::Institution.read :institution_code => "mxbank"
|
39
|
+
puts institution.name
|
40
|
+
|
41
|
+
puts "\n************************** Read Institution Credentials ************************** "
|
42
|
+
credentials = ::Atrium::Institution.credentials "mxbank"
|
43
|
+
credentials.each do |credential|
|
44
|
+
puts credential.guid
|
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.guid
|
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.guid
|
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.guid
|
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.guid
|
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.guid
|
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.guid
|
105
|
+
|
106
|
+
puts "\n************************** List Member MFA Challenges **************************"
|
107
|
+
member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
|
108
|
+
challenges = member.challenges
|
109
|
+
challenges.each do |challenge|
|
110
|
+
puts challenge.guid
|
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.status
|
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.guid
|
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.guid
|
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.guid
|
148
|
+
end
|
149
|
+
|
150
|
+
puts "\n************************** Read Account **************************"
|
151
|
+
account = ::Atrium::Account.read :user_guid => user_guid, :account_guid => account_guid
|
152
|
+
puts account.guid
|
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.guid
|
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.guid
|
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.guid
|
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.guid
|
187
|
+
end
|
188
|
+
|
189
|
+
puts "\n************************** Connect Widget **************************"
|
190
|
+
widget = ::Atrium::Connect.create :user_guid => user_guid
|
191
|
+
puts widget.guid
|
192
|
+
|
193
|
+
puts "\n************************** Delete Member **************************"
|
194
|
+
member = ::Atrium::Member.read :user_guid => user_guid, :member_guid => member_guid
|
195
|
+
response = member.delete
|
196
|
+
puts response.attributes
|
197
|
+
|
198
|
+
puts "\n************************** Delete User **************************"
|
199
|
+
user = ::Atrium::User.read :guid => user_guid
|
200
|
+
response = user.delete
|
201
|
+
puts response.attributes
|
@@ -0,0 +1,181 @@
|
|
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
|
177
|
+
|
178
|
+
puts "\n* Deleting test user *"
|
179
|
+
user = ::Atrium::User.read :guid => user_guid
|
180
|
+
user.delete
|
181
|
+
puts "Deleted user: " + user.guid
|
@@ -0,0 +1,57 @@
|
|
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 with \"CHALLENGED\" aggregation status *"
|
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] = "challenge"
|
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* Retrieving member aggregation status *"
|
31
|
+
aggregation_response = member.aggregation_status
|
32
|
+
puts "Member aggregation status: " + aggregation_response.status
|
33
|
+
|
34
|
+
puts "\n* MFA Challenge *"
|
35
|
+
challenges = member.challenges
|
36
|
+
challenges.each do |challenge|
|
37
|
+
puts challenge.label
|
38
|
+
end
|
39
|
+
|
40
|
+
credential = {}
|
41
|
+
credential[:guid] = challenges[0].guid
|
42
|
+
credential[:value] = "correct"
|
43
|
+
challenge_responses = []
|
44
|
+
challenge_responses.push(credential)
|
45
|
+
|
46
|
+
puts "\n* MFA answered correctly, resuming aggregation *"
|
47
|
+
member.resume challenge_responses
|
48
|
+
|
49
|
+
sleep(1)
|
50
|
+
|
51
|
+
puts "\n* Retrieving member aggregation status *"
|
52
|
+
aggregation_response = member.aggregation_status
|
53
|
+
puts "Member aggregation status: " + aggregation_response.status
|
54
|
+
|
55
|
+
puts "\n* Deleting test user *"
|
56
|
+
user.delete
|
57
|
+
puts "Deleted user: " + user.guid
|
@@ -0,0 +1,58 @@
|
|
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 user and member with \"DENIED\" aggregation status *"
|
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] = "INVALID"
|
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* Retrieving member aggregation status *"
|
31
|
+
aggregation_response = member.aggregation_status
|
32
|
+
puts "Member aggregation status: " + aggregation_response.status
|
33
|
+
|
34
|
+
puts "\n* Updating credentials *"
|
35
|
+
credentials = ::Atrium::Institution.credentials "mxbank"
|
36
|
+
|
37
|
+
username_credential = {}
|
38
|
+
username_credential[:guid] = credentials[0].guid
|
39
|
+
username_credential[:value] = "test_atrium"
|
40
|
+
|
41
|
+
password_credential = {}
|
42
|
+
password_credential[:guid] = credentials[1].guid
|
43
|
+
password_credential[:value] = "password"
|
44
|
+
|
45
|
+
updated_credentials = []
|
46
|
+
updated_credentials.push(username_credential)
|
47
|
+
updated_credentials.push(password_credential)
|
48
|
+
|
49
|
+
member.update(:credentials => updated_credentials)
|
50
|
+
sleep(1)
|
51
|
+
|
52
|
+
puts "\n* Retrieving member aggregation status *"
|
53
|
+
aggregation_response = member.aggregation_status
|
54
|
+
puts "Member aggregation status: " + aggregation_response.status
|
55
|
+
|
56
|
+
puts "\n* Deleting test user *"
|
57
|
+
user.delete
|
58
|
+
puts "Deleted user: " + user.guid
|
@@ -0,0 +1,53 @@
|
|
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 user *"
|
10
|
+
user = ::Atrium::User.create :identifier => nil, :is_disabled => nil, :metadata => nil
|
11
|
+
puts user.guid
|
12
|
+
|
13
|
+
puts "\n* Listing institutions with query string \"bank\" *"
|
14
|
+
name = "bank"
|
15
|
+
params = { :name => name }
|
16
|
+
institutions = ::Atrium::Institution.list :query_params => params
|
17
|
+
institutions.each do |institution|
|
18
|
+
puts institution.name + " : institution code = " + institution.code
|
19
|
+
end
|
20
|
+
|
21
|
+
puts "\n* Reading institution \"mxbank\" *"
|
22
|
+
institution = ::Atrium::Institution.read :institution_code => "mxbank"
|
23
|
+
puts institution.name
|
24
|
+
|
25
|
+
puts "\n* Reading institution credentials \"mxbank\" *"
|
26
|
+
credentials = ::Atrium::Institution.credentials "chase"
|
27
|
+
credentials.each do |credential|
|
28
|
+
puts credential.guid
|
29
|
+
end
|
30
|
+
|
31
|
+
puts "\n* Creating member *"
|
32
|
+
|
33
|
+
# Create credential JSON object
|
34
|
+
credential_one = {}
|
35
|
+
credential_one[:guid] = "CRD-9f61fb4c-912c-bd1e-b175-ccc7f0275cc1"
|
36
|
+
credential_one[:value] = "test_atrium"
|
37
|
+
|
38
|
+
# Create another credential JSON object
|
39
|
+
credential_two = {}
|
40
|
+
credential_two[:guid] = "CRD-e3d7ea81-aac7-05e9-fbdd-4b493c6e474d"
|
41
|
+
credential_two[:value] = "password"
|
42
|
+
|
43
|
+
# Create credential array from credential JSON Objects
|
44
|
+
credential_array = []
|
45
|
+
credential_array.push(credential_one)
|
46
|
+
credential_array.push(credential_two)
|
47
|
+
|
48
|
+
member = ::Atrium::Member.create :user_guid => user.guid, :institution_code => "mxbank", :credentials => credential_array
|
49
|
+
puts member.guid
|
50
|
+
|
51
|
+
puts "\n* Deleting test user *"
|
52
|
+
user.delete
|
53
|
+
puts "Deleted user: " + user.guid
|
data/lib/atrium/member.rb
CHANGED
@@ -134,7 +134,15 @@ module Atrium
|
|
134
134
|
|
135
135
|
def credentials
|
136
136
|
endpoint = "/users/#{user_guid}/members/#{guid}/credentials"
|
137
|
-
::Atrium.client.make_request(:get, endpoint)
|
137
|
+
credential_response = ::Atrium.client.make_request(:get, endpoint)
|
138
|
+
|
139
|
+
return nil if credential_response.nil?
|
140
|
+
|
141
|
+
credential_params = credential_response["credentials"]
|
142
|
+
|
143
|
+
credential_params.map do |credential|
|
144
|
+
::Atrium::Credential.new(credential)
|
145
|
+
end
|
138
146
|
end
|
139
147
|
|
140
148
|
def transactions(options = {})
|
data/lib/atrium/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atrium-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Carstens, Dan Jones, Zach Toolson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_attr
|
@@ -167,6 +167,12 @@ files:
|
|
167
167
|
- bin/console
|
168
168
|
- bin/demo
|
169
169
|
- bin/setup
|
170
|
+
- examples/accounts_and_transactions.rb
|
171
|
+
- examples/all_endpoints.rb
|
172
|
+
- examples/example_workflow.rb
|
173
|
+
- examples/multi_factor_authentication.rb
|
174
|
+
- examples/update_credentials.rb
|
175
|
+
- examples/user_and_member_creation.rb
|
170
176
|
- lib/atrium.rb
|
171
177
|
- lib/atrium/account.rb
|
172
178
|
- lib/atrium/challenge.rb
|
@@ -202,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
208
|
version: '0'
|
203
209
|
requirements: []
|
204
210
|
rubyforge_project:
|
205
|
-
rubygems_version: 2.
|
211
|
+
rubygems_version: 2.6.13
|
206
212
|
signing_key:
|
207
213
|
specification_version: 4
|
208
214
|
summary: Ruby wrapper for the Atrium API by MX
|