Sha256: 88cff09850f34e2c8e10e01a123076d624959f732a1ee1c0eba10e77e82b5266

Contents?: true

Size: 869 Bytes

Versions: 7

Compression:

Stored size: 869 Bytes

Contents

module Adyen
  LIVE_RAILS_ENVIRONMENTS = ['production']

  # Setter voor the current Adyen environment.
  # Must be either 'test' or 'live'
  def self.environment=(env)
    @environment = env
  end

  # Returns the current Adyen environment.
  # Returns either 'test' or 'live'.
  def self.environment(override = nil)
    override || @environment || Adyen.autodetect_environment
  end

  # Autodetects the Adyen environment based on the RAILS_ENV constant
  def self.autodetect_environment
    (defined?(RAILS_ENV) && Adyen::LIVE_RAILS_ENVIRONMENTS.include?(RAILS_ENV.to_s.downcase)) ? 'live' : 'test'
  end

  # Loads submodules on demand, so that dependencies are not required.
  def self.const_missing(sym)
    require "adyen/#{sym.to_s.downcase}"
    return Adyen.const_get(sym)
  rescue
    super(sym)
  end
end

require 'adyen/encoding'
require 'adyen/formatter'

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
wvanbergen-adyen-0.1.5 lib/adyen.rb
adyen-0.2.2 lib/adyen.rb
floorplanner-adyen-0.2.2 lib/adyen.rb
adyen-0.2.1 lib/adyen.rb
adyen-0.2.0 lib/adyen.rb
adyen-0.1.5 lib/adyen.rb
adyen-0.1.4 lib/adyen.rb