Class: Actions

Inherits:
Base
  • Object
show all
Defined in:
lib/zapix/proxies/actions.rb

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



13
14
15
# File 'lib/zapix/proxies/actions.rb', line 13

def create(options)
  client.action_create(options) unless exists?(options)
end

#delete(*action_ids) ⇒ Object



23
24
25
# File 'lib/zapix/proxies/actions.rb', line 23

def delete(*action_ids)
  client.action_delete(action_ids)
end

#exists?(options) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
10
11
# File 'lib/zapix/proxies/actions.rb', line 4

def exists?(options)
  result = client.action_get('filter' => { 'name' => options['name'] })
  if result.nil? || result.empty?
    return false
  else
    return true
  end
end

#get_id(options) ⇒ Object



17
18
19
20
21
# File 'lib/zapix/proxies/actions.rb', line 17

def get_id(options)
  result = client.action_get('filter' => { 'name' => options['name'] })

  result.first['actionid']
end