Sha256: 94af69960659f7cde78dc462ae2e00aa43e637bbba01a34869d0b2f23b9aaa3c

Contents?: true

Size: 792 Bytes

Versions: 4

Compression:

Stored size: 792 Bytes

Contents

class Bitcoin::API
  attr_reader :options
  attr_reader :params
  
  def user; options[:user]; end
  def pass; options[:pass]; end
  def host; options[:host]; end
  def port; options[:port]; end
  def ssl;  options[:ssl];  end
  def ssl?; options[:ssl];  end
  def user=(a); options[:user] = a; end
  def pass=(a); options[:pass] = a; end
  def host=(a); options[:host] = a; end
  def port=(a); options[:port] = a; end
  def ssl=(a);  options[:ssl]  = a; end

  def initialize(options = {})
    @options = {
      :host => 'localhost',
      :port => 8332,
      :ssl  => false
    }.merge(options)
  end
  
  def to_hash
    @options.dup
  end
  
  def request(service_name, *params)
    req = Bitcoin::Request.new(service_name, params)
    Bitcoin::RPC.new(to_hash).dispatch(req)
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
bitcoin-client-0.0.3 lib/bitcoin/api.rb
bitcoin-client-0.0.2 lib/bitcoin/api.rb
ramontayag-bitcoin-client-0.1.0 lib/bitcoin/api.rb
bitcoin-client-0.0.1 lib/bitcoin/api.rb