Class: Pingdom::Summary::Outage

Inherits:
Base
  • Object
show all
Defined in:
lib/pingdom/summary/outage.rb

Overview

summary.outage “timefrom”=>1297475316, “status”=>“up”,

{"timeto"=>1297587906, "timefrom"=>1297587576, "status"=>"down"},
{"timeto"=>1298110749, "timefrom"=>1297587906, "status"=>"up"}]}

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

attributes, check_error!, #id, #initialize, #inspect, #method_missing, #respond_to?, #respond_to_missing?

Constructor Details

This class inherits a constructor from Pingdom::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Pingdom::Base

Class Method Details

.parse(client, response) ⇒ Object



8
9
10
11
12
13
# File 'lib/pingdom/summary/outage.rb', line 8

def self.parse(client, response)
  super["summary"]["states"].select { |s| s["status"] == "down" }.
    map do |outage|
    new(client, response, outage)
  end
end

Instance Method Details

#downtimeObject



15
16
17
# File 'lib/pingdom/summary/outage.rb', line 15

def downtime
  (@attributes["timeto"] - @attributes["timefrom"]).seconds
end

#timefromObject



19
20
21
# File 'lib/pingdom/summary/outage.rb', line 19

def timefrom
  Time.at(@attributes["timefrom"])
end

#timetoObject



23
24
25
# File 'lib/pingdom/summary/outage.rb', line 23

def timeto
  Time.at(@attributes["timeto"])
end