class RailsPushNotifications::BaseApp
Abstract. This class is the base of all application entity type.
@author Carlos Alonso
Public Instance Methods
push_notifications()
click to toggle source
This method will find all notifications owned by this app and push them.
# File lib/rails-push-notifications/apps/base_app.rb, line 18 def push_notifications pending = find_pending to_send = pending.map do |notification| notification_type.new notification.destinations, notification.data end pusher = build_pusher pusher.push to_send pending.each_with_index do |p, i| p.update_attributes! results: to_send[i].results end end
Protected Instance Methods
find_pending()
click to toggle source
Method that searches the owned notifications for those not yet sent
# File lib/rails-push-notifications/apps/base_app.rb, line 35 def find_pending notifications.where sent: false end