Sha256: 868649caf4b6c24fd69a4eeed66dc542d1d9084f8a75a1270a894819c47dd06f

Contents?: true

Size: 965 Bytes

Versions: 5

Compression:

Stored size: 965 Bytes

Contents

require 'bitshares/version'

require 'json'
require 'uri'
require 'net/http'
require 'yaml'

require 'bitshares/client'
require 'bitshares/blockchain'
require 'bitshares/wallet'
require 'bitshares/account'
require 'bitshares/market'

# stackoverflow.com/questions/6233124/where-to-place-access-config-file-in-gem
module Bitshares
  @config = {:wallets => {nil => nil}} # name/password key/value pairs

  @valid_keys = @config.keys

  def self.configure(opts = {})
    opts.each {|k,v| @config[k.to_sym] = v if @valid_keys.include? k.to_sym}
  end

  def self.configure_with(path_to_yaml_file)
    begin
      config = YAML::load(IO.read(path_to_yaml_file))
    rescue Errno::ENOENT
      puts "YAML configuration file couldn\'t be found. Using defaults"
      return
    rescue Psych::SyntaxError
      puts 'YAML configuration file contains invalid syntax. Using defaults'
      return
    end

    configure(config)
  end

  def self.config
    @config
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bitshares-0.1.4.pre lib/bitshares.rb
bitshares-0.1.3.pre lib/bitshares.rb
bitshares-0.1.2.pre lib/bitshares.rb
bitshares-0.1.1.pre lib/bitshares-ruby.rb
bitshares-0.1.0.pre lib/bitshares-ruby.rb