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.
103 104 105 |
# File 'lib/configuration_service/test/response.rb', line 103 def initialize(exception) @exception = exception end |
Instance Method Details
#allowed? ⇒ true, false
Whether the request was allowed
113 114 115 |
# File 'lib/configuration_service/test/response.rb', line 113 def allowed? !@exception.is_a?(ConfigurationService::AuthorizationError) end |
#data ⇒ Object
The configuration data dictionary of the response
141 142 143 |
# File 'lib/configuration_service/test/response.rb', line 141 def data raise NotImplementedError, "configuration not available after #{@exception.inspect}" end |
#failed? ⇒ true, false
Whether the request was authorized but failed
123 124 125 |
# File 'lib/configuration_service/test/response.rb', line 123 def failed? allowed? and @exception.is_a?(ConfigurationService::Error) end |
#found? ⇒ false
Whether the identified configuration was found
132 133 134 |
# File 'lib/configuration_service/test/response.rb', line 132 def found? false end |
#metadata ⇒ Object
The configuration metadata’s revision
159 160 161 |
# File 'lib/configuration_service/test/response.rb', line 159 def raise NotImplementedError, "metadata not available after #{@exception.inspect}" end |
#revision ⇒ Object
The configuration metadata’s revision
150 151 152 |
# File 'lib/configuration_service/test/response.rb', line 150 def revision raise NotImplementedError, "revision not available after #{@exception.inspect}" end |