Class: GraphqlDevise::MountMethod::OptionValidators::ProvidedOperationsValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql_devise/mount_method/option_validators/provided_operations_validator.rb

Instance Method Summary collapse

Constructor Details

#initialize(options:, supported_operations:) ⇒ ProvidedOperationsValidator

Returns a new instance of ProvidedOperationsValidator.



7
8
9
10
# File 'lib/graphql_devise/mount_method/option_validators/provided_operations_validator.rb', line 7

def initialize(options:, supported_operations:)
  @options              = options
  @supported_operations = supported_operations
end

Instance Method Details

#validate!Object



12
13
14
15
16
17
18
19
20
# File 'lib/graphql_devise/mount_method/option_validators/provided_operations_validator.rb', line 12

def validate!
  supported_keys = @supported_operations.keys

  [
    SupportedOperationsValidator.new(provided_operations: @options.skip, key: :skip, supported_operations: supported_keys),
    SupportedOperationsValidator.new(provided_operations: @options.only, key: :only, supported_operations: supported_keys),
    SupportedOperationsValidator.new(provided_operations: @options.operations.keys, key: :operations, supported_operations: supported_keys)
  ].each(&:validate!)
end