ZeroPush has been acquired by Twitter and will be shutting their doors on January 31, 2016. They have partnered with PushWoosh to provide a "code free" migration path. This gem offers a bridge between the former ZeroPush API and mirror PushWoosh API. Please note there have been only two minor changes:
- This gem and its files have been renamed from zero_push to zero_push_woosh to mark the bridge between the two providers
- The ZeroPush API endpoint URL has been replaced by the PushWoosh bridge API endpoint url (i.e. https://zeropush.pushwoosh.com)
Otherwise, all of the code remain the same as before.
Add this line to your application's Gemfile:
gem 'zero_push_woosh'
And then execute:
$ bundle
Or install it yourself as:
$ gem install zero_push_woosh
Generate the ZeroPushWoosh initializer if you are using Ruby on Rails.
$ rails g zero_push_woosh:install
The easiest way to use the API client is to set the server auth_token
at the module level and call methods on the ZeroPushWoosh module. You can find the token on settings page for your app.
ZeroPushWoosh.auth_token = 'iosprod_your-server-token'
ZeroPushWoosh.notify(device_tokens: ['abcdef'], alert: 'hello, world', badge: '+1', info: {user_id: 1234})
If your web application supports must support multiple mobile apps, you may configure it like this:
if Rails.env == 'development' #or ENV['RACK_ENV']
ZeroPushWoosh.auth_tokens = {
apns: 'iosdev_XYZ',
gcm: 'gcmdev_ABC',
}
else
ZeroPushWoosh.auth_tokens = {
apns: 'iosprod_XYZ',
gcm: 'gcmprod_ABC',
}
end
You may then instantiate clients by calling the method that matches the auth token key:
ZeroPushWoosh.apns.broadcast( ... )
ZeroPushWoosh.gcm.broadcast( ... )
Lastly, if you have many apps you may instantiate clients API Clients
client_1 = ZeroPushWoosh.client('iosprod_app-server-token-1')
client_1.broadcast(alert: 'hello, app1')
client_2 = ZeroPushWoosh.client('iosprod_app-server-token-2')
client_1.broadcast(alert: 'hello, app2')
Methods supported by this gem and their parameters can be found in the API Reference
For more documentation, check our Getting Started Guide with ZeroPushWoosh
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Write tests for your feature
- Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request