Class: LabClient::User

Inherits:
Klass show all
Includes:
ClassHelpers
Defined in:
lib/labclient/users/user.rb

Overview

Inspect Helper

Instance Attribute Summary

Attributes inherited from Klass

#client

Attributes inherited from LabStruct

#response, #table

Instance Method Summary collapse

Methods included from ClassHelpers

#has?, #raw

Methods inherited from Klass

#api_methods, #collect_project_id, #collect_release_id, #collect_repository_id, date_time_attrs, #format_time?, #group_name, #help, #initialize, #klass, #quiet?, #success?, #to_json, #update_self, user_attrs, #valid_group_project_levels, #verbose

Methods included from Docs

#demo, #desc, #doc, docs, #example, #group_name, #help, json, #markdown, #navigation, #option, #result, #subtitle, #title

Methods included from CurlHelper

#curl

Methods included from Logger

#logger, logger, logger_setup

Methods inherited from LabStruct

#[], #[]=, #as_json, #client, #initialize, #key?, #method_missing, #respond_to_missing?, #slice, #success?, #to_h

Constructor Details

This class inherits a constructor from LabClient::Klass

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class LabClient::LabStruct

Instance Method Details

#activateObject



81
82
83
# File 'lib/labclient/users/user.rb', line 81

def activate
  client.users.activate(id)
end

#active?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/labclient/users/user.rb', line 85

def active?
  state == 'active'
end

#blockObject



73
74
75
# File 'lib/labclient/users/user.rb', line 73

def block
  client.users.block(id)
end

#deactivateObject



93
94
95
# File 'lib/labclient/users/user.rb', line 93

def deactivate
  client.users.deactivate(id)
end

#deleteObject



25
26
27
# File 'lib/labclient/users/user.rb', line 25

def delete
  client.users.delete(id)
end

#delete_identity(provider) ⇒ Object



29
30
31
# File 'lib/labclient/users/user.rb', line 29

def delete_identity(provider)
  client.users.delete_identity(id, provider)
end

#email_create(email_address) ⇒ Object



65
66
67
# File 'lib/labclient/users/user.rb', line 65

def email_create(email_address)
  client.users.emails.create(email_address, id)
end

#email_delete(email_id) ⇒ Object



69
70
71
# File 'lib/labclient/users/user.rb', line 69

def email_delete(email_id)
  client.users.emails.delete(email_id, id)
end

#emailsObject



61
62
63
# File 'lib/labclient/users/user.rb', line 61

def emails
  client.users.emails.list(id)
end

#events(query = {}) ⇒ Object

Events



118
119
120
# File 'lib/labclient/users/user.rb', line 118

def events(query = {})
  client.events.user(id, body: query)
end

#gpg_key_create(key_data) ⇒ Object



53
54
55
# File 'lib/labclient/users/user.rb', line 53

def gpg_key_create(key_data)
  client.users.gpg_keys.create(key_data, id)
end

#gpg_key_delete(key_id) ⇒ Object



57
58
59
# File 'lib/labclient/users/user.rb', line 57

def gpg_key_delete(key_id)
  client.users.gpg_keys.delete(key_id, id)
end

#gpg_keysObject



49
50
51
# File 'lib/labclient/users/user.rb', line 49

def gpg_keys
  client.users.gpg_keys.list(id)
end

#impersonation_token(token_id) ⇒ Object



109
110
111
# File 'lib/labclient/users/user.rb', line 109

def impersonation_token(token_id)
  client.impersonation_tokens.show(id, token_id)
end

#impersonation_tokens(filter = :all) ⇒ Object



97
98
99
# File 'lib/labclient/users/user.rb', line 97

def impersonation_tokens(filter = :all)
  client.impersonation_tokens.list(id, filter)
end

#impersonation_tokens_create(query) ⇒ Object



101
102
103
# File 'lib/labclient/users/user.rb', line 101

def impersonation_tokens_create(query)
  client.impersonation_tokens.create(id, body: query)
end

#impersonation_tokens_revoke(token_id) ⇒ Object



105
106
107
# File 'lib/labclient/users/user.rb', line 105

def impersonation_tokens_revoke(token_id)
  client.impersonation_tokens.revoke(id, token_id)
end

#inactive?Boolean

Returns:

  • (Boolean)


89
90
91
# File 'lib/labclient/users/user.rb', line 89

def inactive?
  state == 'inactive'
end

#inspectObject



7
8
9
# File 'lib/labclient/users/user.rb', line 7

def inspect
  "#<User id: #{id}, username: #{username}>"
end

#key_create(query) ⇒ Object



41
42
43
# File 'lib/labclient/users/user.rb', line 41

def key_create(query)
  client.users.keys.create(query, id)
end

#key_delete(key_id) ⇒ Object



45
46
47
# File 'lib/labclient/users/user.rb', line 45

def key_delete(key_id)
  client.users.keys.delete(key_id, id)
end

#keysObject



37
38
39
# File 'lib/labclient/users/user.rb', line 37

def keys
  client.users.keys.list(id)
end

#memberships(type = nil) ⇒ Object



113
114
115
# File 'lib/labclient/users/user.rb', line 113

def memberships(type = nil)
  client.users.memberships(id, type)
end

#projects(query = {}) ⇒ Object



13
14
15
# File 'lib/labclient/users/user.rb', line 13

def projects(query = {})
  client.projects.user(id, body: query)
end

#reloadObject

Reload Helper



123
124
125
# File 'lib/labclient/users/user.rb', line 123

def reload
  update_self client.users.show(id)
end

#starred(query = {}) ⇒ Object



17
18
19
# File 'lib/labclient/users/user.rb', line 17

def starred(query = {})
  client.projects.user(id, body: query)
end

#statusObject



33
34
35
# File 'lib/labclient/users/user.rb', line 33

def status
  client.users.status(id)
end

#unblockObject



77
78
79
# File 'lib/labclient/users/user.rb', line 77

def unblock
  client.users.unblock(id)
end

#update(query = {}) ⇒ Object



21
22
23
# File 'lib/labclient/users/user.rb', line 21

def update(query = {})
  update_self client.users.update(id, body: query)
end