-
Notifications
You must be signed in to change notification settings - Fork 0
/
service_frontend.rb
59 lines (46 loc) · 1.1 KB
/
service_frontend.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
require_relative 'carhole_minder'
require_relative 'constants'
class ServiceFrontend
def initialize(carhole_minder)
@carhole_minder = carhole_minder
end
def door_open?
@carhole_minder.door_open?
end
def open_or_close_garage_door
if @carhole_minder.door_open?
result = :closing
else
result = :opening
end
@carhole_minder.open_or_close_garage_door
result
end
def timer_settings
@carhole_minder.timer_settings
end
def timer_setting_index
@carhole_minder.get_timer_setting_index
end
def advance_timer_setting
@carhole_minder.advance_timer_setting_and_update
@carhole_minder.get_timer_setting_index
end
def timer_setting_index=(value)
@carhole_minder.set_timer_setting_index value
end
def seconds_since_last_open
@carhole_minder.seconds_since_last_open
end
def door_last_opened_time
@carhole_minder.door_last_opened_time
end
def door_last_closed_time
@carhole_minder.door_last_closed_time
end
def door_close_attempted_time
@carhole_minder.door_close_attempted_time
end
private
@carhole_minder
end