Class: Pingdom::SummaryAverage

Inherits:
Base
  • Object
show all
Defined in:
lib/pingdom/summary_average.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

#probe_responsesObject

Returns the value of attribute probe_responses.



32
33
34
# File 'lib/pingdom/summary_average.rb', line 32

def probe_responses
  @probe_responses
end

#responsetimeObject

Returns the value of attribute responsetime.



32
33
34
# File 'lib/pingdom/summary_average.rb', line 32

def responsetime
  @responsetime
end

Class Method Details

.collection_typeObject



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

def collection_type
  'summary'
end

.pathObject



11
12
13
# File 'lib/pingdom/summary_average.rb', line 11

def path
  '/summary.average'
end

.permitObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/pingdom/summary_average.rb', line 19

def permit
  {
    to: :valid_time?,
    from: :valid_time?,
    probes: :valid_int_list?,
    includeuptime: :valid_boolean?,
    bycountry: :valid_boolean?,
    byprobe: :valid_boolean?
  }
end

Instance Method Details

#avgresponseObject



34
35
36
37
38
39
40
41
# File 'lib/pingdom/summary_average.rb', line 34

def avgresponse
  data = responsetime['avgresponse']

  data.map! do |v|
    Struct::AvgResponse.new(v['countryiso'], v['avgresponse'])
  end  if data.is_a?(Array)
  data
end

#fromObject



59
60
61
# File 'lib/pingdom/summary_average.rb', line 59

def from
  Time.at responsetime['from']
end

#statusObject



47
48
49
# File 'lib/pingdom/summary_average.rb', line 47

def status
  @status
end

#status=(v) ⇒ Object



43
44
45
# File 'lib/pingdom/summary_average.rb', line 43

def status= v
  @status=Struct::AverageStatus.new(v['totalup'],v['totaldown'],v['totalunknown'])
end

#toObject



63
64
65
# File 'lib/pingdom/summary_average.rb', line 63

def to
  Time.at responsetime['to']
end