Module: Eco::API::UseCases::GraphQL::Helpers::Base
- Includes:
- Language::AuxiliarLogger
- Included in:
- Base, Location::Base
- Defined in:
- lib/eco/api/usecases/graphql/helpers/base.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Attributes included from Language::AuxiliarLogger
Instance Method Summary collapse
-
#backup(data, type:) ⇒ Object
Keep a copy of the requests/responses for future reference.
- #config ⇒ Object
- #exit_error(msg) ⇒ Object
- #graphql ⇒ Object
- #simulate? ⇒ Boolean
Methods included from Language::AuxiliarLogger
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/eco/api/usecases/graphql/helpers/base.rb', line 4 def end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
4 5 6 |
# File 'lib/eco/api/usecases/graphql/helpers/base.rb', line 4 def session @session end |
Instance Method Details
#backup(data, type:) ⇒ Object
Keep a copy of the requests/responses for future reference
19 20 21 22 23 24 |
# File 'lib/eco/api/usecases/graphql/helpers/base.rb', line 19 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 |
#config ⇒ Object
10 11 12 |
# File 'lib/eco/api/usecases/graphql/helpers/base.rb', line 10 def config session.config end |
#exit_error(msg) ⇒ Object
26 27 28 29 |
# File 'lib/eco/api/usecases/graphql/helpers/base.rb', line 26 def exit_error(msg) logger.error(msg) exit(1) end |
#graphql ⇒ Object
6 7 8 |
# File 'lib/eco/api/usecases/graphql/helpers/base.rb', line 6 def graphql @graphql ||= session.api(version: :graphql) end |
#simulate? ⇒ Boolean
14 15 16 |
# File 'lib/eco/api/usecases/graphql/helpers/base.rb', line 14 def simulate? .dig(:simulate) end |