Sha256: 9422e431d9c4a72d855c7af7570b7d8ca82fd7414f39a8c691fa2bec00b0c2ce

Contents?: true

Size: 834 Bytes

Versions: 14

Compression:

Stored size: 834 Bytes

Contents

# Toplevel Pubnub module.
module Pubnub
  # Validator module that holds all validators modules
  module Validator
    # Validator for Grant event
    module RevokeToken
      include CommonValidator

      def validate!
        validate_keys!
        validate_token!
      end

      private

      def validate_keys!
        raise(
          ArgumentError.new(object: self, message: ':subscribe_key is required for revoke token event.'),
          ':subscribe_key is required for grant token event.'
        ) if @subscribe_key.nil? || @subscribe_key.empty?
      end

      def validate_token!
        raise(
          ArgumentError.new(object: self, message: ':token is required for revoke token event.'),
          ':token is required for revoke token event.'
        ) if @token.nil? || @token.empty?
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
pubnub-5.3.5 lib/pubnub/validators/revoke_token.rb
pubnub-5.3.4 lib/pubnub/validators/revoke_token.rb
pubnub-5.3.3 lib/pubnub/validators/revoke_token.rb
pubnub-5.3.2 lib/pubnub/validators/revoke_token.rb
pubnub-5.3.1 lib/pubnub/validators/revoke_token.rb
pubnub-5.3.0 lib/pubnub/validators/revoke_token.rb
pubnub-5.2.2 lib/pubnub/validators/revoke_token.rb
pubnub-5.2.1 lib/pubnub/validators/revoke_token.rb
pubnub-5.2.0 lib/pubnub/validators/revoke_token.rb
pubnub-5.1.2 lib/pubnub/validators/revoke_token.rb
pubnub-5.1.1 lib/pubnub/validators/revoke_token.rb
pubnub-5.1.0 lib/pubnub/validators/revoke_token.rb
pubnub-5.0.0 lib/pubnub/validators/revoke_token.rb
pubnub-4.8.0 lib/pubnub/validators/revoke_token.rb