Sha256: f45b77e1e2ff8339b5a01bf4aabfaa0803125058d14eff63898d72ea7f33f404

Contents?: true

Size: 810 Bytes

Versions: 2

Compression:

Stored size: 810 Bytes

Contents

#
# Configuration object for storing some parameters required for making transactions
#
module IdealMollie::Config
  class << self
    attr_accessor :partner_id, :report_url, :return_url, :test_mode

    # Set's the default value's to nil and false
    def init!
      @defaults = {
        :@partner_id => nil,
        :@report_url => nil,
        :@return_url => nil,
        :@test_mode => false
      }
    end

    # Resets the value's to there previous value (instance_variable)
    def reset!
      @defaults.each { |key, value| instance_variable_set(key, value) }
    end

    # Set's the new value's as instance variables
    def update!
      @defaults.each do |key, value|
        instance_variable_set(key, value) unless instance_variable_defined?(key)
      end
    end
  end
  init!
  reset!
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ideal-mollie-0.0.2 lib/ideal-mollie/config.rb
ideal-mollie-0.0.1 lib/ideal-mollie/config.rb