Module: Pubnub::Client::PagedHistory

Included in:
Pubnub::Client
Defined in:
lib/pubnub/client/paged_history.rb

Overview

Module that holds paged_history event logic

Instance Method Summary collapse

Instance Method Details

#paged_history(options = {}, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/pubnub/client/paged_history.rb', line 7

def paged_history(options = {}, &block)
  channel  = options.fetch(:channel)
  page     = options.fetch(:page, 1)
  limit    = options.fetch(:limit, 100)
  callback = options.fetch(:callback, block)
  sync     = options[:http_sync]
  start_tt = options.fetch(:start)
  end_tt   = options.fetch(:end)
  if sync
    sync_paged_history(channel, page, limit, callback, start: start_tt, end: end_tt)
  else
    async_paged_history(options)
  end
end