Class: CardCopy

Inherits:
ObjectCopy show all
Defined in:
lib/translate/copy/card_copy.rb

Instance Method Summary collapse

Methods inherited from ObjectCopy

#card_values, #copy, #excluded_attributes, #fetch_object, #fetch_project, #find_project_in_new_workspace, #initialize, #logger, #new_workspace, #rally_rest, #remember, #tangle, #user_exists?

Constructor Details

This class inherits a constructor from ObjectCopy

Instance Method Details

#copy_childrenObject



26
27
28
29
30
# File 'lib/translate/copy/card_copy.rb', line 26

def copy_children
  @object.tasks.each do |task|
    task.copy(new_workspace, :work_product => @new_object)
  end if @object.tasks
end

#create_object(values) ⇒ Object



22
23
24
# File 'lib/translate/copy/card_copy.rb', line 22

def create_object(values)
  rally_rest.create(:hierarchical_requirement, values)
end

#shallow_copy(object) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/translate/copy/card_copy.rb', line 2

def shallow_copy(object)
  # We are here because we have an artifact with multiple cards. We need to create
  # a user story for each artifact:card pair, and we are going to do it from the perspective 
  # of the card. The "parent" card has already been created
  # 
  # so, let's shallow copy the workproduct values first
  values = super(@object.work_product)
  
  # then get the interesting card attrributes
  values.merge! card_values(@object)

  # append to the name attribute
  values[:name] = "Scheduled child of #{values[:name]}"

  # Capture the schedule note
  values[:notes] = "#{values[:notes]} <br> Scheduled Note: #{@object.schedule_note}"

  values
end

#type_as_symbolObject



32
33
34
# File 'lib/translate/copy/card_copy.rb', line 32

def type_as_symbol
  :hierarchical_requirement
end