Sha256: 8264ecec994e4412bd01d83f63ab8013cabde6532e87685eeae848f307461416

Contents?: true

Size: 608 Bytes

Versions: 8

Compression:

Stored size: 608 Bytes

Contents

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

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

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
graphiti-1.2.16 lib/graphiti/request_validator.rb
graphiti-1.2.15 lib/graphiti/request_validator.rb
graphiti-1.2.14 lib/graphiti/request_validator.rb
graphiti-1.2.13 lib/graphiti/request_validator.rb
graphiti-1.2.12 lib/graphiti/request_validator.rb
graphiti-1.2.11 lib/graphiti/request_validator.rb
graphiti-1.2.10 lib/graphiti/request_validator.rb
graphiti-1.2.9 lib/graphiti/request_validator.rb