Class: UniqSysOmega::Tariffs::SingleTimeFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/single_time_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



28
29
30
31
# File 'lib/single_time_filter.rb', line 28

def calculate_cost(computer_id, , started_at, amount, options={})
  SingleTimeFilterRepository.had_single_payment?(tarif_id, , options[:period].begin) ?
          0 : @price
end

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

Returns:

  • (Boolean)


24
25
26
# File 'lib/single_time_filter.rb', line 24

def permitted?(computer_id, , options={})
  single_payment_setup? , options[:period].begin
end

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



33
34
35
36
37
38
39
# File 'lib/single_time_filter.rb', line 33

def process_activity(unprocessed_activity, ft, options={})
  if SingleTimeFilterRepository.had_single_payment?(tarif_id, unprocessed_activity., options[:period].begin)
    true
  else
    make_single_payment(ft, unprocessed_activity., options)
  end
end

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

Returns:

  • (Boolean)


20
21
22
# File 'lib/single_time_filter.rb', line 20

def start_permitted?(computer_id, , options={})
  single_payment_setup? , options[:period].begin
end