Class: Honeybadger::Api::Fault
- Inherits:
-
Object
- Object
- Honeybadger::Api::Fault
- Defined in:
- lib/honeybadger-api/fault.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#comments_count ⇒ Object
readonly
Returns the value of attribute comments_count.
-
#component ⇒ Object
readonly
Returns the value of attribute component.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#last_notice_at ⇒ Object
readonly
Returns the value of attribute last_notice_at.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#notices_count ⇒ Object
readonly
Returns the value of attribute notices_count.
-
#project_id ⇒ Object
readonly
Returns the value of attribute project_id.
Class Method Summary collapse
-
.all(project_id) ⇒ Object
Public: Find all faults for a given project.
-
.find(project_id, fault_id) ⇒ Object
Public: Find a fault for a given project.
-
.handler ⇒ Object
Internal: The handler used to build objects from API responses.
-
.paginate(project_id, filters = {}) ⇒ Object
Public: Paginate all faults for a given project.
Instance Method Summary collapse
-
#ignored? ⇒ Boolean
Public: Whether tha fault has been marked as ignored.
-
#initialize(opts) ⇒ Fault
constructor
Public: Build a new instance of Fault.
-
#resolved? ⇒ Boolean
Public: Whether tha fault has been marked as resolved.
Constructor Details
#initialize(opts) ⇒ Fault
Public: Build a new instance of Fault
opts - A Hash of attributes to initialize a Fault
Returns a new Fault
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/honeybadger-api/fault.rb', line 13 def initialize(opts) @id = opts[:id] @project_id = opts[:project_id] @klass = opts[:klass] @action = opts[:action] @component = opts[:component] = opts[:message] @environment = opts[:environment] @ignored = opts[:ignored] @resolved = opts[:resolved] @notices_count = opts[:notices_count] @comments_count = opts[:comments_count] @last_notice_at = opts[:last_notice_at].nil? ? nil : DateTime.parse(opts[:last_notice_at]) @created_at = opts[:created_at].nil? ? nil : DateTime.parse(opts[:created_at]) end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
5 6 7 |
# File 'lib/honeybadger-api/fault.rb', line 5 def action @action end |
#comments_count ⇒ Object (readonly)
Returns the value of attribute comments_count.
5 6 7 |
# File 'lib/honeybadger-api/fault.rb', line 5 def comments_count @comments_count end |
#component ⇒ Object (readonly)
Returns the value of attribute component.
5 6 7 |
# File 'lib/honeybadger-api/fault.rb', line 5 def component @component end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
5 6 7 |
# File 'lib/honeybadger-api/fault.rb', line 5 def created_at @created_at end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
5 6 7 |
# File 'lib/honeybadger-api/fault.rb', line 5 def environment @environment end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/honeybadger-api/fault.rb', line 5 def id @id end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
5 6 7 |
# File 'lib/honeybadger-api/fault.rb', line 5 def klass @klass end |
#last_notice_at ⇒ Object (readonly)
Returns the value of attribute last_notice_at.
5 6 7 |
# File 'lib/honeybadger-api/fault.rb', line 5 def last_notice_at @last_notice_at end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
5 6 7 |
# File 'lib/honeybadger-api/fault.rb', line 5 def end |
#notices_count ⇒ Object (readonly)
Returns the value of attribute notices_count.
5 6 7 |
# File 'lib/honeybadger-api/fault.rb', line 5 def notices_count @notices_count end |
#project_id ⇒ Object (readonly)
Returns the value of attribute project_id.
5 6 7 |
# File 'lib/honeybadger-api/fault.rb', line 5 def project_id @project_id end |
Class Method Details
.all(project_id) ⇒ Object
Public: Find all faults for a given project.
40 41 42 43 |
# File 'lib/honeybadger-api/fault.rb', line 40 def self.all(project_id) path = "projects/#{project_id}/faults" Honeybadger::Api::Request.all(path, handler) end |
.find(project_id, fault_id) ⇒ Object
Public: Find a fault for a given project.
52 53 54 55 |
# File 'lib/honeybadger-api/fault.rb', line 52 def self.find(project_id, fault_id) path = "projects/#{project_id}/faults/#{fault_id}" Honeybadger::Api::Request.find(path, handler) end |
.handler ⇒ Object
Internal: The handler used to build objects from API responses.
58 59 60 |
# File 'lib/honeybadger-api/fault.rb', line 58 def self.handler Proc.new { |response| Fault.new(response) } end |
.paginate(project_id, filters = {}) ⇒ Object
Public: Paginate all faults for a given project.
46 47 48 49 |
# File 'lib/honeybadger-api/fault.rb', line 46 def self.paginate(project_id, filters = {}) path = "projects/#{project_id}/faults" Honeybadger::Api::Request.paginate(path, handler, filters) end |
Instance Method Details
#ignored? ⇒ Boolean
Public: Whether tha fault has been marked as ignored.
30 31 32 |
# File 'lib/honeybadger-api/fault.rb', line 30 def ignored? @ignored == true end |
#resolved? ⇒ Boolean
Public: Whether tha fault has been marked as resolved.
35 36 37 |
# File 'lib/honeybadger-api/fault.rb', line 35 def resolved? @resolved == true end |