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
@@ -1,57 +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 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.mfa_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
|
@@ -1,58 +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 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
|
@@ -1,53 +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 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.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
require "active_attr"
|
2
|
-
require "httpclient"
|
3
|
-
require "json"
|
4
|
-
require "atrium/pageable"
|
5
|
-
require "atrium/paginate"
|
6
|
-
|
7
|
-
require "atrium/account"
|
8
|
-
require "atrium/account_number"
|
9
|
-
require "atrium/account_owner"
|
10
|
-
require "atrium/client"
|
11
|
-
require "atrium/connect"
|
12
|
-
require "atrium/credential"
|
13
|
-
require "atrium/error"
|
14
|
-
require "atrium/institution"
|
15
|
-
require "atrium/challenge"
|
16
|
-
require "atrium/member"
|
17
|
-
require "atrium/transaction"
|
18
|
-
require "atrium/user"
|
19
|
-
require "atrium/version"
|
20
|
-
|
21
|
-
module Atrium
|
22
|
-
##
|
23
|
-
# mx-api-key and mx-client-id are required for Atrium
|
24
|
-
#
|
25
|
-
# Atrium.configure do |config|
|
26
|
-
# config.mx_api_key = generated_api_key
|
27
|
-
# config.mx_client_id = generated_client_id
|
28
|
-
# config.base_url = "https://atrium.mx.com" # for production URL. this will default to vestibule
|
29
|
-
# config.verify_ssl = false # Defaults to true
|
30
|
-
# end
|
31
|
-
#
|
32
|
-
class << self
|
33
|
-
attr_reader :client
|
34
|
-
|
35
|
-
def configure
|
36
|
-
@client = ::Atrium::Client.new
|
37
|
-
yield @client
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
data/lib/atrium/account.rb
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
module Atrium
|
2
|
-
class Account
|
3
|
-
extend ::Atrium::Pageable
|
4
|
-
include ::ActiveAttr::Model
|
5
|
-
|
6
|
-
# ATTRIBUTES
|
7
|
-
attribute :apr
|
8
|
-
attribute :apy
|
9
|
-
attribute :available_balance
|
10
|
-
attribute :available_credit
|
11
|
-
attribute :balance
|
12
|
-
attribute :created_at
|
13
|
-
attribute :credit_limit
|
14
|
-
attribute :day_payment_is_due
|
15
|
-
attribute :guid
|
16
|
-
attribute :institution_code
|
17
|
-
attribute :interest_rate
|
18
|
-
attribute :is_closed
|
19
|
-
attribute :last_payment
|
20
|
-
attribute :last_payment_at
|
21
|
-
attribute :matures_on
|
22
|
-
attribute :member_guid
|
23
|
-
attribute :minimum_balance
|
24
|
-
attribute :minimum_payment
|
25
|
-
attribute :name
|
26
|
-
attribute :original_balance
|
27
|
-
attribute :payment_due_at
|
28
|
-
attribute :payoff_balance
|
29
|
-
attribute :started_on
|
30
|
-
attribute :subtype
|
31
|
-
attribute :total_account_value
|
32
|
-
attribute :type
|
33
|
-
attribute :updated_at
|
34
|
-
attribute :user_guid
|
35
|
-
|
36
|
-
def self.list(options = {})
|
37
|
-
options = _account_pagination_options(options)
|
38
|
-
paginate(options)
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.list_each(options = {})
|
42
|
-
options = _account_pagination_options(options)
|
43
|
-
paginate_each(options) { |account| yield account }
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.list_in_batches(options = {})
|
47
|
-
options = _account_pagination_options(options)
|
48
|
-
paginate_in_batches(options) { |batch| yield batch }
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.read(user_guid:, account_guid:)
|
52
|
-
endpoint = "/users/#{user_guid}/accounts/#{account_guid}"
|
53
|
-
account_response = ::Atrium.client.make_request(:get, endpoint)
|
54
|
-
|
55
|
-
account_params = account_response["account"]
|
56
|
-
::Atrium::Account.new(account_params)
|
57
|
-
end
|
58
|
-
|
59
|
-
def account_numbers
|
60
|
-
endpoint = "/users/#{user_guid}/accounts/#{guid}/account_numbers"
|
61
|
-
account_numbers_response = ::Atrium.client.make_request(:get, endpoint)
|
62
|
-
|
63
|
-
return nil if account_numbers_response.nil?
|
64
|
-
|
65
|
-
account_numbers_params = account_numbers_response["account_numbers"]
|
66
|
-
|
67
|
-
account_numbers_params.map do |account_number|
|
68
|
-
::Atrium::AccountNumber.new(account_number)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def transactions(options = {})
|
73
|
-
options = _transaction_pagination_options(options)
|
74
|
-
self.class.paginate(options)
|
75
|
-
end
|
76
|
-
|
77
|
-
def each_transaction(options = {})
|
78
|
-
options = _transaction_pagination_options(options)
|
79
|
-
self.class.paginate_each(options) { |account| yield account }
|
80
|
-
end
|
81
|
-
|
82
|
-
def transactions_in_batches(options = {})
|
83
|
-
options = _transaction_pagination_options(options)
|
84
|
-
self.class.paginate_in_batches(options) { |batch| yield batch }
|
85
|
-
end
|
86
|
-
|
87
|
-
def self._account_pagination_options(options)
|
88
|
-
user_guid = options.fetch(:user_guid)
|
89
|
-
endpoint = "/users/#{user_guid}/accounts"
|
90
|
-
options.merge(:endpoint => endpoint, :resource => "accounts")
|
91
|
-
end
|
92
|
-
|
93
|
-
private
|
94
|
-
|
95
|
-
def _transaction_pagination_options(options)
|
96
|
-
endpoint = "/users/#{user_guid}/accounts/#{guid}/transactions"
|
97
|
-
options.merge(:endpoint => endpoint, :resource => "transactions", :klass => ::Atrium::Transaction)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Atrium
|
2
|
-
class AccountNumber
|
3
|
-
include ::ActiveAttr::Model
|
4
|
-
include ::ActiveAttr::Attributes
|
5
|
-
|
6
|
-
attribute :guid
|
7
|
-
attribute :user_guid
|
8
|
-
attribute :member_guid
|
9
|
-
attribute :account_guid
|
10
|
-
attribute :account_number
|
11
|
-
attribute :routing_number
|
12
|
-
end
|
13
|
-
end
|
data/lib/atrium/account_owner.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
module Atrium
|
2
|
-
class AccountOwner
|
3
|
-
include ::ActiveAttr::Model
|
4
|
-
include ::ActiveAttr::Attributes
|
5
|
-
|
6
|
-
attribute :guid
|
7
|
-
attribute :user_guid
|
8
|
-
attribute :member_guid
|
9
|
-
attribute :account_guid
|
10
|
-
attribute :owner_name
|
11
|
-
attribute :address
|
12
|
-
attribute :city
|
13
|
-
attribute :state
|
14
|
-
attribute :postal_code
|
15
|
-
attribute :country
|
16
|
-
attribute :email
|
17
|
-
attribute :phone
|
18
|
-
end
|
19
|
-
end
|
data/lib/atrium/challenge.rb
DELETED
data/lib/atrium/client.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
module Atrium
|
2
|
-
class Client
|
3
|
-
DEVELOPMENT_URL = "https://vestibule.mx.com".freeze
|
4
|
-
attr_accessor :mx_api_key, :mx_client_id, :base_url, :verify_ssl
|
5
|
-
|
6
|
-
def initialize(api_key = nil, client_id = nil, base_url = DEVELOPMENT_URL, verify_ssl = true)
|
7
|
-
@mx_api_key = api_key
|
8
|
-
@mx_client_id = client_id
|
9
|
-
@base_url = base_url
|
10
|
-
@verify_ssl = verify_ssl
|
11
|
-
end
|
12
|
-
|
13
|
-
def make_request(method, endpoint, body = nil, headers = {})
|
14
|
-
headers = default_headers.merge(headers)
|
15
|
-
url = "#{base_url}#{endpoint}"
|
16
|
-
body = ::JSON.dump(body) if body
|
17
|
-
|
18
|
-
response = http_client.public_send(method, url, body, headers)
|
19
|
-
|
20
|
-
handle_response(response)
|
21
|
-
end
|
22
|
-
|
23
|
-
def http_client
|
24
|
-
@http_client ||= begin
|
25
|
-
client = ::HTTPClient.new
|
26
|
-
client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE unless @verify_ssl
|
27
|
-
client
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def default_headers
|
34
|
-
{
|
35
|
-
"Accept" => "application/vnd.mx.atrium.v1+json",
|
36
|
-
"Content-Type" => "application/json",
|
37
|
-
"MX-API-KEY" => mx_api_key,
|
38
|
-
"MX-CLIENT-ID" => mx_client_id
|
39
|
-
}
|
40
|
-
end
|
41
|
-
|
42
|
-
def handle_response(response)
|
43
|
-
# Handle 200-206 responses as acceptable
|
44
|
-
unless response.status.between?(200, 206)
|
45
|
-
raise ::Atrium::Error, "#{response.status}: #{response.body}"
|
46
|
-
end
|
47
|
-
|
48
|
-
::JSON.parse(response.body) unless response.body.empty?
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
data/lib/atrium/connect.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require "set"
|
2
|
-
|
3
|
-
module Atrium
|
4
|
-
class Connect
|
5
|
-
include ::ActiveAttr::Model
|
6
|
-
|
7
|
-
PERMITTED_CONNECT_CREATE_OPTIONS = ::Set.new([
|
8
|
-
"current_institution_code",
|
9
|
-
"current_member_guid",
|
10
|
-
"is_mobile_webview",
|
11
|
-
"update_credentials",
|
12
|
-
]).freeze
|
13
|
-
SCRIPT_SOURCE = "https://atrium.mx.com/connect.js".freeze
|
14
|
-
|
15
|
-
# ATTRIBUTES
|
16
|
-
attribute :connect_widget_url
|
17
|
-
attribute :guid
|
18
|
-
|
19
|
-
##
|
20
|
-
# CLASS METHODS
|
21
|
-
#
|
22
|
-
def self.create(user_guid:, options: {})
|
23
|
-
options.each_key do |key|
|
24
|
-
fail ArgumentError, "An invalid option was provided: #{key}" unless PERMITTED_CONNECT_CREATE_OPTIONS.include?(key.to_s)
|
25
|
-
end
|
26
|
-
|
27
|
-
endpoint = "/users/#{user_guid}/connect_widget_url"
|
28
|
-
connect_response = ::Atrium.client.make_request(:post, endpoint, options)
|
29
|
-
|
30
|
-
connect_params = connect_response["user"]
|
31
|
-
::Atrium::Connect.new(connect_params)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|