Class: RZabbix::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rzabbix/base.rb

Direct Known Subclasses

Host, HostGroup, Template

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Base

Returns a new instance of Base.



20
21
22
23
# File 'lib/rzabbix/base.rb', line 20

def initialize(attributes)
  super()
  self.attributes = self.class.default_attributes.merge(attributes)
end

Instance Attribute Details

#attributesObject

Instance methods



18
19
20
# File 'lib/rzabbix/base.rb', line 18

def attributes
  @attributes
end

Class Method Details

.perform_request(*args) ⇒ Object



10
11
12
# File 'lib/rzabbix/base.rb', line 10

def self.perform_request(*args)
  Connection.perform_request(*args)
end

Instance Method Details

#[](key) ⇒ Object



25
26
27
# File 'lib/rzabbix/base.rb', line 25

def [](key)
  self.attributes[key.to_sym]
end

#to_hashObject



33
34
35
# File 'lib/rzabbix/base.rb', line 33

def to_hash
  self.attributes
end

#to_json(*args) ⇒ Object



29
30
31
# File 'lib/rzabbix/base.rb', line 29

def to_json(*args)
  self.attributes.to_json(*args)
end