
Introduction
PushRadar is a realtime notifications API service for the web. The service uses a simple publish-subscribe model, allowing you to broadcast "notifications" on "channels" that are subscribed to by one or more clients. Notifications are pushed in realtime to those clients.
PushRadar features advanced targeting options, including the ability to target clients by actions they have taken on your website or web app, geographical location (countries & continents), IP address, web browser and user ID.
This is PushRadar's official Ruby library.
Prerequisites
In order to use this library, please ensure that you have the following:
- A PushRadar account - you can sign up at www.pushradar.com.
Installation
To install PushRadar's Ruby gem, add this line to your application's Gemfile:
gem 'pushradar'
And then execute:
$ bundle
Alternatively, you can install it yourself by running the command:
$ gem install pushradar
Getting Started
"Hello World!" example:
require 'PushRadar'
include PushRadar
radar = Radar.new('your-secret-key')
radar.broadcast('test-channel', {message: 'Hello World!'})
Receiving Notifications
To subscribe to channels and receive notifications broadcast on them, check out the documentation for PushRadar's JavaScript client library.
Fluent Syntax
The library supports fluent method chaining to structure broadcasts. For example, to target a notification to website visitors in the US who have not used live chat before:
radar.target_country('US').target_not_action('live-chat').broadcast('test-channel',
{message: 'Would you like to talk to one of our customer support team members on live chat?'})
Please note that targeting options reset after each call to the broadcast method.
Documentation
Full documentation for PushRadar's Ruby library can be found at: www.pushradar.com/docs/ruby.