Class: BookmarkReminderNotificationHandler
- Inherits:
-
Object
- Object
- BookmarkReminderNotificationHandler
- Defined in:
- lib/bookmark_reminder_notification_handler.rb
Instance Attribute Summary collapse
-
#bookmark ⇒ Object
readonly
Returns the value of attribute bookmark.
Instance Method Summary collapse
-
#initialize(bookmark) ⇒ BookmarkReminderNotificationHandler
constructor
A new instance of BookmarkReminderNotificationHandler.
- #send_notification ⇒ Object
Constructor Details
#initialize(bookmark) ⇒ BookmarkReminderNotificationHandler
Returns a new instance of BookmarkReminderNotificationHandler.
6 7 8 |
# File 'lib/bookmark_reminder_notification_handler.rb', line 6 def initialize(bookmark) @bookmark = bookmark end |
Instance Attribute Details
#bookmark ⇒ Object (readonly)
Returns the value of attribute bookmark.
4 5 6 |
# File 'lib/bookmark_reminder_notification_handler.rb', line 4 def bookmark @bookmark end |
Instance Method Details
#send_notification ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/bookmark_reminder_notification_handler.rb', line 10 def send_notification return if bookmark.blank? Bookmark.transaction do if !bookmark.registered_bookmarkable.can_send_reminder?(bookmark) bookmark.clear_reminder! else bookmark.registered_bookmarkable.send_reminder_notification(bookmark) if bookmark.auto_delete_when_reminder_sent? BookmarkManager.new(bookmark.user).destroy(bookmark.id) end bookmark.clear_reminder! end end end |