Sha256: 599f1210e5557ee63af24fc15954731ba89fdb3492f7b8ba0bc1be642aa27813

Contents?: true

Size: 1022 Bytes

Versions: 34

Compression:

Stored size: 1022 Bytes

Contents

module Killbill::PaypalExpress
  class Properties
    def initialize(file = 'paypal_express.yml')
      @config_file = Pathname.new(file).expand_path
    end

    def parse!
      raise "#{@config_file} is not a valid file" unless @config_file.file?
      @config = YAML.load_file(@config_file.to_s)
      validate!
    end

    def [](key)
      @config[key]
    end

    private

    def validate!
      raise "Bad configuration for PaypalExpress plugin. Config is #{@config.inspect}" if @config.blank? ||
                                                                                          @config[:paypal].blank? ||
                                                                                          @config[:paypal][:signature].blank? ||
                                                                                          @config[:paypal][:login].blank? ||
                                                                                          @config[:paypal][:password].blank?
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
killbill-paypal-express-1.0.16 lib/paypal_express/config/properties.rb
killbill-paypal-express-1.0.15 lib/paypal_express/config/properties.rb
killbill-paypal-express-1.0.14 lib/paypal_express/config/properties.rb
killbill-paypal-express-1.0.12 lib/paypal_express/config/properties.rb
killbill-paypal-express-1.0.11 lib/paypal_express/config/properties.rb
killbill-paypal-express-1.0.10 lib/paypal_express/config/properties.rb
killbill-paypal-express-1.0.9 lib/paypal_express/config/properties.rb
killbill-paypal-express-1.0.8 lib/paypal_express/config/properties.rb
killbill-paypal-express-1.0.6 lib/paypal_express/config/properties.rb
killbill-paypal-express-1.0.5 lib/paypal_express/config/properties.rb
killbill-paypal-express-1.0.4 lib/paypal_express/config/properties.rb
killbill-paypal-express-1.0.3 lib/paypal_express/config/properties.rb
killbill-paypal-express-1.0.2 lib/paypal_express/config/properties.rb
killbill-paypal-express-1.0.1 lib/paypal_express/config/properties.rb