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.



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

def probe_responses
  @probe_responses
end

#responsetimeObject

Returns the value of attribute responsetime.



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

def responsetime
  @responsetime
end

#statusObject

Returns the value of attribute status.



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

def status
  @status
end

Class Method Details

.collection_typeObject



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

def collection_type
  'summary'
end

.pathObject



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

def path
  '/summary.average'
end

.permitObject



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

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



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

def avgresponse
  data = responsetime['avgresponse'] || []
  data.map do |v|
    Struct::AvgResponse.new(v['countryiso'], v['avgresponse'])
  end
end

#fromObject



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

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

#toObject



51
52
53
# File 'lib/pingdom/summary_average.rb', line 51

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