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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -1,13 +0,0 @@
1
- module Atrium
2
- class Challenge
3
- include ::ActiveAttr::Model
4
- include ::ActiveAttr::Attributes
5
-
6
- attribute :field_name
7
- attribute :guid
8
- attribute :label
9
- attribute :type
10
- attribute :image_data
11
- attribute :options
12
- end
13
- end
@@ -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
@@ -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