Class: Honeybadger::Api::Comment

Inherits:
Object
  • Object
show all
Defined in:
lib/honeybadger-api/comment.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#authorObject (readonly)

Returns the value of attribute author.



5
6
7
# File 'lib/honeybadger-api/comment.rb', line 5

def author
  @author
end

#bodyObject (readonly)

Returns the value of attribute body.



5
6
7
# File 'lib/honeybadger-api/comment.rb', line 5

def body
  @body
end

#created_atObject (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

#emailObject (readonly)

Returns the value of attribute email.



5
6
7
# File 'lib/honeybadger-api/comment.rb', line 5

def email
  @email
end

#eventObject (readonly)

Returns the value of attribute event.



5
6
7
# File 'lib/honeybadger-api/comment.rb', line 5

def event
  @event
end

#fault_idObject (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

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/honeybadger-api/comment.rb', line 5

def id
  @id
end

#notices_countObject (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

#sourceObject (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

.handlerObject

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