Class: Interface

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/zapix/zabbix_classes/interface.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Interface

Returns a new instance of Interface.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/zapix/zabbix_classes/interface.rb', line 17

def initialize(attributes)
  @type = attributes['type'] ||= 1
  @main = attributes['main'] ||= 1
  @useip = attributes['useip'] ||= 1
  @ip = attributes['ip'] = attributes['ip']
  @dns = attributes['dns'] = attributes['dns']
  @port = attributes['port'] = attributes['port'] ||= 10050
  @result = {
    'type' => type,
    'main' => main,
    'useip' => useip,
    'ip' => ip,
    'dns' => dns,
    'port' => port
  }
end

Instance Attribute Details

#dnsObject (readonly)

Returns the value of attribute dns.



6
7
8
# File 'lib/zapix/zabbix_classes/interface.rb', line 6

def dns
  @dns
end

#ipObject (readonly)

Returns the value of attribute ip.



6
7
8
# File 'lib/zapix/zabbix_classes/interface.rb', line 6

def ip
  @ip
end

#mainObject (readonly)

Returns the value of attribute main.



6
7
8
# File 'lib/zapix/zabbix_classes/interface.rb', line 6

def main
  @main
end

#portObject (readonly)

Returns the value of attribute port.



6
7
8
# File 'lib/zapix/zabbix_classes/interface.rb', line 6

def port
  @port
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/zapix/zabbix_classes/interface.rb', line 6

def type
  @type
end

#useipObject (readonly)

Returns the value of attribute useip.



6
7
8
# File 'lib/zapix/zabbix_classes/interface.rb', line 6

def useip
  @useip
end

Instance Method Details

#read_attribute_for_validation(key) ⇒ Object



34
35
36
# File 'lib/zapix/zabbix_classes/interface.rb', line 34

def read_attribute_for_validation(key)
  send(key)
end

#to_hashObject



38
39
40
# File 'lib/zapix/zabbix_classes/interface.rb', line 38

def to_hash
  @result
end