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