Sha256: 320a6ffd033d5096db315fa7d2480e352a9c7d4d16bb3f0ba12c2cee260f951e
Contents?: true
Size: 1.46 KB
Versions: 9
Compression:
Stored size: 1.46 KB
Contents
require 'logger' module Killbill::Litle mattr_reader :logger mattr_reader :config mattr_reader :gateways mattr_reader :currency_conversions mattr_reader :kb_apis mattr_reader :initialized mattr_reader :test def self.initialize!(logger=Logger.new(STDOUT), conf_dir=File.expand_path('../../../', File.dirname(__FILE__)), kb_apis = nil) @@logger = logger @@kb_apis = kb_apis config_file = "#{conf_dir}/litle.yml" @@config = Properties.new(config_file) @@config.parse! @@test = @@config[:litle][:test] @@logger.log_level = Logger::DEBUG if (@@config[:logger] || {})[:debug] @@gateways = Killbill::Litle::Gateway.from_config(@@config[:litle]) @@currency_conversions = @@config[:currency_conversions] if defined?(JRUBY_VERSION) # See https://github.com/jruby/activerecord-jdbc-adapter/issues/302 require 'jdbc/mysql' Jdbc::MySQL.load_driver(:require) if Jdbc::MySQL.respond_to?(:load_driver) end ActiveRecord::Base.establish_connection(@@config[:database]) ActiveRecord::Base.logger = @@logger @@initialized = true end def self.converted_currency(currency) currency_sym = currency.to_s.upcase.to_sym @@currency_conversions && @@currency_conversions[currency_sym] end def self.gateway_for_currency(currency) currency_sym = currency.to_s.upcase.to_sym gateway = @@gateways[currency_sym] raise "Gateway for #{currency} not configured!" if gateway.nil? gateway end end
Version data entries
9 entries across 9 versions & 1 rubygems