Class: Scenarios
- Inherits:
-
Base
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.httptest_create(options) unless exists?(options)
end
|
#delete(options) ⇒ Object
13
14
15
|
# File 'lib/zapix/proxies/scenarios.rb', line 13
def delete(options)
client.httptest_delete(options)
end
|
#exists?(options) ⇒ Boolean
17
18
19
20
21
22
23
24
|
# File 'lib/zapix/proxies/scenarios.rb', line 17
def exists?(options)
result = client.httptest_get({
'countOutput' => true,
'filter' => {'name' => options['name'],
'hostid' => options['hostid']}})
result.to_i >= 1 ? true : false
end
|
31
32
33
|
# File 'lib/zapix/proxies/scenarios.rb', line 31
def (scenarios)
scenarios.map {|scenario| scenario['name']}
end
|
#get_all ⇒ Object
26
27
28
29
|
# File 'lib/zapix/proxies/scenarios.rb', line 26
def get_all
scenarios = client.httptest_get({'output' => 'extend'})
names = (scenarios)
end
|
#get_id(options) ⇒ Object
8
9
10
11
|
# File 'lib/zapix/proxies/scenarios.rb', line 8
def get_id(options)
client.httptest_get({
'filter' => {'name' => options['name'], 'hostid' => options['hostid']}}).first['httptestid']
end
|