Module: Minato::Utils

Defined in:
lib/minato/utils.rb,
lib/minato/utils/client.rb,
lib/minato/utils/logger.rb,
lib/minato/utils/helpers.rb,
lib/minato/utils/version.rb,
lib/minato/utils/response.rb,
lib/minato/utils/exception.rb,
lib/minato/utils/configuration.rb,
lib/minato/utils/response_handler.rb,
lib/minato/utils/base_command/show.rb,
lib/minato/utils/base_command/index.rb,
lib/minato/utils/base_command/create.rb,
lib/minato/utils/base_command/update.rb,
lib/minato/utils/base_command/destroy.rb,
lib/minato/utils/base_command/show_by.rb,
lib/minato/utils/base_command/nested_scoped_index.rb

Defined Under Namespace

Modules: BaseCommand, Helpers Classes: BadGateway, BadRequest, BaseLogger, Client, Configuration, Conflict, Forbidden, Gone, LogFormatter, NetworkException, NotFound, Response, ResponseHandler, SerializableError, SerializableException, ServerError, ServiceUnavailable, Unauthorized, UnknownException, UnprocessableEntity

Constant Summary collapse

VERSION =
'0.5.2'

Class Method Summary collapse

Class Method Details

.configObject



22
23
24
# File 'lib/minato/utils/configuration.rb', line 22

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



18
19
20
# File 'lib/minato/utils/configuration.rb', line 18

def configure
  yield(config)
end

.loggerObject



73
74
75
# File 'lib/minato/utils/logger.rb', line 73

def logger
  @logger ||= BaseLogger.new(Minato::Utils.config.logger.dup)
end

.report_error(error:, status: nil) ⇒ Object



51
52
53
54
55
56
57
58
59
# File 'lib/minato/utils/exception.rb', line 51

def report_error(error:, status: nil)
  return unless Rails.env.production?

  Google::Cloud::ErrorReporting.report error do |error_event|
    error_event.http_status = status.nil? ? error.code : status
    error_event.service_version = ENV.fetch('RUNTIME_ENV', '?')
    error_event.service_name = ENV.fetch('SERVICE_NAME', '?')
  end
end