WANRING: This content is OLD!
Please visit https://github.com/pubnub/pubnub-api

Ruby Push API

Here we list all API calls for the Pubnub class in Ruby. This provides a complete Publish + Subscribe Push Notifications Framework in Ruby and Rails. Rails is not required to use this framework. Read the Blog on Ruby Push API for a more detailed walk-through of this reference.

Download Ruby Push API on GitHub

Initialize

	## Pubnub.new(pub_key, sub_key)
	pubnub = Pubnub.new( 'publish_key', 'subscribe_key' )

Grab your API Keys with the link below. Get API Keys You only need the Publish and Subscribe Keys. Ignore the Secret Key.

Publish

	## pubnub.publish( options )
	pubnub.publish({
	    'channel' => 'my_channel',
	    'message' => { 'my_var' => 'my text data' }
	})

Subscribe

	## pubnub.subscribe( options )
	pubnub.subscribe({
	    'channel ' => 'my_channel',
	    'callback' => lambda do |message|
	        puts(message['my_var']) ## print message
	        return true             ## keep listening?
	    end
	})

History

	## pubnub.history( options )
	messages = pubnub.history({
	    'channel' => 'my_channel',
	    'limit'   => 10
	})

That's it! Super simple right? For extra detail of the Ruby Push API Framework, follow this blog link below. Detailed Blog Ruby Push API