Class: UniqSysOmega::Tariffs::RateFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/rate_filter.rb

Instance Method Summary collapse

Methods inherited from Filter

#initialize

Constructor Details

This class inherits a constructor from UniqSysOmega::Tariffs::Filter

Instance Method Details

#calculate_cost(computer_id, login_id, started_at, amount, options = {}) ⇒ Object



13
14
15
# File 'lib/rate_filter.rb', line 13

def calculate_cost(computer_id, , started_at, amount, options={})
  amount/3600*@rate
end

#permitted?(computer_id, login_id, options = {}) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/rate_filter.rb', line 9

def permitted?(computer_id, , options={})
  true
end

#process_activity(unprocessed_activity, ft, options = {}) ⇒ Object



17
18
19
20
21
22
# File 'lib/rate_filter.rb', line 17

def process_activity(unprocessed_activity, ft, options={})
  ft = ft.clone
  ft.volume = unprocessed_activity.amount/3600*@rate
  ft.save!
  true
end

#start_permitted?(computer_id, login_id, options = {}) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/rate_filter.rb', line 5

def start_permitted?(computer_id, , options={})
  true
end