Class: Iteration

Inherits:
Object
  • Object
show all
Extended by:
Rally::ParsingHelperClassMethods
Includes:
Mongoid::Document, Rally::ParsingHelpers
Defined in:
lib/iteration.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/iteration.rb', line 7

def rally_uri
  "/iteration.js"
end

Instance Method Details

#associate(hash_values = nil) ⇒ Object

has to be called after refresh, or with hash_values passed in



44
45
46
47
48
49
50
51
# File 'lib/iteration.rb', line 44

def associate hash_values=nil
  @rally_hash = hash_values if hash_values
  if @rally_hash.has_key?("Project")
    project = Project.find_or_create_by(:rally_uri => @rally_hash["Project"]["_ref"])
    project.iterations << self
  end
  self.save
end

#refresh(hash_values = nil) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/iteration.rb', line 26

def refresh hash_values=nil
  @rally_hash = hash_values
  from_rally :rally_uri, :_ref
  from_rally :name
  from_rally :theme
  from_rally :state
  from_rally :created_on, :_CreatedAt
  from_rally :start_date, :StartDate
  from_rally :end_date, :EndDate
  from_rally :resources

  self.save
rescue ArgumentError #getting some bad created_on dates
  puts "Errored on #{self.name}"
  self.save # save what you can
end