Class: ConfigurationService::Test::Response::Success

Inherits:
Object
  • Object
show all
Defined in:
lib/configuration_service/test/response.rb

Overview

Encapsulates a non-error configuration service response

This allows an OrchestrationProvider to decouple the Orchestrator from the semantics of the configuration service’s responses.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Success

Returns a new instance of Success.

Parameters:



28
29
30
# File 'lib/configuration_service/test/response.rb', line 28

def initialize(response)
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



22
23
24
# File 'lib/configuration_service/test/response.rb', line 22

def response
  @response
end

Instance Method Details

#allowed?true

Whether the request was allowed

Returns:

  • (true)

    always



37
38
39
# File 'lib/configuration_service/test/response.rb', line 37

def allowed?
  true
end

#dataHash?

The configuration data dictionary of the response

Returns:



66
67
68
# File 'lib/configuration_service/test/response.rb', line 66

def data
  @response and @response.data
end

#failed?false

Whether the request was authorized but failed

Returns:

  • (false)

    always



46
47
48
# File 'lib/configuration_service/test/response.rb', line 46

def failed?
  false
end

#found?true, false

Whether the identified configuration was found

Returns:

  • (true)

    if the response was not nil

  • (false)

    if the response was nil



56
57
58
# File 'lib/configuration_service/test/response.rb', line 56

def found?
  not @response.nil?
end

#metadataHash?

The configuration metadata

Returns:



86
87
88
# File 'lib/configuration_service/test/response.rb', line 86

def 
  @response and @response.
end

#revisionString?

The configuration metadata’s revision

Returns:



76
77
78
# File 'lib/configuration_service/test/response.rb', line 76

def revision
  @response and @response.["revision"]
end