Module: Confidant

Defined in:
lib/confidant.rb,
lib/confidant/cli.rb,
lib/confidant/client.rb,
lib/confidant/version.rb,
lib/confidant/configurator.rb

Overview

This is a set of client libs for Confidant

Defined Under Namespace

Classes: CLI, Client, ConfigurationError, Configurator

Constant Summary collapse

VERSION =
'0.1.0'.freeze

Class Method Summary collapse

Class Method Details

.configure(config = {}) ⇒ Object

Wrap common workflow into module methods for end-user simplicity.



23
24
25
# File 'lib/confidant.rb', line 23

def configure(config = {})
  @configurator = Configurator.new(config)
end

.get_service(service = nil) ⇒ Object



27
28
29
30
31
32
# File 'lib/confidant.rb', line 27

def get_service(service = nil)
  unless @configurator
    raise ConfigurationError, 'Not configured, run Confidant.configure'
  end
  Client.new(@configurator).get_service(service)
end

.log_exception(klass, ex) ⇒ Object



34
35
36
37
38
39
# File 'lib/confidant.rb', line 34

def log_exception(klass, ex)
  klass.log.error("#{ex.class} : #{ex.message}")
  ex.backtrace.each do |frame|
    klass.log.debug("\t#{frame}")
  end
end