Sha256: b4d448f7963c66a3a7f5ea084f6a7e7195c7d48b888aa3cb4ff50ac19aa83b8f

Contents?: true

Size: 985 Bytes

Versions: 4

Compression:

Stored size: 985 Bytes

Contents

require 'yaml'
require 'json'
require 'rest_client'

require 'active_support/core_ext'

Dir[File.join(File.dirname(__FILE__), 'bitbank', '*.rb')].each { |f| require f }

module Bitbank
  @@defaults = {
    :host => 'localhost',
    :port => 8332
  }

  def self.new(options={})
    self.config = options
    Client.new(config)
  end

  def self.config
    @config
  end

  def self.config=(filename_or_hash)
    if filename_or_hash.is_a?(String)
      options = YAML.load_file(filename_or_hash)
    else
      options = filename_or_hash
    end

    options.symbolize_keys!
    if options.has_key?(:username) && options.has_key?(:password)
      @config = @@defaults.merge(options)
    else
      raise ArgumentError, 'Please specify a username and password for bitcoind'
    end
  end

  def self.version
    version_path = File.join(File.dirname(__FILE__), '..', 'VERSION')
    if File.file?(version_path)
      File.read(version_path).chomp
    else
      '0.0.0'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bitbank-0.1.2 lib/bitbank.rb
bitbank-0.1.1 lib/bitbank.rb
bitbank-0.1.0 lib/bitbank.rb
bitbank-0.0.1 lib/bitbank.rb