Class: Brivo::User

Inherits:
Object
  • Object
show all
Defined in:
lib/brivo/user.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ User

Returns a new instance of User.



14
15
16
17
18
19
20
# File 'lib/brivo/user.rb', line 14

def initialize attributes = {}
  @id = attributes['id']
  @first_name = attributes['firstName']
  @last_name = attributes['lastName']
  @external_id = attributes['externalId']
  @suspended = attributes['suspended']
end

Class Attribute Details

.applicationObject

Returns the value of attribute application.



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

def application
  @application
end

Instance Attribute Details

#external_idObject (readonly)

Returns the value of attribute external_id.



5
6
7
# File 'lib/brivo/user.rb', line 5

def external_id
  @external_id
end

#first_nameObject (readonly)

Returns the value of attribute first_name.



5
6
7
# File 'lib/brivo/user.rb', line 5

def first_name
  @first_name
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/brivo/user.rb', line 5

def id
  @id
end

#last_nameObject (readonly)

Returns the value of attribute last_name.



5
6
7
# File 'lib/brivo/user.rb', line 5

def last_name
  @last_name
end

#suspendedObject (readonly)

Returns the value of attribute suspended.



5
6
7
# File 'lib/brivo/user.rb', line 5

def suspended
  @suspended
end

Class Method Details

.create(first_name:, last_name:, external_id: nil, suspended: false) ⇒ Object



9
10
11
# File 'lib/brivo/user.rb', line 9

def create first_name:, last_name:, external_id: nil, suspended: false
  application.create_user(first_name, last_name, external_id, suspended)
end

Instance Method Details

#assign_credential(credential_id, effective_from, effective_to) ⇒ Object



34
35
36
# File 'lib/brivo/user.rb', line 34

def assign_credential credential_id, effective_from, effective_to
  application.user_assign_credential(id, credential_id, effective_from, effective_to)
end

#credentialsObject



30
31
32
# File 'lib/brivo/user.rb', line 30

def credentials
  application.user_credentials(id)
end

#deleteObject



22
23
24
# File 'lib/brivo/user.rb', line 22

def delete
  application.delete_user(id)
end

#groupsObject



26
27
28
# File 'lib/brivo/user.rb', line 26

def groups
  application.user_groups(id)
end

#remove_credential(credential_id) ⇒ Object



38
39
40
# File 'lib/brivo/user.rb', line 38

def remove_credential credential_id
  application.user_remove_credential(id, credential_id)
end