Sha256: e8a1d0fc50897c09b6cfba6577af61e6a6484c70902c56dea51571b2d27183d2

Contents?: true

Size: 887 Bytes

Versions: 9

Compression:

Stored size: 887 Bytes

Contents

# Toplevel Pubnub module.
# frozen_string_literal: true

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

      def validate!
        return if @skip_validate

        validate_data!
      end

      private

      def validate_data!
        data = @data

        if data.nil?
          raise(
            ArgumentError.new(
              object: self,
              message: 'data: No data supplied.'
            ),
            'data: No data supplied.'
          )
        end

        return unless !data[:id] || !data[:name]

        raise(
          ArgumentError.new(
            object: self,
            message: 'data: Space\'s id or name missing.'
          ),
          'data: Space\'s id or name missing.'
        )
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pubnub-4.3.0 lib/pubnub/validators/create_space.rb
pubnub-4.2.7 lib/pubnub/validators/create_space.rb
pubnub-4.2.6 lib/pubnub/validators/create_space.rb
pubnub-4.2.5 lib/pubnub/validators/create_space.rb
pubnub-4.2.4 lib/pubnub/validators/create_space.rb
pubnub-4.2.3 lib/pubnub/validators/create_space.rb
pubnub-4.2.2 lib/pubnub/validators/create_space.rb
pubnub-4.2.1 lib/pubnub/validators/create_space.rb
pubnub-4.2.0 lib/pubnub/validators/create_space.rb