Class: PivotalTracker::Note

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Note

Returns a new instance of Note.



21
22
23
24
25
26
27
28
29
# File 'lib/pivotal-tracker/note.rb', line 21

def initialize(attributes={})
  if attributes[:owner]
    self.story = attributes.delete(:owner) 
    self.project_id = self.story.project_id
    self.story_id = self.story.id
  end

  update_attributes(attributes)
end

Instance Attribute Details

#project_idObject

Returns the value of attribute project_id.



13
14
15
# File 'lib/pivotal-tracker/note.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/note.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/note.rb', line 6

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

Instance Method Details

#createObject



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

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