Class: Scenarios

Inherits:
Base
  • Object
show all
Defined in:
lib/zapix/proxies/scenarios.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



4
5
6
# File 'lib/zapix/proxies/scenarios.rb', line 4

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

#delete(options) ⇒ Object



14
15
16
# File 'lib/zapix/proxies/scenarios.rb', line 14

def delete(options)
  client.webcheck_delete(options)
end

#exists?(options) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
# File 'lib/zapix/proxies/scenarios.rb', line 18

def exists?(options)
  result = client.webcheck_get({
    'countOutput' => true,
    'filter' => {'name' => options['name'],
    'hostid' => options['hostid']}})

  result.to_i >= 1 ? true : false
end

#get_id(options) ⇒ Object



8
9
10
11
12
# File 'lib/zapix/proxies/scenarios.rb', line 8

def get_id(options)
  client.webcheck_get({
    'filter' => {'name' => options['name'],
    'hostid' => options['hostid']}})
end