Class: PivotalTracker::Project
- Inherits:
-
Object
- Object
- PivotalTracker::Project
show all
- Includes:
- HappyMapper, Validation
- Defined in:
- lib/pivotal-tracker/project.rb,
lib/pivotal-tracker/project.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Validation
#create_with_validations, #errors, included, #update_with_validations
Constructor Details
#initialize(attributes = {}) ⇒ Project
Returns a new instance of Project.
34
35
36
|
# File 'lib/pivotal-tracker/project.rb', line 34
def initialize(attributes={})
update_attributes(attributes)
end
|
Class Method Details
.all ⇒ Object
6
7
8
|
# File 'lib/pivotal-tracker/project.rb', line 6
def all
@found = parse(Client.connection['/projects'].get)
end
|
.find(id) ⇒ Object
10
11
12
13
14
15
16
|
# File 'lib/pivotal-tracker/project.rb', line 10
def find(id)
if @found
@found.detect { |document| document.id == id }
else
parse(Client.connection["/projects/#{id}"].get)
end
end
|
Instance Method Details
#activities ⇒ Object
44
45
46
|
# File 'lib/pivotal-tracker/project.rb', line 44
def activities
@activities ||= Proxy.new(self, Activity)
end
|
#create ⇒ Object
38
39
40
41
42
|
# File 'lib/pivotal-tracker/project.rb', line 38
def create
response = Client.connection["/projects"].post(self.to_xml, :content_type => 'application/xml')
project = Project.parse(response)
return project
end
|
#iteration(group) ⇒ Object
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/pivotal-tracker/project.rb', line 60
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 ⇒ Object
48
49
50
|
# File 'lib/pivotal-tracker/project.rb', line 48
def iterations
@iterations ||= Proxy.new(self, Iteration)
end
|
#memberships ⇒ Object
56
57
58
|
# File 'lib/pivotal-tracker/project.rb', line 56
def memberships
@memberships ||= Proxy.new(self, Membership)
end
|
#stories ⇒ Object
52
53
54
|
# File 'lib/pivotal-tracker/project.rb', line 52
def stories
@stories ||= Proxy.new(self, Story)
end
|