Class: ConfigurationService::Test::Response::Failure

Inherits:
Object
  • Object
show all
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

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

Returns:

  • (Boolean)


96
97
98
# File 'lib/configuration_service/test/response.rb', line 96

def allowed?
  !@exception.is_a?(ConfigurationService::AuthorizationError)
end

#dataObject

Raises NotImplementedError

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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


110
111
112
# File 'lib/configuration_service/test/response.rb', line 110

def found?
  false
end

#metadataObject

Raises NotImplementedError

Raises:

  • (NotImplementedError)


131
132
133
# File 'lib/configuration_service/test/response.rb', line 131

def 
  raise NotImplementedError, "metadata not available after #{@exception.inspect}"
end

#revisionObject

Raises NotImplementedError

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