RubyRuby V4 Mobile Push API Reference for Realtime Apps

Go to Storage & Playback


 

These docs are for PubNub 4.0 for Ruby which is our latest and greatest! For the docs of the older versions of the SDK, please check PubNub 3.0 for Ruby.

If you have questions about the PubNub for Ruby SDK, please contact us at support@pubnub.com.

Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Enable push notifications on provided set of channels.
To run Adding Device to Channel you can use the following method(s) in the Ruby V4 SDK
  1. ParameterTypeRequiredDescription
    push_tokenStringYesDevice ID.
    typeStringYesIndicates what backend to use.
    Accepted values are: gcm, apns and mpns.
    addStringYesComma separated list of channels to add.
pubnub = Pubnub.new(
	publish_key: 'pubkey',
	subscribe_key: 'subkey',
	uuid: 'uuid'
)
pubnub.add_channels_to_push(push_token: 'push_token', type: 'gcm', add: 'channel1, channel2').value
[1, "Modified Channels"]
Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Request for all channels on which push notification has been enabled using specified pushToken.
To run Listing Channels For Device you can use the following method(s) in the Ruby V4 SDK
  1. ParameterTypeRequiredDescription
    push_tokenStringYesDevice ID.
    typeStringYesIndicates what backend to use.
    Accepted values are: gcm, apns and mpns.
pubnub = Pubnub.new(
	publish_key: 'pubkey',
	subscribe_key: 'subkey',
	uuid: 'uuid'
)
pubnub.list_push_provisions(push_token: 'push_token', type: 'gcm').value
The output below demonstrates the response to a successful call:
will contain a list of channels registered for push notifications
Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Disable push notifications on provided set of channels. If nil will be passed as channels then client will remove push notifications from all channels which associated with pushToken.
To run Removing Device From Channel you can use the following method(s) in the Ruby V4 SDK
  1. ParameterTypeRequiredDescription
    push_tokenStringYesDevice ID.
    typeStringYesIndicates what backend to use.
    Accepted values are: gcm, apns and mpns.
    removeStringYesComma separated list of channels.
    auth_keyStringPAM authorization key - if PAM is ON.
pubnub = Pubnub.new(
	publish_key: 'pubkey',
	subscribe_key: 'subkey',
	uuid: 'uuid'
)
pubnub.remove_channels_from_push(remove: 'channel1,channel2', push_token: 'push_token', type: 'gcm').value
The output below demonstrates the response to a successful call:
[1, "Modified Channels"]
Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Disable push notifications from all channels which is registered with specified pushToken.
To run Remove all push notifications you can use the following method(s) in the Ruby V4 SDK
  1. ParameterTypeRequiredDescription
    push_tokenStringYesDevice ID.
    typeStringYesIndicates what backend to use.
    Accepted values are: gcm, apns and mpns.
    auth_keyStringPAM authorization key - if PAM is ON.
pubnub = Pubnub.new(
	publish_key: 'pubkey',
	subscribe_key: 'subkey',
	uuid: 'uuid'
)
pubnub.remove_device_from_push(push_token: 'push_token', type: 'gcm').value
The server responds with a status code of 200.

Go to MISCELLANEOUS