class Applications

Public Instance Methods

create(options) click to toggle source
# File lib/zapix/proxies/applications.rb, line 4
def create(options)
  client.application_create(options) unless exists?(options)
end
exists?(options) click to toggle source
# File lib/zapix/proxies/applications.rb, line 8
def exists?(options)
  result = client.application_get('filter' => { 'name' => options['name'] })
  if result.nil? || result.empty?
    false
  else
    true
  end
end
get_id(options) click to toggle source
# File lib/zapix/proxies/applications.rb, line 17
def get_id(options)
  if exists?(options)
    client.application_get('filter' => { 'name' => options['name'],
                                         'hostid' => options['hostid'] }).first['applicationid']
  else
    raise NonExistingApplication, "Application #{options['name']} does not exist !"
  end
end