Sha256: 2e0d9480f0b0710db8f63337d3ae5c6b92af78eccbc13c26eb98232b6672a4bf

Contents?: true

Size: 597 Bytes

Versions: 26

Compression:

Stored size: 597 Bytes

Contents

module Graphiti
  class RequestValidator
    delegate :validate,
      :validate!,
      :errors,
      :deserialized_payload,
      to: :@validator

    def initialize(root_resource, raw_params, action)
      @validator = ValidatorFactory.create(root_resource, raw_params, action)
    end

    class ValidatorFactory
      def self.create(root_resource, raw_params, action)
        case action
        when :update then
          RequestValidators::UpdateValidator
        else
          RequestValidators::Validator
        end.new(root_resource, raw_params, action)
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
graphiti-1.3.5 lib/graphiti/request_validator.rb
graphiti-1.3.4 lib/graphiti/request_validator.rb
graphiti-1.3.3 lib/graphiti/request_validator.rb
graphiti-1.3.2 lib/graphiti/request_validator.rb
graphiti-1.3.1 lib/graphiti/request_validator.rb
graphiti-1.3.0 lib/graphiti/request_validator.rb
graphiti-1.2.44 lib/graphiti/request_validator.rb
graphiti-1.2.43 lib/graphiti/request_validator.rb
graphiti-1.2.42 lib/graphiti/request_validator.rb
graphiti-1.2.41 lib/graphiti/request_validator.rb
graphiti-1.2.40 lib/graphiti/request_validator.rb
graphiti-1.2.39 lib/graphiti/request_validator.rb
graphiti-1.2.38 lib/graphiti/request_validator.rb
graphiti-1.2.37 lib/graphiti/request_validator.rb
graphiti-1.2.36 lib/graphiti/request_validator.rb
graphiti-1.2.35 lib/graphiti/request_validator.rb
graphiti-1.2.34 lib/graphiti/request_validator.rb
graphiti-1.2.33 lib/graphiti/request_validator.rb
graphiti-1.2.32 lib/graphiti/request_validator.rb
graphiti-1.2.31 lib/graphiti/request_validator.rb