Class: Poms::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/poms/configuration.rb

Overview

The configuration is a container for configuration values that control the Poms gem.

Constant Summary collapse

DEFAULT_BASE_URI =

The fallback base URI in case none is explicitly specified.

'https://rs.poms.omroep.nl'.freeze
REQUIRED_CREDENTIAL_KEYS =

List of special credential keys that need to be present in order to be able to use the API.

[:key, :origin, :secret].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Configuration

Build a new configuration object, including validations and freezing.

You probably want to use a block to specify the different configuration options, but when no block is specified, default values will be read from the environment.

Yields:

  • (_self)

Yield Parameters:



22
23
24
25
26
27
28
# File 'lib/poms/configuration.rb', line 22

def initialize
  reset
  yield self if block_given?
  validate
  @credentials = OpenStruct.new(key: key, origin: origin, secret: secret)
  freeze
end

Instance Attribute Details

#base_uriObject

Returns the value of attribute base_uri.



7
8
9
# File 'lib/poms/configuration.rb', line 7

def base_uri
  @base_uri
end

#credentialsObject (readonly)

Returns the value of attribute credentials.



8
9
10
# File 'lib/poms/configuration.rb', line 8

def credentials
  @credentials
end

#keyObject

Returns the value of attribute key.



7
8
9
# File 'lib/poms/configuration.rb', line 7

def key
  @key
end

#originObject

Returns the value of attribute origin.



7
8
9
# File 'lib/poms/configuration.rb', line 7

def origin
  @origin
end

#secretObject

Returns the value of attribute secret.



7
8
9
# File 'lib/poms/configuration.rb', line 7

def secret
  @secret
end