Module: Pivit::Client::Task

Included in:
Pivit::Client
Defined in:
lib/pivit/client/task.rb

Overview

Task management

Instance Method Summary collapse

Instance Method Details

#create_task(project_id, story_id, options = {}) ⇒ Hashie::Mash

Create a task

Provide the parameters you want to use for the task via the options hash

Examples:

Pivit::Client.create_task({:type=> "feature", :name => "Task"})

Parameters:

  • project_id (Integer)

    the id of the project that contains the task

  • story_id (Integer)

    the id of the story that contains the task

Returns:

  • (Hashie::Mash)

    task created response

See Also:

Author:

  • Jason Truluck



59
60
61
62
# File 'lib/pivit/client/task.rb', line 59

def create_task(project_id, story_id, options = {})
  options = { :task => options }
  post("projects/#{project_id}/stories/#{story_id}/tasks", options).task
end

#delete_task(project_id, story_id, task_id, options = {}) ⇒ Hashie::Mash

Delete a task

Examples:

Pivit::Client.delete_task(12345, 11111, 67890)

Parameters:

  • project_id (Integer)

    the id of the project that contains the task

  • story_id (Integer)

    the id of the story that contains the task

  • task_id (Integer)

    the id of the task that is getting deleted

Returns:

  • (Hashie::Mash)

    task deleted response

See Also:

Author:

  • Jason Truluck



99
100
101
# File 'lib/pivit/client/task.rb', line 99

def delete_task(project_id, story_id, task_id, options = {})
  delete("projects/#{project_id}/stories/#{story_id}/tasks/#{task_id}", options).task
end

#task(project_id, story_id, task_id, options = {}) ⇒ Hashie::Mash

Retrieve a single task from your account

Examples:

Pivit::Client.task(1111111, 123456, 67890)

Parameters:

  • project_id (Integer)

    the id of the project that you want to retrieve stories from

  • story_id (Integer)

    the id of the story that you want to retrieve

  • task_id (Integer)

    the id of the task that you want to retrieve

Returns:

  • (Hashie::Mash)

    task response

See Also:

Author:

  • Jason Truluck



23
24
25
# File 'lib/pivit/client/task.rb', line 23

def task(project_id, story_id, task_id, options = {})
  get("projects/#{project_id}/stories/#{story_id}/tasks/#{task_id}", options).task
end

#tasks(project_id, story_id, options = {}) ⇒ Hashie::Mash

Retrieve all tasks from a story

Examples:

Pivit::Client.tasks(1111111, 123456)

Parameters:

  • project_id (Integer)

    the id of the project that contains the stories

  • stroy_id (Integer)

    the id of the story that contains the tasks

Returns:

  • (Hashie::Mash)

    tasks response

See Also:

Author:

  • Jason Truluck



40
41
42
# File 'lib/pivit/client/task.rb', line 40

def tasks(project_id, story_id, options = {})
  get("projects/#{project_id}/stories/#{story_id}/tasks", options).tasks
end

#update_task(project_id, story_id, task_id, options = {}) ⇒ Hashie::Mash

Update a task

Provide the parameters you want to use for the task via the options hash

Examples:

Pivit::Client.update_task(12345, 11111, 67890, {:name => "awesome new task name"})

Parameters:

  • project_id (Integer)

    the id of the project that contains the task

  • story_id (Integer)

    the id of the story that contains the task

  • task_id (Integer)

    the id of the task that is getting updated

Returns:

  • (Hashie::Mash)

    task updated response

See Also:

Author:

  • Jason Truluck



80
81
82
83
# File 'lib/pivit/client/task.rb', line 80

def update_task(project_id, story_id, task_id, options = {})
  options = { :task => options }
  put("projects/#{project_id}/stories/#{story_id}/tasks/#{task_id}",  options).task
end