Class: Brivo::Group
- Inherits:
-
Object
- Object
- Brivo::Group
- Defined in:
- lib/brivo/group.rb
Class Attribute Summary collapse
-
.application ⇒ Object
Returns the value of attribute application.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #assign_user(user_id) ⇒ Object
- #delete ⇒ Object
-
#initialize(attributes = {}) ⇒ Group
constructor
A new instance of Group.
- #remove_user(user_id) ⇒ Object
- #users ⇒ Object
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
.application ⇒ Object
Returns the value of attribute application.
7 8 9 |
# File 'lib/brivo/group.rb', line 7 def application @application end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/brivo/group.rb', line 5 def id @id end |
#name ⇒ Object (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 |
#delete ⇒ Object
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 |
#users ⇒ Object
23 24 25 |
# File 'lib/brivo/group.rb', line 23 def users application.group_users(id) end |