Class: Mailboxer::Receipt
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Mailboxer::Receipt
- Includes:
- PgSearch
- Defined in:
- app/models/mailboxer/receipt.rb
Class Method Summary collapse
-
.mark_as_deleted(options = {}) ⇒ Object
Marks the receipt as deleted.
-
.mark_as_not_deleted(options = {}) ⇒ Object
Marks the receipt as not deleted.
-
.mark_as_read(options = {}) ⇒ Object
Marks all the receipts from the relation as read.
-
.mark_as_unread(options = {}) ⇒ Object
Marks all the receipts from the relation as unread.
-
.move_to_inbox(options = {}) ⇒ Object
Moves all the receipts from the relation to inbox.
-
.move_to_sentbox(options = {}) ⇒ Object
Moves all the receipts from the relation to sentbox.
-
.move_to_trash(options = {}) ⇒ Object
Marks all the receipts from the relation as trashed.
-
.untrash(options = {}) ⇒ Object
Marks all the receipts from the relation as not trashed.
- .update_receipts(updates, options = {}) ⇒ Object
Instance Method Summary collapse
-
#conversation ⇒ Object
Returns the conversation associated to the receipt if the notification is a Message.
-
#is_trashed? ⇒ Boolean
Returns if the participant have trashed the Notification.
-
#is_unread? ⇒ Boolean
Returns if the participant have read the Notification.
-
#mark_as_deleted ⇒ Object
Marks the receipt as deleted.
-
#mark_as_not_deleted ⇒ Object
Marks the receipt as not deleted.
-
#mark_as_read ⇒ Object
Marks the receipt as read.
-
#mark_as_unread ⇒ Object
Marks the receipt as unread.
-
#move_to_inbox ⇒ Object
Moves the receipt to inbox.
-
#move_to_sentbox ⇒ Object
Moves the receipt to sentbox.
-
#move_to_trash ⇒ Object
Marks the receipt as trashed.
-
#untrash ⇒ Object
Marks the receipt as not trashed.
Class Method Details
.mark_as_deleted(options = {}) ⇒ Object
Marks the receipt as deleted
55 56 57 |
# File 'app/models/mailboxer/receipt.rb', line 55 def mark_as_deleted(={}) update_receipts({:deleted => true}, ) end |
.mark_as_not_deleted(options = {}) ⇒ Object
Marks the receipt as not deleted
60 61 62 |
# File 'app/models/mailboxer/receipt.rb', line 60 def mark_as_not_deleted(={}) update_receipts({:deleted => false}, ) end |
.mark_as_read(options = {}) ⇒ Object
Marks all the receipts from the relation as read
35 36 37 |
# File 'app/models/mailboxer/receipt.rb', line 35 def mark_as_read(={}) update_receipts({:is_read => true}, ) end |
.mark_as_unread(options = {}) ⇒ Object
Marks all the receipts from the relation as unread
40 41 42 |
# File 'app/models/mailboxer/receipt.rb', line 40 def mark_as_unread(={}) update_receipts({:is_read => false}, ) end |
.move_to_inbox(options = {}) ⇒ Object
Moves all the receipts from the relation to inbox
65 66 67 |
# File 'app/models/mailboxer/receipt.rb', line 65 def move_to_inbox(={}) update_receipts({:mailbox_type => :inbox, :trashed => false}, ) end |
.move_to_sentbox(options = {}) ⇒ Object
Moves all the receipts from the relation to sentbox
70 71 72 |
# File 'app/models/mailboxer/receipt.rb', line 70 def move_to_sentbox(={}) update_receipts({:mailbox_type => :sentbox, :trashed => false}, ) end |
.move_to_trash(options = {}) ⇒ Object
Marks all the receipts from the relation as trashed
45 46 47 |
# File 'app/models/mailboxer/receipt.rb', line 45 def move_to_trash(={}) update_receipts({:trashed => true}, ) end |
.untrash(options = {}) ⇒ Object
Marks all the receipts from the relation as not trashed
50 51 52 |
# File 'app/models/mailboxer/receipt.rb', line 50 def untrash(={}) update_receipts({:trashed => false}, ) end |
Instance Method Details
#conversation ⇒ Object
Returns the conversation associated to the receipt if the notification is a Message
122 123 124 |
# File 'app/models/mailboxer/receipt.rb', line 122 def conversation .conversation if .is_a? Mailboxer::Message end |
#is_trashed? ⇒ Boolean
Returns if the participant have trashed the Notification
132 133 134 |
# File 'app/models/mailboxer/receipt.rb', line 132 def is_trashed? trashed end |
#is_unread? ⇒ Boolean
Returns if the participant have read the Notification
127 128 129 |
# File 'app/models/mailboxer/receipt.rb', line 127 def is_unread? !is_read end |
#mark_as_deleted ⇒ Object
Marks the receipt as deleted
82 83 84 |
# File 'app/models/mailboxer/receipt.rb', line 82 def mark_as_deleted update_attributes(:deleted => true) end |
#mark_as_not_deleted ⇒ Object
Marks the receipt as not deleted
87 88 89 |
# File 'app/models/mailboxer/receipt.rb', line 87 def mark_as_not_deleted update_attributes(:deleted => false) end |
#mark_as_read ⇒ Object
Marks the receipt as read
92 93 94 |
# File 'app/models/mailboxer/receipt.rb', line 92 def mark_as_read update_attributes(:is_read => true) end |
#mark_as_unread ⇒ Object
Marks the receipt as unread
97 98 99 |
# File 'app/models/mailboxer/receipt.rb', line 97 def mark_as_unread update_attributes(:is_read => false) end |
#move_to_inbox ⇒ Object
Moves the receipt to inbox
112 113 114 |
# File 'app/models/mailboxer/receipt.rb', line 112 def move_to_inbox update_attributes(:mailbox_type => :inbox, :trashed => false) end |
#move_to_sentbox ⇒ Object
Moves the receipt to sentbox
117 118 119 |
# File 'app/models/mailboxer/receipt.rb', line 117 def move_to_sentbox update_attributes(:mailbox_type => :sentbox, :trashed => false) end |
#move_to_trash ⇒ Object
Marks the receipt as trashed
102 103 104 |
# File 'app/models/mailboxer/receipt.rb', line 102 def move_to_trash update_attributes(:trashed => true) end |
#untrash ⇒ Object
Marks the receipt as not trashed
107 108 109 |
# File 'app/models/mailboxer/receipt.rb', line 107 def untrash update_attributes(:trashed => false) end |