Class: ConfigurationService::Test::Response::Failure
- Inherits:
-
Object
- Object
- ConfigurationService::Test::Response::Failure
- Defined in:
- lib/configuration_service/test/response.rb
Overview
Encapsulates a configuration service error
This allows a OrchestrationProvider to decouple the Orchestrator from the semantics of the configuration service’s error handling.
Instance Method Summary collapse
-
#allowed? ⇒ true, false
Whether the request was allowed.
-
#data ⇒ Object
The configuration data dictionary of the response.
-
#failed? ⇒ true, false
Whether the request was authorized but failed.
-
#found? ⇒ false
Whether the identified configuration was found.
-
#initialize(exception) ⇒ Failure
constructor
A new instance of Failure.
-
#metadata ⇒ Object
The configuration metadata’s revision.
-
#revision ⇒ Object
The configuration metadata’s revision.
Constructor Details
#initialize(exception) ⇒ Failure
Returns a new instance of Failure.
105 106 107 |
# File 'lib/configuration_service/test/response.rb', line 105 def initialize(exception) @exception = exception end |
Instance Method Details
#allowed? ⇒ true, false
Whether the request was allowed
115 116 117 |
# File 'lib/configuration_service/test/response.rb', line 115 def allowed? !@exception.is_a?(ConfigurationService::AuthorizationError) end |
#data ⇒ Object
The configuration data dictionary of the response
143 144 145 |
# File 'lib/configuration_service/test/response.rb', line 143 def data raise NotImplementedError, "configuration not available after #{@exception.inspect}" end |
#failed? ⇒ true, false
Whether the request was authorized but failed
125 126 127 |
# File 'lib/configuration_service/test/response.rb', line 125 def failed? allowed? and @exception.is_a?(ConfigurationService::Error) end |
#found? ⇒ false
Whether the identified configuration was found
134 135 136 |
# File 'lib/configuration_service/test/response.rb', line 134 def found? false end |
#metadata ⇒ Object
The configuration metadata’s revision
161 162 163 |
# File 'lib/configuration_service/test/response.rb', line 161 def raise NotImplementedError, "metadata not available after #{@exception.inspect}" end |
#revision ⇒ Object
The configuration metadata’s revision
152 153 154 |
# File 'lib/configuration_service/test/response.rb', line 152 def revision raise NotImplementedError, "revision not available after #{@exception.inspect}" end |