Class: PivotalTracker::Task

Inherits:
Object
  • Object
show all
Includes:
HappyMapper, Validation
Defined in:
lib/pivotal-tracker/task.rb,
lib/pivotal-tracker/task.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Validation

#create_with_validations, #errors, included, #update_with_validations

Instance Attribute Details

#project_idObject

Returns the value of attribute project_id.



13
14
15
# File 'lib/pivotal-tracker/task.rb', line 13

def project_id
  @project_id
end

#story_idObject

Returns the value of attribute story_id.



13
14
15
# File 'lib/pivotal-tracker/task.rb', line 13

def story_id
  @story_id
end

Class Method Details

.all(story, options = {}) ⇒ Object



6
7
8
9
10
# File 'lib/pivotal-tracker/task.rb', line 6

def all(story, options={})
  tasks = parse(Client.connection["/projects/#{story.project_id}/stories/#{story.id}/tasks"].get)
  tasks.each { |t| t.project_id, t.story_id = story.project_id, story.id }
  return tasks
end

Instance Method Details

#createObject



21
22
23
24
# File 'lib/pivotal-tracker/task.rb', line 21

def create
  response = Client.connection["/projects/#{project_id}/stories/#{story_id}/tasks"].post(self.to_xml, :content_type => 'application/xml')
  return Task.parse(response)
end

#deleteObject



31
32
33
# File 'lib/pivotal-tracker/task.rb', line 31

def delete
  Client.connection["/projects/#{project_id}/stories/#{story_id}/tasks/#{id}"].delete
end

#updateObject



26
27
28
29
# File 'lib/pivotal-tracker/task.rb', line 26

def update
  response = Client.connection["/projects/#{project_id}/stories/#{story_id}/tasks/#{id}"].put(self.to_xml, :content_type => 'application/xml')
  return Task.parse(response)
end