Class: Honeybadger::Api::Comment
- Inherits:
-
Object
- Object
- Honeybadger::Api::Comment
- Defined in:
- lib/honeybadger-api/comment.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#fault_id ⇒ Object
readonly
Returns the value of attribute fault_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#notices_count ⇒ Object
readonly
Returns the value of attribute notices_count.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
-
.all(project_id, fault_id) ⇒ Object
Public: Find all comments on a fault for a project.
-
.find(project_id, fault_id, comment_id) ⇒ Object
Public: Find a comment on a fault for a project.
-
.handler ⇒ Object
Internal: The handler used to build objects from API responses.
-
.paginate(project_id, fault_id, filters = {}) ⇒ Object
Public: Paginate all comments on a fault for a project.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Comment
constructor
Public: Build a new instance of Comment.
Constructor Details
#initialize(opts) ⇒ Comment
Public: Build a new instance of Comment
opts - A Hash of attributes to initialize a Comment
Returns a new Comment
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/honeybadger-api/comment.rb', line 12 def initialize(opts) @id = opts[:id] @fault_id = opts[:fault_id] @event = opts[:event] @source = opts[:source] @notices_count = opts[:notices_count] @author = opts[:author] @body = opts[:body] @email = opts[:email] @created_at = opts[:created_at].nil? ? nil : DateTime.parse(opts[:created_at]) end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
5 6 7 |
# File 'lib/honeybadger-api/comment.rb', line 5 def @author end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
5 6 7 |
# File 'lib/honeybadger-api/comment.rb', line 5 def body @body end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
5 6 7 |
# File 'lib/honeybadger-api/comment.rb', line 5 def created_at @created_at end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
5 6 7 |
# File 'lib/honeybadger-api/comment.rb', line 5 def email @email end |
#event ⇒ Object (readonly)
Returns the value of attribute event.
5 6 7 |
# File 'lib/honeybadger-api/comment.rb', line 5 def event @event end |
#fault_id ⇒ Object (readonly)
Returns the value of attribute fault_id.
5 6 7 |
# File 'lib/honeybadger-api/comment.rb', line 5 def fault_id @fault_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/honeybadger-api/comment.rb', line 5 def id @id end |
#notices_count ⇒ Object (readonly)
Returns the value of attribute notices_count.
5 6 7 |
# File 'lib/honeybadger-api/comment.rb', line 5 def notices_count @notices_count end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
5 6 7 |
# File 'lib/honeybadger-api/comment.rb', line 5 def source @source end |
Class Method Details
.all(project_id, fault_id) ⇒ Object
Public: Find all comments on a fault for a project.
25 26 27 28 |
# File 'lib/honeybadger-api/comment.rb', line 25 def self.all(project_id, fault_id) path = "projects/#{project_id}/faults/#{fault_id}/comments" Honeybadger::Api::Request.all(path, handler) end |
.find(project_id, fault_id, comment_id) ⇒ Object
Public: Find a comment on a fault for a project.
37 38 39 40 |
# File 'lib/honeybadger-api/comment.rb', line 37 def self.find(project_id, fault_id, comment_id) path = "projects/#{project_id}/faults/#{fault_id}/comments/#{comment_id}" Honeybadger::Api::Request.find(path, handler) end |
.handler ⇒ Object
Internal: The handler used to build objects from API responses.
43 44 45 |
# File 'lib/honeybadger-api/comment.rb', line 43 def self.handler Proc.new { |response| Comment.new(response) } end |
.paginate(project_id, fault_id, filters = {}) ⇒ Object
Public: Paginate all comments on a fault for a project
31 32 33 34 |
# File 'lib/honeybadger-api/comment.rb', line 31 def self.paginate(project_id, fault_id, filters = {}) path = "projects/#{project_id}/faults/#{fault_id}/comments" Honeybadger::Api::Request.paginate(path, handler, filters) end |