Class: Project

Inherits:
Object
  • Object
show all
Extended by:
Rally::ParsingHelperClassMethods
Includes:
Mongoid::Document, Rally::ParsingHelpers
Defined in:
lib/project.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Rally::ParsingHelperClassMethods

from_uri, node_name, rally_query

Methods included from Rally::ParsingHelpers

#raw_json

Class Method Details

.rally_uriObject



7
8
9
# File 'lib/project.rb', line 7

def rally_uri
  "/project.js"
end

Instance Method Details

#ancestorsObject



25
26
27
28
29
30
31
32
# File 'lib/project.rb', line 25

def ancestors
  if parent
    a = parent.ancestors << self
    return a
  else
    return [self]
  end
end

#associate(hash_values = nil) ⇒ Object

must be called after refresh, or with has_values passed in



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/project.rb', line 47

def associate hash_values=nil
  @rally_hash = hash_values || RallyAPI.get(self)
  #TODO: associate with user when users are supported
  if @rally_hash["Parent"]
    parent = Project.find_or_create_by(:rally_uri => @rally_hash["Parent"]["_ref"])
    parent.children << self
    parent.save
    self.parent = parent
  end
  self.save
end

#refresh(hash_values = nil) ⇒ Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/project.rb', line 35

def refresh hash_values=nil
  @rally_hash = hash_values if hash_values
  from_rally :name
  from_rally :description
  from_rally :state
  from_rally :notes

  self.save

end