class TrackerApi::Endpoints::Task

Attributes

client[RW]

Public Class Methods

new(client) click to toggle source
# File lib/tracker_api/endpoints/task.rb, line 6
def initialize(client)
  @client = client
end

Public Instance Methods

create(project_id, story_id, params={}) click to toggle source
# File lib/tracker_api/endpoints/task.rb, line 10
def create(project_id, story_id, params={})
  data = client.post("/projects/#{project_id}/stories/#{story_id}/tasks", params: params).body
  Resources::Task.new({ client: client }.merge(data))
end
update(task, params={}) click to toggle source
# File lib/tracker_api/endpoints/task.rb, line 15
def update(task, params={})
  raise ArgumentError, 'Valid task required to update.' unless task.instance_of?(Resources::Task)

  data = client.put("/projects/#{task.project_id}/stories/#{task.story_id}/tasks/#{task.id}",
                    params: params).body

  task.attributes = data
  task.clean!
  task
end