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

Returns:



35
36
37
38
# File 'lib/code42/user.rb', line 35

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

#blockObject



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

def block
  client.block_user(user_id: id)
end

#deleteObject



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

def delete
  client.delete_user(id)
end

#orgCode42::User

Returns the org associated with this user

Returns:



23
24
25
# File 'lib/code42/user.rb', line 23

def org
  client.org(org_id)
end

#rolesCode42::RoleCollection

Returns the roles associated with this user



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

def roles
  client.user_roles(id)
end

#unblockObject



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

def unblock
  client.unblock_user(user_id: id)
end