Class: Notifiable::NotificationStatus

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/notifiable/notification_status.rb

Constant Summary collapse

REJECTED_STATUS =
1
SENT_STATUS =
2
DELIVERED_STATUS =
3
OPENED_STATUS =
4

Instance Method Summary collapse

Instance Method Details

#delivered!Object



26
27
28
# File 'lib/notifiable/notification_status.rb', line 26

def delivered!
  update_attributes(status: DELIVERED_STATUS)
end

#delivered?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/notifiable/notification_status.rb', line 30

def delivered?
  status == DELIVERED_STATUS
end

#opened!Object



34
35
36
# File 'lib/notifiable/notification_status.rb', line 34

def opened!
  update_attributes(status: OPENED_STATUS)
end

#opened?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/notifiable/notification_status.rb', line 38

def opened?
  status == OPENED_STATUS
end

#rejected!Object



18
19
20
# File 'lib/notifiable/notification_status.rb', line 18

def rejected!
  update_attributes(status: REJECTED_STATUS)
end

#sent!Object



22
23
24
# File 'lib/notifiable/notification_status.rb', line 22

def sent!
  update_attributes(status: SENT_STATUS)
end