Sha256: 04358ac1c1b3b85daa9a3f83eb666f4ce9e76ae6cceffa4248216d0b9c50ee05

Contents?: true

Size: 862 Bytes

Versions: 37

Compression:

Stored size: 862 Bytes

Contents

# Toplevel Pubnub module.
module Pubnub
  # Every message from server is formatted into easy to use Envelope object
  class Envelope
    # Ruby specific
    attr_accessor :id, :first, :last
    attr_accessor :history_start, :history_end

    # Pubnub Required
    attr_accessor :status, :result, :timetoken

    def initialize(options)
      @id = UUID.generate # internal usage only

      @event = options[:event]
      @event_options = options[:event_options]
      @status = options[:status]
      @result = options[:result]
      @timetoken = options[:timetoken]
    end

    def repeat(client, changes = {})
      client.send @event, @event_options.merge(changes)
    end

    def error?
      @status[:error]
    end

    # :nocov:
    def last?
      last
    end

    # :nocov:

    # :nocov:
    def first?
      first
    end

    # :nocov:
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
pubnub-5.5.0 lib/pubnub/envelope.rb
pubnub-5.4.0 lib/pubnub/envelope.rb
pubnub-5.3.5 lib/pubnub/envelope.rb
pubnub-5.3.4 lib/pubnub/envelope.rb
pubnub-5.3.3 lib/pubnub/envelope.rb
pubnub-5.3.2 lib/pubnub/envelope.rb
pubnub-5.3.1 lib/pubnub/envelope.rb
pubnub-5.3.0 lib/pubnub/envelope.rb
pubnub-5.2.2 lib/pubnub/envelope.rb
pubnub-5.2.1 lib/pubnub/envelope.rb
pubnub-5.2.0 lib/pubnub/envelope.rb
pubnub-5.1.2 lib/pubnub/envelope.rb
pubnub-5.1.1 lib/pubnub/envelope.rb
pubnub-5.1.0 lib/pubnub/envelope.rb
pubnub-5.0.0 lib/pubnub/envelope.rb
pubnub-4.8.0 lib/pubnub/envelope.rb
pubnub-4.7.1 lib/pubnub/envelope.rb
pubnub-4.7.0 lib/pubnub/envelope.rb
pubnub-4.6.2 lib/pubnub/envelope.rb
pubnub-4.6.1 lib/pubnub/envelope.rb