lib/the_help/service.rb in the_help-1.1.3 vs lib/the_help/service.rb in the_help-1.1.4
- old
+ new
@@ -1,12 +1,9 @@
# frozen_string_literal: true
require 'logger'
require 'set'
-require 'the_help/errors'
-require 'the_help/provides_callbacks'
-require 'the_help/service_caller'
module TheHelp
# An Abstract Service Class with Authorization and Logging
#
# Define subclasses of Service to build out the service layer of your
@@ -68,11 +65,11 @@
# The default :not_authorized callback
#
# It will raise a TheHelp::NotAuthorizedError when the context is not
# authorized to perform the service.
CB_NOT_AUTHORIZED = ->(service:, context:) {
- raise NotAuthorizedError,
+ raise TheHelp::NotAuthorizedError,
"Not authorized to access #{service.name} as #{context.inspect}."
}
class << self
# Defines attr_accessors with scoping options
@@ -187,11 +184,11 @@
raise ArgumentError, "Missing required input: #{r_input_name}."
end
end
def validate_service_definition
- raise AbstractClassError if self.class == TheHelp::Service
- raise ServiceNotImplementedError unless defined?(main)
+ raise TheHelp::AbstractClassError if self.class == TheHelp::Service
+ raise TheHelp::ServiceNotImplementedError unless defined?(main)
end
def log_service_call
logger.info("Service call to #{self.class.name} for #{context.inspect}")
end