Module: PriceHubble::ConfigurationHandling

Extended by:
ActiveSupport::Concern
Included in:
PriceHubble
Defined in:
lib/pricehubble/configuration_handling.rb

Overview

The top-level configuration handling.

rubocop:disable Style/ClassVars because we split module code

Class Method Summary collapse

Class Method Details

.configurationConfiguration

Retrieve the current configuration object.

Returns:



14
15
16
# File 'lib/pricehubble/configuration_handling.rb', line 14

def configuration
  @@configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Configure the concern by providing a block which takes care of this task. Example:

FactoryBot::Instrumentation.configure do |conf|
  # conf.xyz = [..]
end

Yields:



24
25
26
# File 'lib/pricehubble/configuration_handling.rb', line 24

def configure
  yield(configuration)
end

.identity_paramsHash{Symbol => String}

Get back the credentials bundle for an authentication.

Returns:

  • (Hash{Symbol => String})

    the identity bundle



36
37
38
39
40
41
# File 'lib/pricehubble/configuration_handling.rb', line 36

def identity_params
  {
    username: configuration.username,
    password: configuration.password
  }
end

.loggerLogger

Retrieve the current configured logger instance.

Returns:

  • (Logger)

    the logger instance



46
# File 'lib/pricehubble/configuration_handling.rb', line 46

delegate :logger, to: :configuration

.reset_configuration!Object

Reset the current configuration with the default one.



29
30
31
# File 'lib/pricehubble/configuration_handling.rb', line 29

def reset_configuration!
  @@configuration = Configuration.new
end