class Nagios::API::Downtime

Attributes

api_client[R]
host[R]
service[R]

Public Class Methods

new(args = {}) click to toggle source
Calls superclass method Nagios::API::Resource::new
# File lib/nagios/api/downtime.rb, line 5
def initialize(args = {})
  @service = args.delete(:service)
  @host = args.delete(:host)
  
  args['end_time'] = Time.at(args['end_time'].to_i)
  args['start_time'] = Time.at(args['start_time'].to_i)
  args['created_at'] = Time.at(args['entry_time'].to_i)
  
  super(args)
end

Public Instance Methods

cancel() click to toggle source
# File lib/nagios/api/downtime.rb, line 20
def cancel
  result = api_client.api.post("/cancel_downtime/#{id}", {})
  
  raise StandardError, "Unknown response canceling downtime: #{result}" unless result == "cancelled"
  
  true
end
id() click to toggle source
# File lib/nagios/api/downtime.rb, line 16
def id
  downtime_id
end