0.0
No commit activity in last 3 years
No release in over 3 years
Apple Push Notifications for Rails. Compose and deliver push notifications for iOS
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 2.14.1

Runtime

~> 2.0.2
< 5.0, >= 4.0
 Project Readme

Action Pusher

ActionPusher is an ActionMailer inspired gem to make sending push notifications from Rails as easy as sending emails.

To use, require the gem inside your Gemfile:

gem 'actionpusher', require: 'action_pusher'

Make sure your .pem files are under config/certificates. Then create a config/certificates.yml file and a setup for each environment. Here's an example with a development and production configuration:

development:
  name: 'push-notification-development.pem'

production:
  name: 'push-notification-production.pem'

Then you can define a push sender. We define our pushers inside of app/pushers like so:

# app/pushers/my_pusher.rb

class MyPusher < ActionPusher::Base
  def send_a_push_notification
    push(tokens: ['an', 'array', 'of', 'device', 'tokens'],
      message: 'message being sent',
      data: 'extra data sent with the push notification')
  end
end

Your push notifications can then be called like a standard Rails mailer:

MyPusher.send_a_push_notification.deliver

In the event that you're using Delayed::Job for your background processing, you can work with it in the same way that ActionMailer would:

MyPusher.delay.send_a_push_notification

TODO

  • Implement interceptor pattern
  • YAML based configuration for pem files
  • Get working with DelayedJob: MyPusher.delay.send_a_push_notification

Copyright

Copyright (c) 2014 PetroFeed. See LICENSE for further details.


Proudly brought to you by PetroFeed.

Pedro