Module: LL::WK::API

Defined in:
lib/ll/wk/api.rb,
lib/ll/wk/api/version.rb,
lib/ll/wk/api/connection.rb,
lib/ll/wk/api/connection/base.rb,
lib/ll/wk/api/connection/curb.rb,
lib/ll/wk/api/connection/httparty.rb,
lib/ll/wk/api/connection/new_curb.rb

Overview

API Functionality for clients of the WebKiosk

Defined Under Namespace

Modules: Connection

Constant Summary collapse

RUN_BENCHMARKS =
true
VERSION =
'0.1.1'

Class Method Summary collapse

Class Method Details

.benchmark(name = nil) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ll/wk/api.rb', line 20

def benchmark(name = nil)
  return yield unless RUN_BENCHMARKS
  require 'benchmark'
  logger.debug("Execution of block #{name} commencing at #{Time.now}")
  res = nil
  time = Benchmark.measure do
    res = yield
  end
  readable = Time.at(time.real).strftime('%Mm, %S.%Ls')
  logger.debug("Execution of block #{name} complete at #{Time.now}. Executed in: {#{readable}}")
  res
end

.connect(url:, email:, password:) ⇒ Object



16
17
18
# File 'lib/ll/wk/api.rb', line 16

def connect(url:, email:, password:)
  API::Connection.factory(url: url, email: email, password: password)
end

.loggerObject



12
13
14
# File 'lib/ll/wk/api.rb', line 12

def logger
  @logger ||= Logger.new(STDERR)
end