Class: Honeybadger::Api::Outage
- Inherits:
-
Object
- Object
- Honeybadger::Api::Outage
- Defined in:
- lib/honeybadger-api/outage.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#down_at ⇒ Object
readonly
Returns the value of attribute down_at.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#up_at ⇒ Object
readonly
Returns the value of attribute up_at.
Class Method Summary collapse
-
.all(project_id, site_id) ⇒ Object
Public: Find all outages 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 outages for a given project and site.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Outage
constructor
Public: Build a new instance of Outage.
Constructor Details
#initialize(opts) ⇒ Outage
Public: Build a new instance of Outage
opts - A Hash of attributes to initialize an Outage
Returns a new Outage
12 13 14 15 16 17 18 19 |
# File 'lib/honeybadger-api/outage.rb', line 12 def initialize(opts) @down_at = opts[:down_at].nil? ? nil : DateTime.parse(opts[:down_at]) @up_at = opts[:up_at].nil? ? nil : DateTime.parse(opts[:up_at]) @created_at = opts[:created_at].nil? ? nil : DateTime.parse(opts[:created_at]) @status = opts[:status] @reason = opts[:reason] @headers = opts[:headers] end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
5 6 7 |
# File 'lib/honeybadger-api/outage.rb', line 5 def created_at @created_at end |
#down_at ⇒ Object (readonly)
Returns the value of attribute down_at.
5 6 7 |
# File 'lib/honeybadger-api/outage.rb', line 5 def down_at @down_at end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
5 6 7 |
# File 'lib/honeybadger-api/outage.rb', line 5 def headers @headers end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
5 6 7 |
# File 'lib/honeybadger-api/outage.rb', line 5 def reason @reason end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/honeybadger-api/outage.rb', line 5 def status @status end |
#up_at ⇒ Object (readonly)
Returns the value of attribute up_at.
5 6 7 |
# File 'lib/honeybadger-api/outage.rb', line 5 def up_at @up_at end |
Class Method Details
.all(project_id, site_id) ⇒ Object
Public: Find all outages for a given project and site.
22 23 24 25 |
# File 'lib/honeybadger-api/outage.rb', line 22 def self.all(project_id, site_id) path = "projects/#{project_id}/sites/#{site_id}/outages" Honeybadger::Api::Request.all(path, handler) end |
.handler ⇒ Object
Internal: The handler used to build objects from API responses.
34 35 36 |
# File 'lib/honeybadger-api/outage.rb', line 34 def self.handler Proc.new { |response| Outage.new(response) } end |
.paginate(project_id, site_id, filters = {}) ⇒ Object
Public: Paginate all outages for a given project and site.
28 29 30 31 |
# File 'lib/honeybadger-api/outage.rb', line 28 def self.paginate(project_id, site_id, filters = {}) path = "projects/#{project_id}/sites/#{site_id}/outages" Honeybadger::Api::Request.paginate(path, handler, filters) end |