Class: LabClient::Users
- Inherits:
-
Common
- Object
- Common
- LabClient::Users
show all
- Defined in:
- lib/labclient/users/list.rb,
lib/labclient/users/show.rb,
lib/labclient/users/block.rb,
lib/labclient/users/counts.rb,
lib/labclient/users/create.rb,
lib/labclient/users/delete.rb,
lib/labclient/users/search.rb,
lib/labclient/users/status.rb,
lib/labclient/users/update.rb,
lib/labclient/users/current.rb,
lib/labclient/users/unblock.rb,
lib/labclient/users/activate.rb,
lib/labclient/users/activity.rb,
lib/labclient/users/deactivate.rb,
lib/labclient/users/gpg/client.rb,
lib/labclient/users/status_set.rb,
lib/labclient/users/keys/client.rb,
lib/labclient/users/memberships.rb,
lib/labclient/users/email/client.rb,
lib/labclient/users/delete_identity.rb
Overview
Constant Summary
Constants included
from AccessLevel
AccessLevel::HUMAN_ACCESS_LEVELS, AccessLevel::MACHINE_ACCESS_LEVELS
Instance Attribute Summary
Attributes inherited from Common
#client
Instance Method Summary
collapse
Methods inherited from Common
#api_methods, #api_methods_help, #format_id, #format_query_id, #format_query_ids, #format_time?, #group_name, #help, #initialize, #inspect, #klass, #protected_query_access_level, #query_access_level, #query_format_time
Methods included from Docs
#demo, #desc, #doc, docs, #example, #group_name, #help, json, #markdown, #navigation, #option, #result, #subtitle, #title
#human_access_level, #human_protected_access_level, #machine_access_level, #machine_protected_access_level
Instance Method Details
#activate(user_id) ⇒ Object
19
20
21
22
23
|
# File 'lib/labclient/users/activate.rb', line 19
def activate(user_id)
user_id = format_id(user_id)
client.request(:post, "users/#{user_id}/activate")
end
|
#activity(from_date) ⇒ Object
17
18
19
20
21
|
# File 'lib/labclient/users/activity.rb', line 17
def activity(from_date)
query = { from: from_date }
query_format_time(query, :from)
client.request(:get, 'user/activities', nil, query)
end
|
#block(user_id) ⇒ Object
19
20
21
22
23
|
# File 'lib/labclient/users/block.rb', line 19
def block(user_id)
user_id = format_id(user_id)
client.request(:post, "users/#{user_id}/block")
end
|
#counts ⇒ Object
12
13
14
|
# File 'lib/labclient/users/counts.rb', line 12
def counts
client.request(:get, 'user_counts')
end
|
#create(query) ⇒ Object
21
22
23
|
# File 'lib/labclient/users/create.rb', line 21
def create(query)
client.request(:post, 'users', User, query)
end
|
#current(sudo_id = nil) ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/labclient/users/current.rb', line 19
def current(sudo_id = nil)
if sudo_id
sudo_id = format_id(sudo_id)
client.request(:get, 'user', User, sudo: sudo_id)
else
client.request(:get, 'user', User)
end
end
|
#deactivate(user_id) ⇒ Object
19
20
21
22
23
|
# File 'lib/labclient/users/deactivate.rb', line 19
def deactivate(user_id)
user_id = format_id(user_id)
client.request(:post, "users/#{user_id}/deactivate")
end
|
#delete(user_id) ⇒ Object
23
24
25
26
|
# File 'lib/labclient/users/delete.rb', line 23
def delete(user_id)
user_id = format_id(user_id)
client.request(:delete, "users/#{user_id}")
end
|
#delete_identity(user_id, provider) ⇒ Object
20
21
22
23
|
# File 'lib/labclient/users/delete_identity.rb', line 20
def delete_identity(user_id, provider)
user_id = format_id(user_id)
client.request(:delete, "users/#{user_id}/identities/#{provider}")
end
|
#emails ⇒ Object
14
15
16
|
# File 'lib/labclient/users/email/client.rb', line 14
def emails
UserEmails.new(client)
end
|
#gpg_keys ⇒ Object
14
15
16
|
# File 'lib/labclient/users/gpg/client.rb', line 14
def gpg_keys
UserGpgKeys.new(client)
end
|
#keys ⇒ Object
14
15
16
|
# File 'lib/labclient/users/keys/client.rb', line 14
def keys
UserKeys.new(client)
end
|
#list(query = {}) ⇒ Object
60
61
62
|
# File 'lib/labclient/users/list.rb', line 60
def list(query = {})
client.request(:get, 'users', User, query)
end
|
#memberships(user_id, type = nil) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/labclient/users/memberships.rb', line 31
def memberships(user_id, type = nil)
user_id = format_id(user_id)
query = nil
query = { type: type } if type
client.request(:get, "users/#{user_id}/memberships", Membership, query)
end
|
#search(search_string = '') ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/labclient/users/search.rb', line 14
def search(search_string = '')
query = {
scope: :users,
search: search_string
}
client.request(:get, 'search', User, query)
end
|
#show(user_id) ⇒ Object
17
18
19
20
|
# File 'lib/labclient/users/show.rb', line 17
def show(user_id)
user_id = format_id(user_id)
client.request(:get, "users/#{user_id}", User)
end
|
#status(user_id = nil) ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'lib/labclient/users/status.rb', line 17
def status(user_id = nil)
if user_id
user_id = format_id(user_id)
client.request(:get, "users/#{user_id}/status")
else
client.request(:get, 'user/status')
end
end
|
#status_set(query) ⇒ Object
19
20
21
|
# File 'lib/labclient/users/status_set.rb', line 19
def status_set(query)
client.request(:put, 'user/status', nil, query)
end
|
#unblock(user_id) ⇒ Object
19
20
21
22
23
|
# File 'lib/labclient/users/unblock.rb', line 19
def unblock(user_id)
user_id = format_id(user_id)
client.request(:post, "users/#{user_id}/unblock")
end
|
#update(user_id, query) ⇒ Object
23
24
25
26
|
# File 'lib/labclient/users/update.rb', line 23
def update(user_id, query)
user_id = format_id(user_id)
client.request(:put, "users/#{user_id}", User, query)
end
|