Class: Code42::User

Inherits:
Resource show all
Defined in:
lib/code42/user.rb

Instance Attribute Summary

Attributes inherited from Resource

#attributes, #client

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

attribute, collection_from_response, deserialize, deserialize_and_initialize, from_response, #initialize, serialize, #serialize, serializer

Constructor Details

This class inherits a constructor from Code42::Resource

Class Method Details

.create(attributes) ⇒ Object



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

def self.create(attributes)
  client.create_user(attributes)
end

Instance Method Details

#assign_role(attrs = {}) ⇒ Code42::Role

Assigns a role to this user



39
40
41
42
# File 'lib/code42/user.rb', line 39

def assign_role(attrs = {})
  attrs.merge!(user_id: id)
  client.assign_role(attrs)
end

#blockObject



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

def block
  client.block_user(user_id: id)
end

#deleteObject



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

def delete
  client.delete_user(id)
end

#orgCode42::User

Returns the org associated with this user



27
28
29
# File 'lib/code42/user.rb', line 27

def org
  client.org(org_id)
end

#rolesCode42::RoleCollection

Returns the roles associated with this user



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

def roles
  client.user_roles(id)
end

#unblockObject



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

def unblock
  client.unblock_user(user_id: id)
end

#update(attributes) ⇒ Object



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

def update(attributes)
  client.update_user(id, attributes)
end