-
Notifications
You must be signed in to change notification settings - Fork 10
create convenient wrapper for sending and managing apple push notificaitons through urbanairship
License
rickerbh/urbanairship_on_rails
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
=================== URBAN AIRSHIP ON RAILS =================== Borrowed Liberally from APN on Rails Gem but designed to interface with urbanairship for simplicity, ease of use, and speedy deployment of push notifications uses identical data schema to APN.. perhaps allowing future upgrade to APN ======= DEPENDENCIES ======= requires JSON gem AASM ======= HOW TO INSTALL ======= ruby script/plugin install git://github.com/rickerbh/urbanairship_on_rails.git ======= HOW TO CONFIGURE ======= ===== Create an initializer named urbanairship.rb with the following content require File.dirname(__FILE__) + '/../../vendor/plugins/urbanairship_on_rails/lib/urbanairship_on_rails/libs/config' UA::Config::app_key = 'YOUR_APP_KEY' UA::Config::app_secret = 'YOUR_APP_SECRET' UA::Config::push_secret = 'YOUR_PUSH_SECRET' UA::Config::push_host = 'go.urbanairship.com' UA::Config::push_port = '443' ===== Create User => Device relationship belongs_to :device, :class_name=>"APN::Device" ===== Set up a daily cron job to clean out inactive device registrations rake apn:feedback or script/runner APN:Feedback.create().run Set up a cron job to push and manage notifications rake apn:push or script/runner APN::Notification.process_pending ======= API CALLS and current support level ======= REGISTRATION APN::Device.register => HTTP PUT to /api/device_tokens/<device_token> APN::Device.read => HTTP GET to /api/device_tokens/<device_token> APN::Device.unregister => HTTP DELETE to /api/device_tokens/<device_token> PUSH APN::Notifcation.push => HTTP POST to /api/push/ BATCH PUSH NOT YET SUPPORTED BROADCAST NOT YET SUPPORTED FEEDBACK SERVICE APN::Feedback.push( => HTTP GET to /api/device_tokens/feedback/?since=<timestamp> STATISTICS NOT YET SUPPORTED ======= Example ======= To Create and register a device user.device.create(:token => "token_from_device") user.device.register(options) To Read device and tags user.device.read To unregister a device user.device.unregister To destroy device record (and unregister) user.device.destroy To create push notification user.device.create_notification.create(:badge=>'', :alert=>'', :sound=>'') To immediately push a notification user.device.notifications.last.push Copyright (c) 2009 [Russell Sherman(code-ronin@code-ronin.com)], released under the MIT license
About
create convenient wrapper for sending and managing apple push notificaitons through urbanairship
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published