create convenient wrapper for sending and managing apple push notificaitons through urbanairship
Ruby
Pull request Compare This branch is even with rickerbh:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
generators/apn_migrations
lib
tasks
test
MIT-LICENSE
README
Rakefile
init.rb
install.rb
uninstall.rb

README

===================
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