Skip to content

adamsinger/urbanairship_on_rails

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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
Acts As State Machine

=======
HOW TO CONFIGURE
=======

	=====
	Create an initializer named urbanairship.rb with the following content

	UA::Config::app_key      = 'YOUR_APP_KEY'
	UA::Config::app_secret   = 'YOUR_APP_SECRET'
	UA::Config::push_secret  = 'YOUR_PUSH_SECRET'

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

No packages published