Class: AwardObject

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

Returns a new instance of AwardObject.



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

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

  defaults = {
    description:           random_alphanums,
    transaction_type:      '::random::',
    award_status:          '::random::',
    award_title:           random_alphanums,
    activity_type:         '::random::',
    award_type:            '::random::',
    project_start_date:    right_now[:date_w_slashes],
    project_end_date:      in_a_year[:date_w_slashes],
    sponsor_id:            '::random::',
    lead_unit:             '::random::',
    obligation_start_date: right_now[:date_w_slashes],
    obligation_end_date:   in_a_year[:date_w_slashes],
    anticipated_amount:    '1000000',
    obligated_amount:      '1000000',
    transactions:          collection('Transaction')
  }

  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/award/award.rb', line 9

def activity_type
  @activity_type
end

#anticipated_amountObject

Returns the value of attribute anticipated_amount.



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

def anticipated_amount
  @anticipated_amount
end

#award_idObject

Returns the value of attribute award_id.



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

def award_id
  @award_id
end

#award_statusObject

Returns the value of attribute award_status.



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

def award_status
  @award_status
end

#award_titleObject

Returns the value of attribute award_title.



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

def award_title
  @award_title
end

#award_typeObject

Returns the value of attribute award_type.



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

def award_type
  @award_type
end

#creation_dateObject

Returns the value of attribute creation_date.



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

def creation_date
  @creation_date
end

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#document_idObject

Returns the value of attribute document_id.



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

def document_id
  @document_id
end

#funding_proposalObject

Returns the value of attribute funding_proposal.



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

def funding_proposal
  @funding_proposal
end

#lead_unitObject

Returns the value of attribute lead_unit.



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

def lead_unit
  @lead_unit
end

#obligated_amountObject

Returns the value of attribute obligated_amount.



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

def obligated_amount
  @obligated_amount
end

#obligation_end_dateObject

Returns the value of attribute obligation_end_date.



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

def obligation_end_date
  @obligation_end_date
end

#obligation_start_dateObject

Returns the value of attribute obligation_start_date.



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

def obligation_start_date
  @obligation_start_date
end

#project_end_dateObject

Returns the value of attribute project_end_date.



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

def project_end_date
  @project_end_date
end

#project_start_dateObject

Returns the value of attribute project_start_date.



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

def project_start_date
  @project_start_date
end

Returns the value of attribute sponsor_id.



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

def sponsor_id
  @sponsor_id
end

#transaction_typeObject

Returns the value of attribute transaction_type.



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

def transaction_type
  @transaction_type
end

#transactionsObject

Returns the value of attribute transactions.



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

def transactions
  @transactions
end

Instance Method Details

#add_funding_proposalObject

TODO: Add support for multiple funding proposals and merge types.



57
58
59
60
61
62
63
# File 'lib/kuality-coeus/data_objects/award/award.rb', line 57

def add_funding_proposal # TODO: Add support for multiple funding proposals and merge types.
  on Award do |page|
    page.expand_all
    page.institutional_proposal_number.set @funding_proposal
    page.add_proposal
  end
end

#add_transaction(opts = {}) ⇒ Object



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

def add_transaction opts={}
  defaults={award_id: @award_id}
  @transactions.add defaults.merge(opts)
end

#createObject



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

def create
  @creation_date = right_now[:date_w_slashes]
  visit(CentralAdmin).create_award
  on Award do |create|
    create.expand_all
    fill_out create, :description, :transaction_type, :award_status, :award_title,
             :activity_type, :award_type, :obligated_amount, :anticipated_amount,
             :project_start_date, :project_end_date, :obligation_start_date,
             :obligation_end_date
    set_sponsor_id
    set_lead_unit
    create.save
    @document_id = create.header_document_id
    @award_id = create.header_award_id
  end
  add_funding_proposal if @funding_proposal
end