Sha256: 5d3bcdfcc31c8c68f1af3841cd20d854d45eba046e6604c9677191c8bb939b30

Contents?: true

Size: 1.15 KB

Versions: 23

Compression:

Stored size: 1.15 KB

Contents

require 'logger'

module Killbill::PaypalExpress
  mattr_reader :logger
  mattr_reader :config
  mattr_reader :gateway
  mattr_reader :paypal_sandbox_url
  mattr_reader :paypal_production_url
  mattr_reader :initialized
  mattr_reader :test

  def self.initialize!(logger=Logger.new(STDOUT), conf_dir=File.expand_path('../../../', File.dirname(__FILE__)))
    @@logger = logger

    config_file = "#{conf_dir}/paypal_express.yml"
    @@config = Properties.new(config_file)
    @@config.parse!

    @@paypal_sandbox_url = @@config[:paypal][:sandbox_url] || 'https://www.sandbox.paypal.com/cgi-bin/webscr'
    @@paypal_production_url = @@config[:paypal][:production_url] || 'https://www.paypal.com/cgi-bin/webscr'
    @@test = @@config[:paypal][:test]

    @@gateway = Killbill::PaypalExpress::Gateway.instance
    @@gateway.configure(@@config[:paypal])

    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])

    @@initialized = true
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
killbill-paypal-express-1.5.4 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.5.3 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.5.2 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.5.1 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.5.0 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.4.1 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.4.0 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.3.0 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.2.0 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.1.0 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.0.17 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.0.16 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.0.15 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.0.14 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.0.12 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.0.11 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.0.10 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.0.9 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.0.8 lib/paypal_express/config/configuration.rb
killbill-paypal-express-1.0.6 lib/paypal_express/config/configuration.rb