https://github.com/tether/actionpusher
Apple Push Notifications for Rails. Compose and deliver push notifications for iOS using an ActionMailer inspired interface
https://github.com/tether/actionpusher
Last synced: 11 months ago
JSON representation
Apple Push Notifications for Rails. Compose and deliver push notifications for iOS using an ActionMailer inspired interface
- Host: GitHub
- URL: https://github.com/tether/actionpusher
- Owner: tether
- License: mit
- Created: 2014-04-24T17:02:13.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2015-05-19T15:01:15.000Z (about 11 years ago)
- Last Synced: 2025-03-25T18:07:38.565Z (about 1 year ago)
- Language: Ruby
- Homepage:
- Size: 158 KB
- Stars: 0
- Watchers: 15
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this 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](https://github.com/rails/rails/blob/980cdd30dc06e7cdf3490062731bb9f14789daec/actionmailer/lib/action_mailer/base.rb#L463)
* YAML based configuration for pem files
* Get working with DelayedJob: `MyPusher.delay.send_a_push_notification`
## Copyright
Copyright (c) 2014 PetroFeed. See [LICENSE](https://github.com/PetroFeed/actionpusher/blob/master/LICENSE) for further details.
---
Proudly brought to you by [PetroFeed](http://PetroFeed.com).
