Class: Hostinterfaces

Inherits:
Base
  • Object
show all
Defined in:
lib/zapix/proxies/hostinterfaces.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/hostinterfaces.rb', line 4

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

#exists?(options) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/zapix/proxies/hostinterfaces.rb', line 8

def exists?(options)
  get(options).empty? ? false : true
end

#get(options) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/zapix/proxies/hostinterfaces.rb', line 12

def get(options)
  client.hostinterface_get(
    'filter' => { 'hostid' => options['hostid'],
                  'port' => options['port'],
                  'type' => options['type'] },
    'output' => 'extend'
  )
end