Class: GraphQL::DSL::ExecutableDocument

Inherits:
Node
  • Object
show all
Defined in:
lib/graphql/dsl/nodes/executable_document.rb

Overview

Executable document GraphQL node

Instance Attribute Summary

Attributes inherited from Node

#__name, #__nodes

Instance Method Summary collapse

Methods inherited from Node

#to_gql

Constructor Details

#initialize(&block) ⇒ ExecutableDocument

Create executable document

Parameters:

  • block (Proc)

    declare DSL for operations



12
13
14
# File 'lib/graphql/dsl/nodes/executable_document.rb', line 12

def initialize(&block)
  super(nil, &block)
end

Instance Method Details

#fragment(name, type, directives = [], &block) ⇒ void

This method returns an undefined value.

Create GraphQL fragment operation

Parameters:

  • name (String, Symbol)

    fragment name

  • type (String, Symbol)

    fragment type or interface

  • directives (Array<Directive, Hash, Array>) (defaults to: [])

    list of directives

  • block (Proc)

    declare DSL for sub-fields



64
65
66
# File 'lib/graphql/dsl/nodes/executable_document.rb', line 64

def fragment(name, type, directives = [], &block)
  @__nodes << FragmentOperation.new(name, type, directives, &block)
end

#mutation(name = nil, variable_definitions = {}, directives = [], &block) ⇒ void

This method returns an undefined value.

Create GraphQL mutation operation

Parameters:

  • name (String, Symbol, nil) (defaults to: nil)

    mutation name

  • variable_definitions (Hash) (defaults to: {})

    variable definitions

  • directives (Array<Directive, Hash, Array>) (defaults to: [])

    list of directives

  • block (Proc)

    declare DSL for sub-fields



38
39
40
# File 'lib/graphql/dsl/nodes/executable_document.rb', line 38

def mutation(name = nil, variable_definitions = {}, directives = [], &block)
  @__nodes << Operation.new(:mutation, name, variable_definitions, directives, &block)
end

#query(name = nil, variable_definitions = {}, directives = [], &block) ⇒ void

This method returns an undefined value.

Create GraphQL query operation

Parameters:

  • name (String, Symbol, nil) (defaults to: nil)

    query name

  • variable_definitions (Hash) (defaults to: {})

    variable definitions

  • directives (Array<Directive, Hash, Array>) (defaults to: [])

    list of directives

  • block (Proc)

    declare DSL for sub-fields



25
26
27
# File 'lib/graphql/dsl/nodes/executable_document.rb', line 25

def query(name = nil, variable_definitions = {}, directives = [], &block)
  @__nodes << Operation.new(:query, name, variable_definitions, directives, &block)
end

#subscription(name = nil, variable_definitions = {}, directives = [], &block) ⇒ void

This method returns an undefined value.

Create GraphQL subscription operation

Parameters:

  • name (String, Symbol, nil) (defaults to: nil)

    subscription name

  • variable_definitions (Hash) (defaults to: {})

    variable definitions

  • directives (Array<Directive, Hash, Array>) (defaults to: [])

    list of directives

  • block (Proc)

    declare DSL for sub-fields



51
52
53
# File 'lib/graphql/dsl/nodes/executable_document.rb', line 51

def subscription(name = nil, variable_definitions = {}, directives = [], &block)
  @__nodes << Operation.new(:subscription, name, variable_definitions, directives, &block)
end