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



5
6
7
# File 'lib/zapix/proxies/hostinterfaces.rb', line 5

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

#exists?(options) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#get(options) ⇒ Object



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

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