Sha256: 733d9ffc6eaefbbd056b0745fadc3da8058ea5d8f07236a2767a35637a4ad487

Contents?: true

Size: 1019 Bytes

Versions: 4

Compression:

Stored size: 1019 Bytes

Contents

## -----------------------------------
## PubNub Ruby API History Example
## -----------------------------------

## including required libraries
require 'rubygems'
require 'pubnub'

## declaring publish_key, subscribe_key, secret_key, cipher_key and ssl flag
publish_key   = 'demo'
subscribe_key = 'demo'
secret_key    = 'demo'
cipher_key    = 'demo'
ssl_on        = false

## Print usage if missing info.
if !subscribe_key
  puts('
  Get API Keys at http://www.pubnub.com/account
  ==============
  EXAMPLE USAGE:
  ==============
  ruby history-example.rb PUBLISH-KEY SUBSCRIBE-KEY SSL-ON
  ruby history-example.rb demo demo true
  ')
end

## Create Pubnub Client API (INITIALIZATION)
puts('Initializing new Pubnub state')
pubnub = Pubnub.new(publish_key,subscribe_key,secret_key,cipher_key,ssl_on)

## Request Past Publishes (HISTORY)
puts('Requesting History with history() Function')
message = pubnub.history({
  'channel' => 'hello_world',
  'limit'   => 5
})
puts(message)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pubnub-0.1.10 examples/history_example.rb
pubnub-0.1.9 examples/history_example.rb
pubnub-0.1.8 examples/history_example.rb
pubnub-0.1.7 examples/history_example.rb