Class: BugherdClient::Resources::V1::Task

Inherits:
Base
  • Object
show all
Defined in:
lib/bugherd_client/resources/v1/task.rb

Constant Summary collapse

PRIORITIES =
['not set', 'critical', 'important', 'normal','minor']
STATUSES =
['feedback', 'backlog','todo','doing','done','closed']

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, filter_attributes = {}) ⇒ Object

Get a full list of tasks for a project, including archived tasks. filters: updated_since, created_since, status, priority, tag and external_id



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

def all(project_id, filter_attributes={})
  params = filter_attributes.empty? ? {} : { params: filter_attributes }
  raw_response = get_request("projects/#{project_id}/tasks", params)
  parse_response(raw_response, :tasks)
end

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

Create a new Task attributes:

description, priority, status, tag_names(Array),
requester_id or requester_email,
assigned_to_id or assigned_to_email
external_id

if status is null the Task is automatically put in the Feedback panel ‘requester_email’ can be any email address while ‘assigned_to_email’ needs to be of a current project member. Values for ‘priority’ are not set, critical, important, normal, and minor. Values for ‘status’ are backlog, todo, doing, done, and closed. Omit this field or set as ‘null’ to send tasks to the Feedback panel. External ID is an API-only field. It cannot be set from the BugHerd application, only using the API. An external ID can be used to track originating IDs from other systems in BugHerd bugs.



50
51
52
53
# File 'lib/bugherd_client/resources/v1/task.rb', line 50

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

#delete(project_id, task_id) ⇒ Object



60
61
# File 'lib/bugherd_client/resources/v1/task.rb', line 60

def delete(project_id, task_id)
end

#find(project_id, task_id) ⇒ Object

List details of a task in a given project, includes all data including comments, attachments, etc.



33
34
35
36
# File 'lib/bugherd_client/resources/v1/task.rb', line 33

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

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



55
56
57
58
# File 'lib/bugherd_client/resources/v1/task.rb', line 55

def update(project_id, task_id, attributes={})
  raw_response = put_request("projects/#{project_id}/tasks/#{task_id}", task: attributes)
  parse_response(raw_response)
end