module Conductor

Constants

SERVICE_URI_DEVELOPMENT
SERVICE_URI_PRODUCTION
SERVICE_URI_TESTING
VERSION

Attributes

config[RW]

Public Class Methods

configure() { |config| ... } click to toggle source
# File lib/nf-conductor.rb, line 21
def configure
  self.config ||= Configuration.new
  yield(config) if block_given?
end
initialize(service_env, verbose: false) click to toggle source
# File lib/nf-conductor.rb, line 26
def initialize(service_env, verbose: false)
  configure if self.config.nil?
  self.config.service_env ||= service_env
  self.config.verbose ||= verbose

  # Ensure service_uri is set in configuration
  if self.config.service_env.nil? && self.config.service_uri.nil?
    raise "Service information is required"
  elsif self.config.service_uri
    # No action required
  elsif self.config.service_env
    self.config.service_uri = case self.config.service_env
                              when 'development'
                                SERVICE_URI_DEVELOPMENT
                              when 'testing'
                                SERVICE_URI_TESTING
                              when 'production'
                                SERVICE_URI_PRODUCTION
                              end
  end
end