Class: IPCostSharingObject

Inherits:
Object
  • Object
show all
Includes:
DataFactory, Foundry, Navigation, StringFactory
Defined in:
lib/kuality-coeus/data_objects/institutional_proposal/ip_cost_sharing.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 = {}) ⇒ IPCostSharingObject

Returns a new instance of IPCostSharingObject.



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

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

  defaults = {
      project_period: '1',
      percentage:     '100.00',
      type:           '::random::',
      source_account: random_alphanums,
      amount:         random_dollar_value(1000)
  }
  set_options(defaults.merge(opts))
end

Instance Attribute Details

#amountObject

Returns the value of attribute amount.



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

def amount
  @amount
end

#indexObject

Returns the value of attribute index.



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

def index
  @index
end

#percentageObject

Returns the value of attribute percentage.



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

def percentage
  @percentage
end

#project_periodObject

Returns the value of attribute project_period.



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

def project_period
  @project_period
end

#source_accountObject

Returns the value of attribute source_account.



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

def 
  @source_account
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#createObject



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/kuality-coeus/data_objects/institutional_proposal/ip_cost_sharing.rb', line 24

def create
  view
  on Distribution do |page|
    page.expand_all
    page.add_cost_share_project_period.set @project_period
    page.add_cost_share_type.pick! @type
    page.add_cost_share_percentage.set @percentage
    page..set @source_account
    page.add_cost_share_amount.set @amount
    page.add_cost_share
  end
end

#edit(opts) ⇒ Object



43
44
45
46
47
48
49
50
51
# File 'lib/kuality-coeus/data_objects/institutional_proposal/ip_cost_sharing.rb', line 43

def edit(opts)
  view
  on Distribution do |page|
    page.expand_all
    #TODO: Add this code
    page.save
  end
  update_options(opts)
end

#viewObject



37
38
39
40
41
# File 'lib/kuality-coeus/data_objects/institutional_proposal/ip_cost_sharing.rb', line 37

def view
  # Note: Currently assumes we're already viewing
  # the institutional proposal!
  on(InstitutionalProposal).distribution
end