Class: UserNotificationScheduleProcessor
- Inherits:
-
Object
- Object
- UserNotificationScheduleProcessor
- Defined in:
- app/services/user_notification_schedule_processor.rb
Instance Attribute Summary collapse
-
#schedule ⇒ Object
Returns the value of attribute schedule.
-
#timezone_name ⇒ Object
Returns the value of attribute timezone_name.
-
#user ⇒ Object
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
- #create_do_not_disturb_timings ⇒ Object
-
#initialize(schedule) ⇒ UserNotificationScheduleProcessor
constructor
A new instance of UserNotificationScheduleProcessor.
Constructor Details
#initialize(schedule) ⇒ UserNotificationScheduleProcessor
Returns a new instance of UserNotificationScheduleProcessor.
6 7 8 9 10 |
# File 'app/services/user_notification_schedule_processor.rb', line 6 def initialize(schedule) @schedule = schedule @user = schedule.user @timezone_name = user.user_option.timezone end |
Instance Attribute Details
#schedule ⇒ Object
Returns the value of attribute schedule.
4 5 6 |
# File 'app/services/user_notification_schedule_processor.rb', line 4 def schedule @schedule end |
#timezone_name ⇒ Object
Returns the value of attribute timezone_name.
4 5 6 |
# File 'app/services/user_notification_schedule_processor.rb', line 4 def timezone_name @timezone_name end |
#user ⇒ Object
Returns the value of attribute user.
4 5 6 |
# File 'app/services/user_notification_schedule_processor.rb', line 4 def user @user end |
Class Method Details
.create_do_not_disturb_timings_for(schedule) ⇒ Object
18 19 20 21 |
# File 'app/services/user_notification_schedule_processor.rb', line 18 def self.create_do_not_disturb_timings_for(schedule) processor = UserNotificationScheduleProcessor.new(schedule) processor.create_do_not_disturb_timings end |
Instance Method Details
#create_do_not_disturb_timings ⇒ Object
12 13 14 15 16 |
# File 'app/services/user_notification_schedule_processor.rb', line 12 def create_do_not_disturb_timings local_time = Time.now.in_time_zone(timezone_name) create_timings_for(local_time, days: 2) end |