Class: InstitutionalProposalObject

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

Returns a new instance of InstitutionalProposalObject.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/kuality-coeus/data_objects/institutional_proposal/institutional_proposal.rb', line 14

def initialize(browser, opts={})
  @browser = browser
  defaults = {
      proposal_status:   'Pending',
      activity_type:     '::random::',
      sponsor_id:        '::random::',
      project_personnel: collection('ProjectPersonnel'),
      special_review:    collection('SpecialReview'),
      cost_sharing:      collection('IPCostSharing'),
      unrecovered_fa:    collection('IPUnrecoveredFA')
  }
  unless opts[:proposal_log].nil?
    defaults[:proposal_type]=opts[:proposal_log].proposal_type
    defaults[:project_title]=opts[:proposal_log].title
    defaults[:sponsor_id]=opts[:proposal_log].sponsor_id
    pi = make ProjectPersonnelObject, principal_name: opts[:proposal_log].principal_investigator,
              role: 'Principal Investigator'
    defaults[:project_personnel] << pi
  end
  set_options(defaults.merge(opts))
end

Instance Attribute Details

#activity_typeObject

Returns the value of attribute activity_type.



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

def activity_type
  @activity_type
end

#award_idObject

Returns the value of attribute award_id.



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

def award_id
  @award_id
end

#cost_sharingObject

Returns the value of attribute cost_sharing.



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

def cost_sharing
  @cost_sharing
end

#custom_dataObject

Returns the value of attribute custom_data.



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

def custom_data
  @custom_data
end

#dev_proposal_numberObject

Returns the value of attribute dev_proposal_number.



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

def dev_proposal_number
  @dev_proposal_number
end

#doc_headerObject

Returns the value of attribute doc_header.



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

def doc_header
  @doc_header
end

#doc_statusObject

Returns the value of attribute doc_status.



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

def doc_status
  @doc_status
end

#document_idObject

Returns the value of attribute document_id.



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

def document_id
  @document_id
end

#initiatorObject

Returns the value of attribute initiator.



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

def initiator
  @initiator
end

#project_personnelObject

Returns the value of attribute project_personnel.



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

def project_personnel
  @project_personnel
end

#project_titleObject

Returns the value of attribute project_title.



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

def project_title
  @project_title
end

#proposal_logObject

Returns the value of attribute proposal_log.



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

def proposal_log
  @proposal_log
end

#proposal_numberObject

Returns the value of attribute proposal_number.



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

def proposal_number
  @proposal_number
end

#proposal_statusObject

Returns the value of attribute proposal_status.



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

def proposal_status
  @proposal_status
end

#proposal_typeObject

Returns the value of attribute proposal_type.



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

def proposal_type
  @proposal_type
end

#special_reviewObject

Returns the value of attribute special_review.



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

def special_review
  @special_review
end

Returns the value of attribute sponsor_id.



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

def sponsor_id
  @sponsor_id
end

#unrecovered_faObject

Returns the value of attribute unrecovered_fa.



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

def unrecovered_fa
  @unrecovered_fa
end

Instance Method Details

#add_cost_sharing(opts = {}) ⇒ Object



61
62
63
# File 'lib/kuality-coeus/data_objects/institutional_proposal/institutional_proposal.rb', line 61

def add_cost_sharing opts={}
  @cost_sharing.add merge_settings(opts)
end

#add_custom_data(opts = {}) ⇒ Object



57
58
59
# File 'lib/kuality-coeus/data_objects/institutional_proposal/institutional_proposal.rb', line 57

def add_custom_data opts={}
  @custom_data = prep(CustomDataObject, opts)
end

#add_unrecovered_fa(opts = {}) ⇒ Object



65
66
67
# File 'lib/kuality-coeus/data_objects/institutional_proposal/institutional_proposal.rb', line 65

def add_unrecovered_fa opts={}
  @unrecovered_fa.add merge_settings(opts)
end

#createObject

This method is appropriate only in the context of creating an Institutional Proposal from a Proposal Log.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/kuality-coeus/data_objects/institutional_proposal/institutional_proposal.rb', line 38

def create
  visit(CentralAdmin).create_institutional_proposal
  on ProposalLogLookup do |look|
    look.proposal_number.set @proposal_log.number
    look.search
    look.select_item @proposal_log.number
  end
  on InstitutionalProposal do |create|
    @doc_header=create.doc_title
    @document_id=create.document_id
    create.expand_all
    @proposal_number=create.institutional_proposal_number
    create.description.set random_alphanums
    fill_out create, :proposal_type, :award_id, :activity_type, :project_title
    set_sponsor_code
    create.save
  end
end