Class: SubawardBudgetObject

Inherits:
Object
  • Object
show all
Includes:
DataFactory, Foundry, Navigation, StringFactory
Defined in:
lib/kuality-coeus/data_objects/budget/subaward_budget.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Navigation

#doc_search, #fill_out, #fill_out_item, #on_document?, #on_page?, #open_document, #window_cleanup

Methods included from Utilities

#get, #make_role, #make_user, #random_percentage, #set, #snake_case

Constructor Details

#initialize(browser, opts = {}) ⇒ SubawardBudgetObject

Returns a new instance of SubawardBudgetObject.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/kuality-coeus/data_objects/budget/subaward_budget.rb', line 11

def initialize(browser, opts={})
  @browser = browser

  defaults = {
      file_name:    'test.pdf',
      direct_cost:  random_dollar_value(10000),
      f_and_a_cost: random_dollar_value(10000),
      cost_sharing: random_dollar_value(10000)
  }
  set_options(defaults.merge(opts))
end

Instance Attribute Details

#cost_sharingObject

Returns the value of attribute cost_sharing.



8
9
10
# File 'lib/kuality-coeus/data_objects/budget/subaward_budget.rb', line 8

def cost_sharing
  @cost_sharing
end

#direct_costObject

Returns the value of attribute direct_cost.



8
9
10
# File 'lib/kuality-coeus/data_objects/budget/subaward_budget.rb', line 8

def direct_cost
  @direct_cost
end

#f_and_a_costObject

Returns the value of attribute f_and_a_cost.



8
9
10
# File 'lib/kuality-coeus/data_objects/budget/subaward_budget.rb', line 8

def f_and_a_cost
  @f_and_a_cost
end

#file_nameObject

Returns the value of attribute file_name.



8
9
10
# File 'lib/kuality-coeus/data_objects/budget/subaward_budget.rb', line 8

def file_name
  @file_name
end

#organization_idObject

Returns the value of attribute organization_id.



8
9
10
# File 'lib/kuality-coeus/data_objects/budget/subaward_budget.rb', line 8

def organization_id
  @organization_id
end

#organization_nameObject

Returns the value of attribute organization_name.



8
9
10
# File 'lib/kuality-coeus/data_objects/budget/subaward_budget.rb', line 8

def organization_name
  @organization_name
end

#total_costObject

Returns the value of attribute total_cost.



8
9
10
# File 'lib/kuality-coeus/data_objects/budget/subaward_budget.rb', line 8

def total_cost
  @total_cost
end

Instance Method Details

#createObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/kuality-coeus/data_objects/budget/subaward_budget.rb', line 23

def create
  # As this is a nested object, it should be created
  # by its parent. So,  we're having the
  # parent BudgetVersionsObject
  # do the navigation for us...
  on(BudgetActions).expand_all
  if @organization_id.nil?
    on(BudgetActions).look_up_organization
    on OrganizationLookup do |look|
      look.search
      look.return_random
    end
    on BudgetActions do |add|
      @organization_id=add.add_organization_id.value
      # The next two lines are needed because
      # otherwise the organization name will not
      # appear in the div...
      add.add_organization_id.focus
      add.add_comments.focus
      @organization_name=add.organization_name
    end
  else
    # TODO Write this else clause when it's necessary
  end
  on BudgetActions do |add|
    add.add_file_name.set($file_folder+@file_name)
    add.add_subaward_budget
    add.show_details @organization_name
    fill_out_item @organization_name, add, :direct_cost, :f_and_a_cost, :cost_sharing
    @total_cost=add.total_cost(@organization_name)
    add.save
  end
end