Class: BugherdClient::Resources::V1::Comment

Inherits:
Base
  • Object
show all
Defined in:
lib/bugherd_client/resources/v1/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, #initialize, #parse_response, #send_request

Constructor Details

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

Instance Method Details

#all(project_id, task_id) ⇒ Object

Get a paginated list of comments for a task.



9
10
11
12
# File 'lib/bugherd_client/resources/v1/comment.rb', line 9

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



25
26
27
28
# File 'lib/bugherd_client/resources/v1/comment.rb', line 25

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



17
18
19
20
# File 'lib/bugherd_client/resources/v1/comment.rb', line 17

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