class Scenarios

Public Instance Methods

create(options) click to toggle source
# File lib/zapix/proxies/scenarios.rb, line 4
def create(options)
  client.httptest_create(options) unless exists?(options)
end
delete(options) click to toggle source
# File lib/zapix/proxies/scenarios.rb, line 12
def delete(options)
  client.httptest_delete(options)
end
exists?(options) click to toggle source
# 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
extract_names(scenarios) click to toggle source
# File lib/zapix/proxies/scenarios.rb, line 29
def extract_names(scenarios)
  scenarios.map { |scenario| scenario['name'] }
end
get_all() click to toggle source
# File lib/zapix/proxies/scenarios.rb, line 24
def get_all
  scenarios = client.httptest_get('output' => 'extend')
  names = extract_names(scenarios)
end
get_id(options) click to toggle source
# 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