Module: RequestParamsValidation

Defined in:
lib/request_params_validation.rb,
lib/request_params_validation/engine.rb,
lib/request_params_validation/params.rb,
lib/request_params_validation/handler.rb,
lib/request_params_validation/helpers.rb,
lib/request_params_validation/version.rb,
lib/request_params_validation/definitions.rb,
lib/request_params_validation/params/constants.rb,
lib/request_params_validation/params/converter.rb,
lib/request_params_validation/params/validator.rb,
lib/request_params_validation/definitions/param.rb,
lib/request_params_validation/definitions/action.rb,
lib/request_params_validation/definitions/request.rb,
lib/request_params_validation/definitions/resource.rb,
lib/request_params_validation/exceptions/base_errors.rb,
lib/request_params_validation/params/validators/type.rb,
lib/request_params_validation/params/validators/value.rb,
lib/request_params_validation/params/types/conversions.rb,
lib/request_params_validation/params/types/validations.rb,
lib/request_params_validation/params/validators/custom.rb,
lib/request_params_validation/params/validators/format.rb,
lib/request_params_validation/params/validators/length.rb,
lib/request_params_validation/params/validators/presence.rb,
lib/request_params_validation/exceptions/validator_errors.rb,
lib/request_params_validation/params/validators/inclusion.rb,
lib/request_params_validation/exceptions/definitions_errors.rb

Defined Under Namespace

Modules: Definitions, ExceptionsConfiguration, ExtensionConfiguration, FormatsConfiguration, Handler, Helpers, Params Classes: DefinitionArgumentError, DefinitionNotFoundError, DefinitionsError, Engine, GeneralError, InvalidParameterValueError, MissingParameterError, RequestParamError, UnsupportedTypeError

Constant Summary collapse

VERSION =
'0.4.0'

Class Method Summary collapse

Class Method Details

.configure {|_self| ... } ⇒ Object

Default way to setup RequestParamsValidation configuration.

Yields:

  • (_self)

Yield Parameters:



310
311
312
# File 'lib/request_params_validation.rb', line 310

def self.configure
  yield self
end

.define(&block) ⇒ Object

Method for defining a resource. This is the entrypoint for each resource configuration.



304
305
306
# File 'lib/request_params_validation.rb', line 304

def self.define(&block)
  RequestParamsValidation::Definitions.register_resource(&block)
end

.exceptionsObject

Default way to setup exceptions configuration if a block is given, otherwise it returns the ExceptionConfiguration module.



339
340
341
342
343
344
345
# File 'lib/request_params_validation.rb', line 339

def self.exceptions
  if block_given?
    yield ExceptionsConfiguration
  else
    ExceptionsConfiguration
  end
end

.extendsObject

Default way to extend configuration if a block is given, otherwise it returns the ExtensionConfiguration module.



317
318
319
320
321
322
323
# File 'lib/request_params_validation.rb', line 317

def self.extends
  if block_given?
    yield ExtensionConfiguration
  else
    ExtensionConfiguration
  end
end

.formatsObject

Default way to setup formats configuration if a block is given, otherwise it returns the FormatsConfiguration module.



328
329
330
331
332
333
334
# File 'lib/request_params_validation.rb', line 328

def self.formats
  if block_given?
    yield FormatsConfiguration
  else
    FormatsConfiguration
  end
end