Sha256: cc201833382f408f1a5cf83627aa5971968dcd41a7d78432fcbd158af3054939

Contents?: true

Size: 918 Bytes

Versions: 4

Compression:

Stored size: 918 Bytes

Contents

module Spree
  module Paypal
    # Singleton class to access the Paypal configuration object (PaypalConfiguration.first by default) and it's preferences.
    #
    # Usage:
    #   Spree::Paypal::Config[:foo]                  # Returns the foo preference
    #   Spree::Paypal::Config[]                      # Returns a Hash with all the tax preferences
    #   Spree::Paypal::Config.instance               # Returns the configuration object (PaypalConfiguration.first)
    #   Spree::Paypal::Config.set(preferences_hash)  # Set the tax preferences as especified in +preference_hash+
    class Config
      include Singleton
      include PreferenceAccess
    
      class << self
        def instance
          return nil unless ActiveRecord::Base.connection.tables.include?('configurations')
          PaypalConfiguration.find_or_create_by_name("Default paypal configuration")
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_paypal_website_standard-0.8.4 lib/spree/paypal/config.rb
spree_paypal_website_standard-0.8.3 lib/spree/paypal/config.rb
spree_paypal_website_standard-0.8.1 lib/spree/paypal/config.rb
spree_paypal_website_standard-0.8.2 lib/spree/paypal/config.rb