Sha256: d1d7da6c0dc645b0ab22fae906332825f57297a0f2a7044c17e54f8d920c43c4

Contents?: true

Size: 961 Bytes

Versions: 21

Compression:

Stored size: 961 Bytes

Contents

# Toplevel Pubnub module.
# frozen_string_literal: true

module Pubnub
  # Validator module that holds all validators modules
  module Validator
    # Validator for GetUuidMetadata event
    module GetUuidMetadata
      include CommonValidator

      def validate!
        return if @skip_validate

        validate_subscribe_key!
        validate_uuid!
      end

      private

      def validate_subscribe_key!
        return unless @subscribe_key.nil?

        raise(
          ArgumentError.new(object: self, message: ':subscribe_key is required for get uuid metadata event.'),
          ':subscribe_key is required for get uuid metadata event.'
        )
      end

      def validate_uuid!
        return unless @uuid.nil? || @uuid.empty?

        raise(
          ArgumentError.new(object: self, message: ':uuid is required for get uuid metadata event.'),
          ':uuid is required for get uuid metadata event.'
        )
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

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