Sha256: e3454b37588f71c42881c4fa8c44fbdd92e9cd0448c6661837bf95c0e21ad753

Contents?: true

Size: 827 Bytes

Versions: 8

Compression:

Stored size: 827 Bytes

Contents

module Pubnub
  class Envelope

    INSTANCE_VARIABLES = [
        :channel,
        :error,
        :error_message,
        :first,
        :history_end,
        :history_start,
        :last,
        :message,
        :object,
        :payload,
        :response,
        :response_message,
        :service,
        :status,
        :timetoken,
        :timetoken_update,
    ]

    INSTANCE_VARIABLES.each do |var_name|
      attr_accessor var_name
    end

    alias_method 'msg', 'message'
    alias_method 'status_code', 'status'

    def initialize(parameters, app)
      INSTANCE_VARIABLES.each do |var_name|
        instance_variable_set("@#{var_name.to_s}", parameters[var_name])
      end
    end

    def is_last?
      @last ? true : false
    end

    def is_first?
      @first ? true : false
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pubnub-3.5.14 lib/pubnub/envelope.rb
pubnub-3.5.12 lib/pubnub/envelope.rb
pubnub-3.5.8 lib/pubnub/envelope.rb
pubnub-3.5.7 lib/pubnub/envelope.rb
pubnub-3.5.6 lib/pubnub/envelope.rb
pubnub-3.5.5 lib/pubnub/envelope.rb
pubnub-3.5.3 lib/pubnub/envelope.rb
pubnub-3.5.1 lib/pubnub/envelope.rb