Class: Nagios::API::State

Inherits:
Resource show all
Defined in:
lib/nagios/api/state.rb

Instance Attribute Summary

Attributes inherited from Resource

#api_client, #attributes

Instance Method Summary collapse

Methods inherited from Resource

#method_missing, #to_hash

Constructor Details

#initialize(args = {}) ⇒ State

Returns a new instance of State.



3
4
5
6
7
# File 'lib/nagios/api/state.rb', line 3

def initialize(args = {})
  super
  
  reload
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Nagios::API::Resource

Instance Method Details

#for_host(hostname) ⇒ Object



13
14
15
# File 'lib/nagios/api/state.rb', line 13

def for_host(hostname)
  data[hostname]
end

#reloadObject



9
10
11
# File 'lib/nagios/api/state.rb', line 9

def reload
  self.attributes = { :data => api_client.api.query("/state") }
end