Class: BugherdClient::Resources::V2::Comment

Inherits:
Base
  • Object
show all
Defined in:
lib/bugherd_client/resources/v2/comment.rb

Constant Summary

Constants inherited from Base

Base::DEFAULT_HEADER_ATTRS

Instance Attribute Summary

Attributes inherited from Base

#connection, #options

Instance Method Summary collapse

Methods inherited from Base

#api_methods, #converter, #initialize, #parse_response, #send_request

Constructor Details

This class inherits a constructor from BugherdClient::Resources::V2::Base

Instance Method Details

#all(project_id, task_id) ⇒ Object

Get a paginated list of comments for a task.



10
11
12
13
# File 'lib/bugherd_client/resources/v2/comment.rb', line 10

def all(project_id, task_id)
  raw_response = get_request("projects/#{project_id}/tasks/#{task_id}/comments")
  parse_response(raw_response, :comments)
end

#create(project_id, task_id, attributes = {}) ⇒ Object

Create a comment attributes: text, user_id or email



26
27
28
29
# File 'lib/bugherd_client/resources/v2/comment.rb', line 26

def create(project_id, task_id, attributes={})
  raw_response = post_request("projects/#{project_id}/tasks/#{task_id}/comments", comment: attributes)
  parse_response(raw_response)
end

#find(project_id, task_id, comment_id) ⇒ Object

Get a single comment of a Task



18
19
20
21
# File 'lib/bugherd_client/resources/v2/comment.rb', line 18

def find(project_id, task_id, comment_id)
  raw_response = get_request("projects/#{project_id}/tasks/#{task_id}/comments/#{comment_id}")
  parse_response(raw_response, :comment)
end