Class: Users
- Inherits:
-
Base
- Object
- Base
- Users
- Defined in:
- lib/zapix/proxies/users.rb
Defined Under Namespace
Classes: NonExistingUser
Instance Method Summary collapse
- #create(options) ⇒ Object
- #delete(usergroup_ids) ⇒ Object
- #exists?(options) ⇒ Boolean
- #get_id(options) ⇒ Object
Instance Method Details
#create(options) ⇒ Object
4 5 6 |
# File 'lib/zapix/proxies/users.rb', line 4 def create() client.user_create() unless exists?() end |
#delete(usergroup_ids) ⇒ Object
21 22 23 |
# File 'lib/zapix/proxies/users.rb', line 21 def delete(usergroup_ids) client.user_delete(usergroup_ids) end |
#exists?(options) ⇒ Boolean
8 9 10 11 |
# File 'lib/zapix/proxies/users.rb', line 8 def exists?() result = client.user_get({'filter' => {'alias' => ['alias']}}) result.empty? ? false : true end |
#get_id(options) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/zapix/proxies/users.rb', line 13 def get_id() if(exists?()) client.user_get({'filter' => {'alias' => ['alias']}}).first['userid'] else raise NonExistingUser, "User #{['alias']} does not exist !" end end |