Class: Atrium::User
- Inherits:
-
Object
show all
- Extended by:
- Pageable
- Includes:
- ActiveAttr::Model
- Defined in:
- lib/atrium/user.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
112
113
114
|
# File 'lib/atrium/user.rb', line 112
def self.(options)
options.merge(:endpoint => "/users", :resource => "users")
end
|
.create(identifier:, is_disabled:, metadata:) ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/atrium/user.rb', line 15
def self.create(identifier:, is_disabled:, metadata:)
endpoint = "/users"
body = user_body(identifier, is_disabled, metadata)
response = ::Atrium.client.make_request(:post, endpoint, body)
user_params = response["user"]
::Atrium::User.new(user_params)
end
|
.list(options = {}) ⇒ Object
24
25
26
27
|
# File 'lib/atrium/user.rb', line 24
def self.list(options = {})
options = (options)
paginate(options)
end
|
.list_each(options = {}) ⇒ Object
29
30
31
32
|
# File 'lib/atrium/user.rb', line 29
def self.list_each(options = {})
options = (options)
paginate_each(options) { |user| yield user }
end
|
.list_in_batches(options = {}) ⇒ Object
34
35
36
37
|
# File 'lib/atrium/user.rb', line 34
def self.list_in_batches(options = {})
options = (options)
paginate_in_batches(options) { |batch| yield batch }
end
|
.read(guid:) ⇒ Object
39
40
41
42
43
44
45
|
# File 'lib/atrium/user.rb', line 39
def self.read(guid:)
endpoint = "/users/#{guid}"
response = ::Atrium.client.make_request(:get, endpoint)
user_params = response["user"]
::Atrium::User.new(user_params)
end
|
Instance Method Details
#accounts(options = {}) ⇒ Object
50
51
52
53
|
# File 'lib/atrium/user.rb', line 50
def accounts(options = {})
options = (options)
self.class.paginate(options)
end
|
#accounts_in_batches(options = {}) ⇒ Object
60
61
62
63
|
# File 'lib/atrium/user.rb', line 60
def accounts_in_batches(options = {})
options = (options)
self.class.paginate_in_batches(options) { |batch| yield batch }
end
|
#delete ⇒ Object
65
66
67
68
69
70
|
# File 'lib/atrium/user.rb', line 65
def delete
endpoint = "/users/#{guid}"
::Atrium.client.make_request(:delete, endpoint)
self
end
|
#each_account(options = {}) ⇒ Object
55
56
57
58
|
# File 'lib/atrium/user.rb', line 55
def each_account(options = {})
options = (options)
self.class.paginate_each(options) { |account| yield account }
end
|
#each_member(options = {}) ⇒ Object
77
78
79
80
|
# File 'lib/atrium/user.rb', line 77
def each_member(options = {})
options = (options)
self.class.paginate_each(options) { |member| yield member }
end
|
#each_transaction(options = {}) ⇒ Object
92
93
94
95
|
# File 'lib/atrium/user.rb', line 92
def each_transaction(options = {})
options = (options)
self.class.paginate_each(options) { |transaction| yield transaction }
end
|
#members(options = {}) ⇒ Object
72
73
74
75
|
# File 'lib/atrium/user.rb', line 72
def members(options = {})
options = (options)
self.class.paginate(options)
end
|
#members_in_batches(options = {}) ⇒ Object
82
83
84
85
|
# File 'lib/atrium/user.rb', line 82
def members_in_batches(options = {})
options = (options)
self.class.paginate_in_batches(options) { |batch| yield batch }
end
|
#transactions(options = {}) ⇒ Object
87
88
89
90
|
# File 'lib/atrium/user.rb', line 87
def transactions(options = {})
options = (options)
self.class.paginate(options)
end
|
#transactions_in_batches(options = {}) ⇒ Object
97
98
99
100
|
# File 'lib/atrium/user.rb', line 97
def transactions_in_batches(options = {})
options = (options)
self.class.paginate_in_batches(options) { |batch| yield batch }
end
|
#update(params) ⇒ Object
102
103
104
105
106
107
108
109
110
|
# File 'lib/atrium/user.rb', line 102
def update(params)
endpoint = "/users/#{guid}"
body = update_params(params)
response = ::Atrium.client.make_request(:put, endpoint, body)
user_params = response["user"]
assign_attributes(user_params)
self
end
|