Class: Ecoportal::API::GraphQL::Logic::Mutation

Inherits:
BaseQuery
  • Object
show all
Defined in:
lib/ecoportal/api/graphql/logic/mutation.rb

Defined Under Namespace

Classes: GenericInput, GenericPayload

Instance Attribute Summary

Attributes inherited from BaseQuery

#base_path, #client

Instance Method Summary collapse

Methods inherited from BaseQuery

accepted_params, #access_point, clear_accepted_params, field_name, #initialize, param_defaults, #path, slice_params

Constructor Details

This class inherits a constructor from Ecoportal::API::GraphQL::Logic::BaseQuery

Instance Method Details

#query(input:, path: self.path, &block) ⇒ Class

Query rely that manages the different blocks.

Returns:

  • (Class)

    an object of response_class with the results hanving from path.



22
23
24
25
26
27
28
29
30
# File 'lib/ecoportal/api/graphql/logic/mutation.rb', line 22

def query(input:, path: self.path, &block)
  request(*path) do
    client.query(input: as_input(input), &basic_block(&block))
  end
rescue Faraday::ParsingError, Graphlient::Errors::FaradayServerError => e
  puts "Internal Error with these input ('#{input.class}'):"
  pp input
  raise
end

#response_classObject



32
33
34
# File 'lib/ecoportal/api/graphql/logic/mutation.rb', line 32

def response_class
  payload_class
end