Class: Honeybadger::Api::UptimeCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/honeybadger-api/uptime_check.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ UptimeCheck

Public: Build a new instance of UptimeCheck

opts - A Hash of attributes to initialize a UptimeCheck

Returns a new UptimeCheck



12
13
14
15
16
17
# File 'lib/honeybadger-api/uptime_check.rb', line 12

def initialize(opts)
  @up = opts[:up]
  @location = opts[:location]
  @duration = opts[:duration]
  @created_at = opts[:created_at].nil? ? nil : DateTime.parse(opts[:created_at])
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



5
6
7
# File 'lib/honeybadger-api/uptime_check.rb', line 5

def created_at
  @created_at
end

#durationObject (readonly)

Returns the value of attribute duration.



5
6
7
# File 'lib/honeybadger-api/uptime_check.rb', line 5

def duration
  @duration
end

#locationObject (readonly)

Returns the value of attribute location.



5
6
7
# File 'lib/honeybadger-api/uptime_check.rb', line 5

def location
  @location
end

#upObject (readonly)

Returns the value of attribute up.



5
6
7
# File 'lib/honeybadger-api/uptime_check.rb', line 5

def up
  @up
end

Class Method Details

.all(project_id, site_id) ⇒ Object

Public: Find all uptime checks for a given project and site.



20
21
22
23
# File 'lib/honeybadger-api/uptime_check.rb', line 20

def self.all(project_id, site_id)
  path = "projects/#{project_id}/sites/#{site_id}/uptime_checks"
  Honeybadger::Api::Request.all(path, handler)
end

.handlerObject

Internal: The handler used to build objects from API responses.



32
33
34
# File 'lib/honeybadger-api/uptime_check.rb', line 32

def self.handler
  Proc.new { |response| UptimeCheck.new(response) }
end

.paginate(project_id, site_id, filters = {}) ⇒ Object

Public: Paginate all uptime checks for a given project and site.



26
27
28
29
# File 'lib/honeybadger-api/uptime_check.rb', line 26

def self.paginate(project_id, site_id, filters = {})
  path = "projects/#{project_id}/sites/#{site_id}/uptime_checks"
  Honeybadger::Api::Request.paginate(path, handler, filters)
end