class Hubscreen::Config

Constants

CONFIG_KEYS
DEFAULT_BASE_URL
DEFAULT_LOGGER
DEFAULT_RESPONSE_ENCAPSULATION

Public Class Methods

configure(config) click to toggle source
# File lib/hubscreen/config.rb, line 16
def configure(config)
  config.stringify_keys!
  @hapikey = config["hapikey"]
  @base_url = config["base_url"] || DEFAULT_BASE_URL
  @portal_id = config["portal_id"] #not currenty used
  @logger = config['logger'] || DEFAULT_LOGGER
  @encapsulate_response = config['encapsulate_response'] || DEFAULT_RESPONSE_ENCAPSULATION
  self
end
ensure!(*params) click to toggle source
# File lib/hubscreen/config.rb, line 34
def ensure!(*params)
  params.each do |p|
    raise Hubscreen::ConfigurationError.new("'#{p}' not configured") unless instance_variable_get "@#{p}"
  end
end
reset!() click to toggle source
# File lib/hubscreen/config.rb, line 26
def reset!
  @hapikey = nil
  @base_url = DEFAULT_BASE_URL
  @portal_id = nil
  @logger = DEFAULT_LOGGER
  @encapsulate_response = DEFAULT_RESPONSE_ENCAPSULATION
end
standard_base_url() click to toggle source
# File lib/hubscreen/config.rb, line 40
def standard_base_url
  return DEFAULT_BASE_URL
end