Class: Atrium::Member
- Inherits:
-
Object
show all
- Extended by:
- Pageable
- Includes:
- ActiveAttr::Model
- Defined in:
- lib/atrium/member.rb
Constant Summary
Constants included
from Pageable
Pageable::DEFAULT_RECORDS_PER_PAGE
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Pageable
make_get_request, paginate, paginate_each, paginate_in_batches, pagination_info
Class Method Details
163
164
165
166
167
|
# File 'lib/atrium/member.rb', line 163
def self.(options)
user_guid = options.fetch(:user_guid)
endpoint = "/users/#{user_guid}/members"
options.merge(:endpoint => endpoint, :resource => "members")
end
|
.create(user_guid:, institution_code:, credentials:) ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/atrium/member.rb', line 19
def self.create(user_guid:, institution_code:, credentials:)
endpoint = "/users/#{user_guid}/members"
body = create_params(institution_code, credentials)
member_response = ::Atrium.client.make_request(:post, endpoint, body)
member_params = member_response["member"]
::Atrium::Member.new(member_params)
end
|
.list(options = {}) ⇒ Object
28
29
30
31
|
# File 'lib/atrium/member.rb', line 28
def self.list(options = {})
options = (options)
paginate(options)
end
|
.list_each(options = {}) ⇒ Object
33
34
35
36
|
# File 'lib/atrium/member.rb', line 33
def self.list_each(options = {})
options = (options)
paginate_each(options) { |member| yield member }
end
|
.list_in_batches(options = {}) ⇒ Object
38
39
40
41
|
# File 'lib/atrium/member.rb', line 38
def self.list_in_batches(options = {})
options = (options)
paginate_in_batches(options) { |batch| yield batch }
end
|
.read(user_guid:, member_guid:) ⇒ Object
43
44
45
46
47
48
49
|
# File 'lib/atrium/member.rb', line 43
def self.read(user_guid:, member_guid:)
endpoint = "/users/#{user_guid}/members/#{member_guid}"
member_response = ::Atrium.client.make_request(:get, endpoint)
member_params = member_response["member"]
::Atrium::Member.new(member_params)
end
|
Instance Method Details
#accounts(options = {}) ⇒ Object
54
55
56
57
|
# File 'lib/atrium/member.rb', line 54
def accounts(options = {})
options = (options)
self.class.paginate(options)
end
|
#accounts_in_batches(options = {}) ⇒ Object
64
65
66
67
|
# File 'lib/atrium/member.rb', line 64
def accounts_in_batches(options = {})
options = (options)
self.class.paginate_in_batches(options) { |batch| yield batch }
end
|
#aggregate ⇒ Object
69
70
71
72
73
74
75
76
|
# File 'lib/atrium/member.rb', line 69
def aggregate
endpoint = "/users/#{user_guid}/members/#{guid}/aggregate"
member_response = ::Atrium.client.make_request(:post, endpoint)
member_params = member_response["member"]
assign_attributes(member_params)
self
end
|
#aggregation_status ⇒ Object
78
79
80
81
82
83
84
85
|
# File 'lib/atrium/member.rb', line 78
def aggregation_status
endpoint = "/users/#{user_guid}/members/#{guid}/status"
member_response = ::Atrium.client.make_request(:get, endpoint)
member_params = member_response["member"]
assign_attributes(member_params)
self
end
|
#challenges ⇒ Object
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/atrium/member.rb', line 87
def challenges
endpoint = "/users/#{user_guid}/members/#{guid}/challenges"
challenge_response = ::Atrium.client.make_request(:get, endpoint)
return nil if challenge_response.nil?
challenge_params = challenge_response["challenges"]
challenge_params.map do |challenge|
::Atrium::Challenge.new(challenge)
end
end
|
#credentials ⇒ Object
135
136
137
138
139
140
141
142
143
144
145
146
|
# File 'lib/atrium/member.rb', line 135
def credentials
endpoint = "/users/#{user_guid}/members/#{guid}/credentials"
credential_response = ::Atrium.client.make_request(:get, endpoint)
return nil if credential_response.nil?
credential_params = credential_response["credentials"]
credential_params.map do |credential|
::Atrium::Credential.new(credential)
end
end
|
#delete ⇒ Object
100
101
102
103
104
105
|
# File 'lib/atrium/member.rb', line 100
def delete
endpoint = "/users/#{user_guid}/members/#{guid}"
::Atrium.client.make_request(:delete, endpoint)
self
end
|
#each_account(options = {}) ⇒ Object
59
60
61
62
|
# File 'lib/atrium/member.rb', line 59
def each_account(options = {})
options = (options)
self.class.paginate_each(options) { |account| yield account }
end
|
#each_transaction(options = {}) ⇒ Object
153
154
155
156
|
# File 'lib/atrium/member.rb', line 153
def each_transaction(options = {})
options = (options)
self.class.paginate_each(options) { |transaction| yield transaction }
end
|
#read_account(account_guid:) ⇒ Object
107
108
109
110
111
112
113
|
# File 'lib/atrium/member.rb', line 107
def read_account(account_guid:)
endpoint = "/users/#{user_guid}/members/#{guid}/accounts/#{account_guid}"
account_response = ::Atrium.client.make_request(:get, endpoint)
account_params = account_response["account"]
::Atrium::Account.new(account_params)
end
|
#resume(challenge_credentials) ⇒ Object
115
116
117
118
119
120
121
122
123
|
# File 'lib/atrium/member.rb', line 115
def resume(challenge_credentials)
endpoint = "/users/#{user_guid}/members/#{guid}/resume"
body = resume_params(challenge_credentials)
member_response = ::Atrium.client.make_request(:put, endpoint, body)
member_params = member_response["member"]
assign_attributes(member_params)
self
end
|
#transactions(options = {}) ⇒ Object
148
149
150
151
|
# File 'lib/atrium/member.rb', line 148
def transactions(options = {})
options = (options)
self.class.paginate(options)
end
|
#transactions_in_batches(options = {}) ⇒ Object
158
159
160
161
|
# File 'lib/atrium/member.rb', line 158
def transactions_in_batches(options = {})
options = (options)
self.class.paginate_in_batches(options) { |batch| yield batch }
end
|
#update(params) ⇒ Object
125
126
127
128
129
130
131
132
133
|
# File 'lib/atrium/member.rb', line 125
def update(params)
endpoint = "/users/#{user_guid}/members/#{guid}"
body = member_body(params)
member_response = ::Atrium.client.make_request(:put, endpoint, body)
member_params = member_response["member"]
assign_attributes(member_params)
self
end
|