module Uktt

Constants

API_HOST_LOCAL
API_HOST_PROD
API_VERSION
CHAPTER
COMMODITY
GOODS_NOMENCLATURE
HEADING
M_X_RATE
PARENT_CURRENCY
QUOTA
SECTION
VERSION

Public Class Methods

config() click to toggle source
# File lib/uktt.rb, line 58
def self.config
  @config
end
configure(opts = {}) click to toggle source

Configure through hash

# File lib/uktt.rb, line 41
def self.configure(opts = {})
  opts.each {|k,v| @config[k.to_sym] = v if @valid_config_keys.include? k.to_sym}
end
configure_with(path_to_yaml_file) click to toggle source

Configure through yaml file

# File lib/uktt.rb, line 46
def self.configure_with(path_to_yaml_file)
  begin
    config = YAML::load(IO.read(path_to_yaml_file))
  rescue Errno::ENOENT
    log(:warning, "YAML configuration file couldn't be found. Using defaults."); return
  rescue Psych::SyntaxError
    log(:warning, "YAML configuration file contains invalid syntax. Using defaults."); return
  end

  configure(config)
end