Class: Interface
- Inherits:
-
Object
- Object
- Interface
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/zapix/zabbix_classes/interface.rb
Instance Attribute Summary collapse
-
#dns ⇒ Object
readonly
Returns the value of attribute dns.
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
-
#main ⇒ Object
readonly
Returns the value of attribute main.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#useip ⇒ Object
readonly
Returns the value of attribute useip.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Interface
constructor
A new instance of Interface.
- #read_attribute_for_validation(key) ⇒ Object
- #to_hash ⇒ Object
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
#dns ⇒ Object (readonly)
Returns the value of attribute dns.
6 7 8 |
# File 'lib/zapix/zabbix_classes/interface.rb', line 6 def dns @dns end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
6 7 8 |
# File 'lib/zapix/zabbix_classes/interface.rb', line 6 def ip @ip end |
#main ⇒ Object (readonly)
Returns the value of attribute main.
6 7 8 |
# File 'lib/zapix/zabbix_classes/interface.rb', line 6 def main @main end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
6 7 8 |
# File 'lib/zapix/zabbix_classes/interface.rb', line 6 def port @port end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/zapix/zabbix_classes/interface.rb', line 6 def type @type end |
#useip ⇒ Object (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_hash ⇒ Object
38 39 40 |
# File 'lib/zapix/zabbix_classes/interface.rb', line 38 def to_hash @result end |