Class: Pingdom::SummaryOutage

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

Instance Attribute Summary collapse

Attributes inherited from Base

#additional_field

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#add, all, body, client, collection, error?, find, #get, #initialize, limited, params, params=, parse, status, total, update_client

Constructor Details

This class inherits a constructor from Pingdom::Base

Instance Attribute Details

#statesObject

Returns the value of attribute states.



31
32
33
# File 'lib/pingdom/summary_outage.rb', line 31

def states
  @states
end

Class Method Details

.collection_typeObject



17
18
19
# File 'lib/pingdom/summary_outage.rb', line 17

def collection_type
  'summary'
end

.pathObject



13
14
15
# File 'lib/pingdom/summary_outage.rb', line 13

def path
  '/summary.outage'
end

.permitObject



21
22
23
24
25
26
27
# File 'lib/pingdom/summary_outage.rb', line 21

def permit
  {
    from: :valid_time?,
    to: :valid_time?,
    order: :valid_order?
  }
end

Instance Method Details

#downs(min_interval: 0) ⇒ Object



46
47
48
# File 'lib/pingdom/summary_outage.rb', line 46

def downs min_interval: 0
  states.count { |s| s.status == 'down' and s.interval > min_interval }
end

#ups(min_interval: 0) ⇒ Object



42
43
44
# File 'lib/pingdom/summary_outage.rb', line 42

def ups min_interval: 0
  states.count { |s| s.status == 'up' and s.interval > min_interval }
end