Class: Usergroups
- Inherits:
-
Base
show all
- Defined in:
- lib/zapix/proxies/usergroups.rb
Defined Under Namespace
Classes: NonExistingUsergroup
Instance Attribute Summary
Attributes inherited from Base
#client
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Constructor Details
This class inherits a constructor from Base
Instance Method Details
#create(options) ⇒ Object
5
6
7
|
# File 'lib/zapix/proxies/usergroups.rb', line 5
def create(options)
client.usergroup_create(options) unless exists?(options)
end
|
#delete(*group_ids) ⇒ Object
23
24
25
|
# File 'lib/zapix/proxies/usergroups.rb', line 23
def delete(*group_ids)
client.usergroup_delete(group_ids)
end
|
#exists?(options) ⇒ Boolean
9
10
11
|
# File 'lib/zapix/proxies/usergroups.rb', line 9
def exists?(options)
client.usergroup_exists(options)
end
|
#get_id(options) ⇒ Object
13
14
15
16
17
18
19
20
21
|
# File 'lib/zapix/proxies/usergroups.rb', line 13
def get_id(options)
if(exists?(options))
result = client.usergroup_get({
'filter' => {'name' => options['name']}})
result.first['usrgrpid']
else
raise NonExistingUsergroup, "Usergroup #{options['name']} does not exist !"
end
end
|