Class: Pickler::Tracker::Project

Inherits:
Abstract
  • Object
show all
Defined in:
lib/pickler/tracker/project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Abstract

accessor, date_reader, #id, reader, #to_xml

Constructor Details

#initialize(tracker, attributes = {}) ⇒ Project

Returns a new instance of Project.



8
9
10
11
# File 'lib/pickler/tracker/project.rb', line 8

def initialize(tracker, attributes = {})
  @tracker = tracker
  super(attributes)
end

Instance Attribute Details

#trackerObject (readonly)

Returns the value of attribute tracker.



5
6
7
# File 'lib/pickler/tracker/project.rb', line 5

def tracker
  @tracker
end

Instance Method Details

#deliver_all_finished_storiesObject



30
31
32
# File 'lib/pickler/tracker/project.rb', line 30

def deliver_all_finished_stories
  request_xml(:put,"/projects/#{id}/stories_deliver_all_finished")
end

#new_story(attributes = {}, &block) ⇒ Object



26
27
28
# File 'lib/pickler/tracker/project.rb', line 26

def new_story(attributes = {}, &block)
  Story.new(self, attributes, &block)
end

#stories(*args) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/pickler/tracker/project.rb', line 18

def stories(*args)
  filter = encode_term(args) if args.any?
  path = "/projects/#{id}/stories"
  path << "?filter=#{CGI.escape(filter)}" if filter
  response = tracker.get_xml(path)
  [response["stories"]].flatten.compact.map {|s| Story.new(self,s)}
end

#story(story_id) ⇒ Object

Raises:



13
14
15
16
# File 'lib/pickler/tracker/project.rb', line 13

def story(story_id)
  raise Error, "No story id given" if story_id.to_s.empty?
  Story.new(self,tracker.get_xml("/projects/#{id}/stories/#{story_id}")["story"])
end