Class: ConfigurationService::Factory::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/configuration_service/factory/context.rb,
lib/configuration_service/factory/context/symbolic_access_wrapper.rb

Overview

A factory context for static factory configuration

The typical use case for this class is in constructing an AdminClient using a data structure acquired from a secure source that does not need to be scrubbed.

Defined Under Namespace

Classes: SymbolicAccessWrapper

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ Context

Returns a new factory context

The following keys are used by the ConfigurationService::Factory:

identifier

the unique identity of the configuration data (see Base#initialize)

token

authorization token for the identified configuration data (see Base#initialize)

provider_id

the unique identity of the service provider (see ProviderRegistry)

provider_config

configuration options for the service provider (see service provider documentation)



33
34
35
# File 'lib/configuration_service/factory/context.rb', line 33

def initialize(source)
  @env = SymbolicAccessWrapper.new(source)
end

Instance Method Details

#identifierObject

The unique identity of the configuration data

Required for Base. Not used by AdminClient.



42
43
44
# File 'lib/configuration_service/factory/context.rb', line 42

def identifier
  @env[:identifier]
end

#provider_configObject

Configuration options for the service provider

See service provider documentation.



67
68
69
# File 'lib/configuration_service/factory/context.rb', line 67

def provider_config
  @env[:provider_config]
end

#provider_idObject

The unique identity of the service provider

See Also:



58
59
60
# File 'lib/configuration_service/factory/context.rb', line 58

def provider_id
  @env[:provider_id]
end

#scrub!Object

Does nothing

The source is assumed to be secure. Sources such as the process ENV and (on JRuby) system properties should not be used with this class; instead, they should be accessed through EnvironmentContext.



77
78
# File 'lib/configuration_service/factory/context.rb', line 77

def scrub!
end

#tokenObject

Authorization token for the identified configuration data



49
50
51
# File 'lib/configuration_service/factory/context.rb', line 49

def token
  @env[:token]
end