Sha256: 912b3b7288b4df321d9aef437e915365714da0a5d36c77afeacbc2ecc3ed216d

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

#
# Configuration object for storing some parameters required for making transactions
#
module Docdata::Config
  class << self
    # @return [String] Your DocData username
    # @note The is a required parameter.
    attr_accessor :username
    # @return [String] Your DocData password
    attr_accessor :password
    # @return [Boolean] Test mode switch
    attr_accessor :test_mode


    # Set's the default value's to nil and false
    # @return [Hash] configuration options
    def init!
      @defaults = {
        :@username => nil,
        :@password => nil,
        :@test_mode => true
      }
    end

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

    # Set's the new value's as instance variables
    # @return [Hash] configuration options
    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

1 entries across 1 versions & 1 rubygems

Version Path
docdata-0.0.2 lib/docdata/config.rb