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.
-
#assignee ⇒ Object
readonly
Returns the value of attribute assignee.
-
#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.
-
#deploy ⇒ Object
readonly
Returns the value of attribute deploy.
-
#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.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
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
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/honeybadger-api/fault.rb', line 14 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]) @url = opts[:url] if opts[:assignee] @assignee = User.new(opts[:assignee][:name], opts[:assignee][:email]) end = opts[:tags] @deploy = Deploy.new(opts[:deploy]) unless opts[:deploy].nil? 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 |
#assignee ⇒ Object (readonly)
Returns the value of attribute assignee.
5 6 7 |
# File 'lib/honeybadger-api/fault.rb', line 5 def assignee @assignee 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 |
#deploy ⇒ Object (readonly)
Returns the value of attribute deploy.
5 6 7 |
# File 'lib/honeybadger-api/fault.rb', line 5 def deploy @deploy 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 |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
5 6 7 |
# File 'lib/honeybadger-api/fault.rb', line 5 def end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/honeybadger-api/fault.rb', line 5 def url @url end |
Class Method Details
.all(project_id) ⇒ Object
Public: Find all faults for a given project.
47 48 49 50 |
# File 'lib/honeybadger-api/fault.rb', line 47 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.
59 60 61 62 |
# File 'lib/honeybadger-api/fault.rb', line 59 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.
65 66 67 |
# File 'lib/honeybadger-api/fault.rb', line 65 def self.handler Proc.new { |response| Fault.new(response) } end |
.paginate(project_id, filters = {}) ⇒ Object
Public: Paginate all faults for a given project.
53 54 55 56 |
# File 'lib/honeybadger-api/fault.rb', line 53 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.
37 38 39 |
# File 'lib/honeybadger-api/fault.rb', line 37 def ignored? @ignored == true end |
#resolved? ⇒ Boolean
Public: Whether tha fault has been marked as resolved.
42 43 44 |
# File 'lib/honeybadger-api/fault.rb', line 42 def resolved? @resolved == true end |