Class: Peaty::Project

Inherits:
Base show all
Defined in:
lib/peaty/project.rb

Constant Summary

Constants inherited from Base

Base::FILTERS

Instance Attribute Summary

Attributes inherited from Base

#attributes, #connection, #error

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all, build, #error?, filter_options, find, find_by_id, first, #id, #initialize, #method_missing, #new_record?, parse, #respond_to?, #save, with_connection

Constructor Details

This class inherits a constructor from Peaty::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Peaty::Base

Class Method Details

.collection_path(options = {}) ⇒ Object



37
38
39
# File 'lib/peaty/project.rb', line 37

def collection_path(options = {})
  "/projects"
end

.elementObject



34
35
36
# File 'lib/peaty/project.rb', line 34

def element
  "project"
end

.member_path(id, options = {}) ⇒ Object



40
41
42
# File 'lib/peaty/project.rb', line 40

def member_path(id, options = {})
  "/projects/%i" % id
end

Instance Method Details

#bugs(options = {}) ⇒ Object



29
30
31
# File 'lib/peaty/project.rb', line 29

def bugs(options = {})
  self.stories.filter(:type => :bug)
end

#chores(options = {}) ⇒ Object



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

def chores(options = {})
  self.stories.filter(:type => :chore)
end

#features(options = {}) ⇒ Object



20
21
22
# File 'lib/peaty/project.rb', line 20

def features(options = {})
  self.stories.filter(:type => :feature)
end

#iterations(options = {}) ⇒ Object



16
17
18
# File 'lib/peaty/project.rb', line 16

def iterations(options = {})
  Proxy.new(Iteration, self.class.connection, options.merge(:project_id => self.id))
end

#releases(options = {}) ⇒ Object



23
24
25
# File 'lib/peaty/project.rb', line 23

def releases(options = {})
  self.stories.filter(:type => :release)
end

#stories(options = {}) ⇒ Object



12
13
14
# File 'lib/peaty/project.rb', line 12

def stories(options = {})
  Proxy.new(Story, self.class.connection, options.merge(:project_id => self.id))
end

#users(options = {}) ⇒ Object



5
6
7
8
9
10
# File 'lib/peaty/project.rb', line 5

def users(options = {})
  Array.wrap(self.memberships).map do |membership|
    membership = membership["membership"] if membership.key?("membership")
    User.with_connection(self.connection).new(membership["person"])
  end
end