Module: Tolliver::Models::Notification

Extended by:
ActiveSupport::Concern
Included in:
Notification
Defined in:
lib/tolliver/models/notification.rb

Instance Method Summary collapse

Instance Method Details

#deliver ⇒ Object


Service




54
55
56
# File 'lib/tolliver/models/notification.rb', line 54

def deliver
  Tolliver::Services::DeliveryService.instance.deliver(self)
end

#done ⇒ Object


Progress




40
41
42
43
44
45
46
47
48
# File 'lib/tolliver/models/notification.rb', line 40

def done
  sent_count = 0
  receivers_count = 0
  self.notification_deliveries.each do |notification_delivery|
    sent_count += notification_delivery.sent_count.to_i
    receivers_count += notification_delivery.receivers_count.to_i
  end
  sent_count.to_s + "/" + receivers_count.to_s
end

#enqueue_for_delivery ⇒ Object



58
59
60
# File 'lib/tolliver/models/notification.rb', line 58

def enqueue_for_delivery
  Tolliver::Services::DeliveryService.instance.enqueue_for_delivery(self)
end

#reset_delivery ⇒ Object



62
63
64
# File 'lib/tolliver/models/notification.rb', line 62

def reset_delivery
  Tolliver::Services::DeliveryService.instance.reset_delivery(self)
end