Class: Brivo::Group

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

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Group

Returns a new instance of Group.



14
15
16
17
# File 'lib/brivo/group.rb', line 14

def initialize attributes = {}
  @id = attributes['id']
  @name = attributes['name']
end

Class Attribute Details

.applicationObject

Returns the value of attribute application.



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

def application
  @application
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Class Method Details

.create(name:) ⇒ Object



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

def create name:
  application.create_group(name)
end

Instance Method Details

#assign_user(user_id) ⇒ Object



27
28
29
# File 'lib/brivo/group.rb', line 27

def assign_user user_id
  application.group_assign_user(id, user_id)
end

#deleteObject



19
20
21
# File 'lib/brivo/group.rb', line 19

def delete
  application.delete_group(id)
end

#remove_user(user_id) ⇒ Object



31
32
33
# File 'lib/brivo/group.rb', line 31

def remove_user user_id
  application.group_remove_user(id, user_id)
end

#usersObject



23
24
25
# File 'lib/brivo/group.rb', line 23

def users
  application.group_users(id)
end