Sha256: dab39fe9fc588eba0d0bb6d8d3f9011d2c9638ae1e7158f8d28d342c9d304e47

Contents?: true

Size: 929 Bytes

Versions: 17

Compression:

Stored size: 929 Bytes

Contents

module Spree
  module Gateway
    # Singleton class to access the gateway configuration object (GatewayConfiguration.first by default) and it's preferences.
    #
    # Usage:
    #   Spree::Gateway::Config[:foo]                  # Returns the foo preference
    #   Spree::Gateway::Config[]                      # Returns a Hash with all the gateway preferences
    #   Spree::Gateway::Config.instance               # Returns the configuration object (GatewayConfiguration.first)
    #   Spree::Gateway::Config.set(preferences_hash)  # Set the gateway 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')
          GatewayConfig.find_or_create_by_name("Default gateway configuration")
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
spree-enriquez-0.9.4 vendor/extensions/payment_gateway/lib/spree/gateway/config.rb
spree-0.9.4 vendor/extensions/payment_gateway/lib/spree/gateway/config.rb
spree-0.9.3 vendor/extensions/payment_gateway/lib/spree/gateway/config.rb
spree-0.9.2 vendor/extensions/payment_gateway/lib/spree/gateway/config.rb
spree-0.9.1 vendor/extensions/payment_gateway/lib/spree/gateway/config.rb
spree-0.9.0 vendor/extensions/payment_gateway/lib/spree/gateway/config.rb
spree-0.8.4 vendor/extensions/payment_gateway/lib/spree/gateway/config.rb
spree-0.8.5 vendor/extensions/payment_gateway/lib/spree/gateway/config.rb
spree-0.5.0 vendor/extensions/payment_gateway/lib/spree/gateway/config.rb
spree-0.6.0 vendor/extensions/payment_gateway/lib/spree/gateway/config.rb
spree-0.5.1 vendor/extensions/payment_gateway/lib/spree/gateway/config.rb
spree-0.7.0 vendor/extensions/payment_gateway/lib/spree/gateway/config.rb
spree-0.7.1 vendor/extensions/payment_gateway/lib/spree/gateway/config.rb
spree-0.8.0 vendor/extensions/payment_gateway/lib/spree/gateway/config.rb
spree-0.8.1 vendor/extensions/payment_gateway/lib/spree/gateway/config.rb
spree-0.8.2 vendor/extensions/payment_gateway/lib/spree/gateway/config.rb
spree-0.8.3 vendor/extensions/payment_gateway/lib/spree/gateway/config.rb