Class: UniqSysOmega::Tariffs::SingleTimeFilter
- Inherits:
-
Filter
- Object
- Filter
- UniqSysOmega::Tariffs::SingleTimeFilter
show all
- Defined in:
- lib/single_time_filter.rb
Instance Method Summary
collapse
-
#calculate_cost(computer_id, login_id, started_at, amount, options = {}) ⇒ Object
-
#permitted?(computer_id, login_id, options = {}) ⇒ Boolean
-
#process_activity(unprocessed_activity, ft, options = {}) ⇒ Object
-
#start_permitted?(computer_id, login_id, options = {}) ⇒ Boolean
Methods inherited from Filter
#initialize
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, login_id, started_at, amount, options={})
SingleTimeFilterRepository.had_single_payment?(tarif_id, login_id, options[:period].begin) ?
0 : @price
end
|
#permitted?(computer_id, login_id, options = {}) ⇒ Boolean
24
25
26
|
# File 'lib/single_time_filter.rb', line 24
def permitted?(computer_id, login_id, options={})
single_payment_setup? login_id, 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.login_id, options[:period].begin)
true
else
make_single_payment(ft, unprocessed_activity.login_id, options)
end
end
|
#start_permitted?(computer_id, login_id, options = {}) ⇒ Boolean
20
21
22
|
# File 'lib/single_time_filter.rb', line 20
def start_permitted?(computer_id, login_id, options={})
single_payment_setup? login_id, options[:period].begin
end
|