Module: Eco::API::UseCases::GraphQL::Helpers::Base

Includes:
CaseEnv
Included in:
Base, Location::Base
Defined in:
lib/eco/api/usecases/graphql/helpers/base.rb,
lib/eco/api/usecases/graphql/helpers/base/case_env.rb

Defined Under Namespace

Modules: CaseEnv

Instance Attribute Summary

Attributes included from CaseEnv

#options, #session

Attributes included from Language::AuxiliarLogger

#logger

Instance Method Summary collapse

Methods included from CaseEnv

#config, #simulate?

Methods included from Language::AuxiliarLogger

#log

Instance Method Details

#backup(data, type:) ⇒ Object

Keep a copy of the requests/responses for future reference



11
12
13
14
15
16
# File 'lib/eco/api/usecases/graphql/helpers/base.rb', line 11

def backup(data, type:)
  dry_run   = simulate? ? "_dry_run" : ""
  dir       = config.people.requests_folder
  file      = File.join(dir, "#{type}#{dry_run}.json")
  session.file_manager.save_json(data, file, :timestamp)
end

#exit_error(msg) ⇒ Object



18
19
20
21
# File 'lib/eco/api/usecases/graphql/helpers/base.rb', line 18

def exit_error(msg)
  log(:error) { msg }
  exit(1)
end

#graphqlObject



6
7
8
# File 'lib/eco/api/usecases/graphql/helpers/base.rb', line 6

def graphql
  @graphql ||= session.api(version: :graphql)
end