Class: CostSharingObject
- Inherits:
-
Object
- Object
- CostSharingObject
- Includes:
- DataFactory, Foundry, Navigation, StringFactory
- Defined in:
- lib/kuality-coeus/data_objects/budget/cost_sharing.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#index ⇒ Object
Returns the value of attribute index.
-
#percentage ⇒ Object
Returns the value of attribute percentage.
-
#project_period ⇒ Object
Returns the value of attribute project_period.
-
#source_account ⇒ Object
Returns the value of attribute source_account.
Instance Method Summary collapse
- #create ⇒ Object
- #edit(opts) ⇒ Object
-
#initialize(browser, opts = {}) ⇒ CostSharingObject
constructor
A new instance of CostSharingObject.
- #view ⇒ Object
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 = {}) ⇒ CostSharingObject
Returns a new instance of CostSharingObject.
10 11 12 13 14 15 16 17 18 |
# File 'lib/kuality-coeus/data_objects/budget/cost_sharing.rb', line 10 def initialize(browser, opts={}) @browser = browser defaults = { percentage: '0.00', source_account: random_alphanums } (defaults.merge(opts)) end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/cost_sharing.rb', line 8 def amount @amount end |
#index ⇒ Object
Returns the value of attribute index.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/cost_sharing.rb', line 8 def index @index end |
#percentage ⇒ Object
Returns the value of attribute percentage.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/cost_sharing.rb', line 8 def percentage @percentage end |
#project_period ⇒ Object
Returns the value of attribute project_period.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/cost_sharing.rb', line 8 def project_period @project_period end |
#source_account ⇒ Object
Returns the value of attribute source_account.
8 9 10 |
# File 'lib/kuality-coeus/data_objects/budget/cost_sharing.rb', line 8 def source_account @source_account end |
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/kuality-coeus/data_objects/budget/cost_sharing.rb', line 20 def create view on DistributionAndIncome do |page| page.add_cost_share_period.set @project_period # TODO: Add more here when needed page.add end end |
#edit(opts) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/kuality-coeus/data_objects/budget/cost_sharing.rb', line 35 def edit(opts) view on DistributionAndIncome do |page| page. page.cost_sharing_project_period(@index).fit opts[:project_period] page.cost_sharing_percentage(@index).fit opts[:percentage] page.cost_sharing_source_account(@index).fit opts[:source_account] page.cost_sharing_amount(@index).fit opts[:amount] page.save end (opts) end |
#view ⇒ Object
29 30 31 32 33 |
# File 'lib/kuality-coeus/data_objects/budget/cost_sharing.rb', line 29 def view # Note: Currently assumes we're already viewing # the budget document! on(Parameters).distribution__income end |