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

#deliverObject

*********************************************************************** Service ***********************************************************************



48
49
50
# File 'lib/tolliver/models/notification.rb', line 48

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

#doneObject

*********************************************************************** Progress ***********************************************************************



34
35
36
37
38
39
40
41
42
# File 'lib/tolliver/models/notification.rb', line 34

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_deliveryObject



52
53
54
# File 'lib/tolliver/models/notification.rb', line 52

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

#reset_deliveryObject



56
57
58
# File 'lib/tolliver/models/notification.rb', line 56

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