Sha256: 7a61374a29bbcf30ba001fd54e02373d91f855519f53460422c7a70fcd8e1bf6

Contents?: true

Size: 1022 Bytes

Versions: 5

Compression:

Stored size: 1022 Bytes

Contents

class Project
  include Mongoid::Document
  include Rally::ParsingHelpers
  extend Rally::ParsingHelperClassMethods

  class << self
    def rally_uri
      "/project.js"
    end
  end

  field :name
  field :rally_uri
  field :created_on
  field :description
  field :notes
  field :state

  referenced_in :parent, :class_name => "Project"
  references_many :children, :class_name => "Project"
  references_many :iterations  
  embeds_one :revision_parser
  
  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
  
  #must be called after refresh, or with has_values passed in
  def associate hash_values=nil
    @rally_hash = hash_values if hash_values
    #TODO: associate with user when users are supported
    if @rally_hash["Parent"]
      parent = Project.find_or_create_by(:rally_uri => @rally_hash["Parent"]["_ref"])
      self.parent = parent
    end
    self.save
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rallytastic-1.2.4 lib/project.rb
rallytastic-1.2.3 lib/project.rb
rallytastic-1.2.2 lib/project.rb
rallytastic-1.2.1 lib/project.rb
rallytastic-1.2.0 lib/project.rb