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



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

def activate
  client.users.activate(id)
end

#active?Boolean

Returns:

  • (Boolean)


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

def active?
  state == 'active'
end

#blockObject



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

def block
  client.users.block(id)
end

#deactivateObject



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

def deactivate
  client.users.deactivate(id)
end

#deleteObject



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

def delete
  client.users.delete(id)
end

#delete_identity(provider) ⇒ Object



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

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

#email_create(email_address) ⇒ Object



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

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

#email_delete(email_id) ⇒ Object



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

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

#emailsObject



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

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

#events(query = {}) ⇒ Object

Events



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

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

#gpg_key_create(key_data) ⇒ Object



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

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

#gpg_key_delete(key_id) ⇒ Object



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

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

#gpg_keysObject



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

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

#impersonation_token(token_id) ⇒ Object



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

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

#impersonation_tokens(filter = :all) ⇒ Object



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

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

#impersonation_tokens_create(query) ⇒ Object



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

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

#impersonation_tokens_revoke(token_id) ⇒ Object



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

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

#inactive?Boolean

Returns:

  • (Boolean)


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

def inactive?
  state == 'inactive'
end

#inspectObject



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

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

#key_create(query) ⇒ Object



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

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

#key_delete(key_id) ⇒ Object



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

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

#keysObject



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

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

#memberships(type = nil) ⇒ Object



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

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

#projects(query = {}) ⇒ Object



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

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

#reloadObject

Reload Helper



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

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

#starred(query = {}) ⇒ Object



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

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

#statusObject



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

def status
  client.users.status(id)
end

#unblockObject



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

def unblock
  client.users.unblock(id)
end

#update(query = {}) ⇒ Object



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

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