Class: GraphqlRails::Controller::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/graphql_rails/controller/request.rb,
lib/graphql_rails/controller/request/format_errors.rb

Overview

Contains all info related with single request to controller

Direct Known Subclasses

RSpecControllerHelpers::Request

Defined Under Namespace

Classes: FormatErrors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(graphql_object, inputs, context) ⇒ Request

Returns a new instance of Request.



12
13
14
15
16
17
# File 'lib/graphql_rails/controller/request.rb', line 12

def initialize(graphql_object, inputs, context)
  @graphql_object = graphql_object
  @inputs = inputs.except(:lookahead)
  @lookahead = inputs[:lookahead]
  @context = context
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



10
11
12
# File 'lib/graphql_rails/controller/request.rb', line 10

def context
  @context
end

#errorsObject

Returns the value of attribute errors.



10
11
12
# File 'lib/graphql_rails/controller/request.rb', line 10

def errors
  @errors
end

#lookaheadObject (readonly)

Returns the value of attribute lookahead.



10
11
12
# File 'lib/graphql_rails/controller/request.rb', line 10

def lookahead
  @lookahead
end

#object_to_returnObject

Returns the value of attribute object_to_return.



9
10
11
# File 'lib/graphql_rails/controller/request.rb', line 9

def object_to_return
  @object_to_return
end

Instance Method Details

#no_object_to_return?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/graphql_rails/controller/request.rb', line 25

def no_object_to_return?
  !defined?(@object_to_return)
end

#paramsObject



29
30
31
32
33
# File 'lib/graphql_rails/controller/request.rb', line 29

def params
  deep_transform_values(inputs.to_h) do |val|
    graphql_object_to_hash(val)
  end
end