Class: Honeybadger::Api::UptimeCheck
- Inherits:
-
Object
- Object
- Honeybadger::Api::UptimeCheck
- Defined in:
- lib/honeybadger-api/uptime_check.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#up ⇒ Object
readonly
Returns the value of attribute up.
Class Method Summary collapse
-
.all(project_id, site_id) ⇒ Object
Public: Find all uptime checks for a given project and site.
-
.handler ⇒ Object
Internal: The handler used to build objects from API responses.
-
.paginate(project_id, site_id, filters = {}) ⇒ Object
Public: Paginate all uptime checks for a given project and site.
Instance Method Summary collapse
-
#initialize(opts) ⇒ UptimeCheck
constructor
Public: Build a new instance of UptimeCheck.
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_at ⇒ Object (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 |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
5 6 7 |
# File 'lib/honeybadger-api/uptime_check.rb', line 5 def duration @duration end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
5 6 7 |
# File 'lib/honeybadger-api/uptime_check.rb', line 5 def location @location end |
#up ⇒ Object (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 |
.handler ⇒ Object
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 |