Sha256: d093c9502a16275849d2dab1d5697c6d1a4ef88c9e45b7794eab5454353f9c62

Contents?: true

Size: 737 Bytes

Versions: 6

Compression:

Stored size: 737 Bytes

Contents

module Pubnub
  class Subscribe
    include Pubnub::Event
    include Pubnub::SubscribeEvent
    include Pubnub::Formatter
    include Pubnub::Validator


    def initialize(options, app)
      super
      @event = 'subscribe'
      @allow_multiple_channels = true

    end

    def fire(app)
      app.update_timetoken(0)
      super
    end

    def validate!
      super
      # Check channels
      raise ArgumentError.new(:object => self, :message => 'Subscribe requires :channel or :channels argument') unless @channel

      # Check callback
      raise ArgumentError.new(:object => self, :message => 'Callback parameter is required while using async subscribe') if !@http_sync && @callback.blank?

    end

    private

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pubnub-3.5.14 lib/pubnub/events/subscribe.rb
pubnub-3.5.12 lib/pubnub/events/subscribe.rb
pubnub-3.5.8 lib/pubnub/events/subscribe.rb
pubnub-3.5.7 lib/pubnub/events/subscribe.rb
pubnub-3.5.6 lib/pubnub/events/subscribe.rb
pubnub-3.5.5 lib/pubnub/events/subscribe.rb