module LL::WK::API

API Functionality for clients of the WebKiosk

Constants

RUN_BENCHMARKS
VERSION

Attributes

logger[W]

Public Instance Methods

benchmark(name = nil) { || ... } click to toggle source
# 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:) click to toggle source
# File lib/ll/wk/api.rb, line 16
def connect(url:, email:, password:)
  API::Connection.factory(url: url, email: email, password: password)
end
logger() click to toggle source
# File lib/ll/wk/api.rb, line 12
def logger
  @logger ||= Logger.new(STDERR)
end