Sha256: ae416471780ad8ac55d7423b758e9d80e7cfd064a02848d4afc628a3f6113629

Contents?: true

Size: 1.32 KB

Versions: 20

Compression:

Stored size: 1.32 KB

Contents

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

      def validate!
        return if @skip_validate
        validate_push_token!
        validate_push_gateway!
        validate_channel!
        validate_topic! if @push_gateway.eql? 'apns2'
      end

      private

      def validate_push_token!
        return unless @push_token.nil? || @push_token.empty?
        raise(
          ArgumentError.new,
          ':push_token is required for RemoveChannelsFromPush event.'
        )
      end

      def validate_push_gateway!
        return unless @push_gateway.nil? || @push_gateway.empty?
        raise(
          ArgumentError.new,
          ':push_gateway is required for RemoveChannelsFromPush event.'
        )
      end

      def validate_channel!
        return unless @channel.nil? || @channel.empty?
        raise(
          ArgumentError.new,
          ':channel is required for RemoveChannelsFromPush event.'
        )
      end

      def validate_topic!
        return unless @topic.nil? || @topic.empty?
        raise(
          ArgumentError.new,
          ':topic is required for RemoveChannelsFromPush event.'
        )
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
pubnub-5.3.5 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-5.3.4 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-5.3.3 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-5.3.2 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-5.3.1 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-5.3.0 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-5.2.2 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-5.2.1 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-5.2.0 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-5.1.2 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-5.1.1 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-5.1.0 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-5.0.0 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-4.8.0 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-4.7.1 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-4.7.0 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-4.6.2 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-4.6.1 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-4.6.0 lib/pubnub/validators/remove_channels_from_push.rb
pubnub-4.5.0 lib/pubnub/validators/remove_channels_from_push.rb