class Nagios::API::Hosts
Attributes
api_client[R]
Public Class Methods
new(args = {})
click to toggle source
# File lib/nagios/api/host.rb, line 5 def initialize(args = {}) @api_client = args[:api_client] @host_cache = {} end
Public Instance Methods
find(hostname)
click to toggle source
# File lib/nagios/api/host.rb, line 10 def find(hostname) return @host_cache[hostname] if @host_cache.has_key?(hostname) host = Host.new(api_client.api.query("/host/#{hostname}").merge(api_client: api_client)) @host_cache[hostname] = host host end
reload()
click to toggle source
# File lib/nagios/api/host.rb, line 18 def reload @host_cache = {} end