Sha256: 10fb80f7c12d1852e2403a4411ba9f1b8e9a0455a9709befc6a230c77ada5d55

Contents?: true

Size: 754 Bytes

Versions: 1

Compression:

Stored size: 754 Bytes

Contents

require 'mtgox/version'

module MtGox
  module Configuration
    # An array of valid keys in the options hash when configuring a {MtGox::Client}
    VALID_OPTIONS_KEYS = [
      :commission,
      :key,
      :secret,
    ]

    DEFAULT_COMMISSION = 0.0065.freeze

    attr_accessor *VALID_OPTIONS_KEYS

    # When this module is extended, set all configuration options to their default values
    def self.extended(base)
      base.reset
    end

    # Convenience method to allow configuration options to be set in a block
    def configure
      yield self
    end

    # Reset all configuration options to defaults
    def reset
      self.commission = DEFAULT_COMMISSION
      self.key   = nil
      self.secret   = nil
      self
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mtgox-0.9.1 lib/mtgox/configuration.rb