class PivotalTracker::Project
Public Class Methods
all()
click to toggle source
# File lib/pivotal-tracker/project.rb, line 6 def all @found = parse(Client.connection['/projects'].get) end
find(id)
click to toggle source
# File lib/pivotal-tracker/project.rb, line 10 def find(id) if @found project = @found.detect { |document| document.id == id } if !project project = parse(Client.connection["/projects/#{id}"].get) end project else parse(Client.connection["/projects/#{id}"].get) end end
new(attributes={})
click to toggle source
# File lib/pivotal-tracker/project.rb, line 38 def initialize(attributes={}) update_attributes(attributes) end
Public Instance Methods
activities()
click to toggle source
# File lib/pivotal-tracker/project.rb, line 48 def activities @activities ||= Proxy.new(self, Activity) end
create()
click to toggle source
# File lib/pivotal-tracker/project.rb, line 42 def create response = Client.connection["/projects"].post(self.to_xml, :content_type => 'application/xml') project = Project.parse(response) return project end
iteration(group)
click to toggle source
# File lib/pivotal-tracker/project.rb, line 64 def iteration(group) case group.to_sym when :done then Iteration.done(self) when :current then Iteration.current(self) when :backlog then Iteration.backlog(self) when :current_backlog then Iteration.current_backlog(self) else raise ArgumentError, "Invalid group. Use :done, :current, :backlog or :current_backlog instead." end end
iterations()
click to toggle source
# File lib/pivotal-tracker/project.rb, line 52 def iterations @iterations ||= Proxy.new(self, Iteration) end
memberships()
click to toggle source
# File lib/pivotal-tracker/project.rb, line 60 def memberships @memberships ||= Proxy.new(self, Membership) end
stories()
click to toggle source
# File lib/pivotal-tracker/project.rb, line 56 def stories @stories ||= Proxy.new(self, Story) end
Protected Instance Methods
to_xml()
click to toggle source
# File lib/pivotal-tracker/project.rb, line 77 def to_xml builder = Nokogiri::XML::Builder.new do |xml| xml.project { xml.name "#{name}" xml.iteration_length.integer "#{iteration_length}" unless iteration_length.nil? xml.point_scale "#{point_scale}" unless point_scale.nil? } end return builder.to_xml end
update_attributes(attrs)
click to toggle source
# File lib/pivotal-tracker/project.rb, line 88 def update_attributes(attrs) attrs.each do |key, value| self.send("#{key}=", value.is_a?(Array) ? value.join(',') : value ) end end