Class: Pingdom::TMSSummary::Outage
- Defined in:
- lib/pingdom/tms_summary/outage.rb
Overview
summary.outage
{"actual_timefrom"=>1500000005,"revision"=>12345,"status"=>"up",
"timefrom"=>0,"timeto"=>1500005000
]}
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
9 10 11 12 13 14 |
# File 'lib/pingdom/tms_summary/outage.rb', line 9 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
#actual_timefrom ⇒ Object
28 29 30 |
# File 'lib/pingdom/tms_summary/outage.rb', line 28 def actual_timefrom Time.at(@attributes["actual_timefrom"]) end |
#downtime ⇒ Object
16 17 18 |
# File 'lib/pingdom/tms_summary/outage.rb', line 16 def downtime (@attributes["timeto"] - @attributes["timefrom"]).seconds end |
#timefrom ⇒ Object
20 21 22 |
# File 'lib/pingdom/tms_summary/outage.rb', line 20 def timefrom Time.at(@attributes["timefrom"]) end |
#timeto ⇒ Object
24 25 26 |
# File 'lib/pingdom/tms_summary/outage.rb', line 24 def timeto Time.at(@attributes["timeto"]) end |