Class: ConfigurationService::Test::Response::Failure
- Inherits:
-
Object
- Object
- ConfigurationService::Test::Response::Failure
- Defined in:
- lib/configuration_service/test/response.rb
Overview
Encapsulates an error ConfigurationService::Base response
This allows an OrchestrationProvider to decouple the Orchestrator from the implementation details of the service provider’s error handling.
Instance Method Summary collapse
-
#allowed? ⇒ Boolean
True unless the exception was an AuthorizationError.
-
#data ⇒ Object
Raises
NotImplementedError
. -
#failed? ⇒ Boolean
True if the exception was an Error but not an AuthorizationError.
-
#found? ⇒ Boolean
Always false.
-
#initialize(exception) ⇒ Failure
constructor
Initialize a new Failure with an exception.
-
#metadata ⇒ Object
Raises
NotImplementedError
. -
#revision ⇒ Object
Raises
NotImplementedError
.
Constructor Details
#initialize(exception) ⇒ Failure
Initialize a new Failure with an exception
89 90 91 |
# File 'lib/configuration_service/test/response.rb', line 89 def initialize(exception) @exception = exception end |
Instance Method Details
#allowed? ⇒ Boolean
True unless the exception was an AuthorizationError
96 97 98 |
# File 'lib/configuration_service/test/response.rb', line 96 def allowed? !@exception.is_a?(ConfigurationService::AuthorizationError) end |
#data ⇒ Object
Raises NotImplementedError
117 118 119 |
# File 'lib/configuration_service/test/response.rb', line 117 def data raise NotImplementedError, "configuration not available after #{@exception.inspect}" end |
#failed? ⇒ Boolean
True if the exception was an Error but not an AuthorizationError
103 104 105 |
# File 'lib/configuration_service/test/response.rb', line 103 def failed? allowed? and @exception.is_a?(ConfigurationService::Error) end |
#found? ⇒ Boolean
Always false
110 111 112 |
# File 'lib/configuration_service/test/response.rb', line 110 def found? false end |
#metadata ⇒ Object
Raises NotImplementedError
131 132 133 |
# File 'lib/configuration_service/test/response.rb', line 131 def raise NotImplementedError, "metadata not available after #{@exception.inspect}" end |
#revision ⇒ Object
Raises NotImplementedError
124 125 126 |
# File 'lib/configuration_service/test/response.rb', line 124 def revision raise NotImplementedError, "revision not available after #{@exception.inspect}" end |