bitclient 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -1,6 +1,6 @@
1
1
  == Simple interface to the Bitcoind JSON-RPC API
2
2
 
3
3
  == How to use
4
- bitclient = Bitclient.new(:username => "asd", :password => "dsa")
4
+ bitclient = Bitclient::Client.new(:username => "asd", :password => "dsa")
5
5
  bitclient.get_balance # => 0.0000
6
6
  bitclient.get_info # => {"version": ...}
@@ -1,3 +1,3 @@
1
1
  module Bitclient
2
- VERSION = "0.1"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/bitclient.rb CHANGED
@@ -3,25 +3,27 @@ require "httparty"
3
3
  # https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list
4
4
  #
5
5
  module Bitclient
6
- def initialize(opts = {})
7
- @url = opts[:url] || "http://localhost:8332"
8
- @auth = {:username => opts[:username], :password => opts[:password]}
9
- end
6
+ class Client
7
+ def initialize(opts = {})
8
+ @url = opts[:url] || "http://localhost:8332"
9
+ @auth = {:username => opts[:username], :password => opts[:password]}
10
+ end
10
11
 
11
- def method_missing(method, *args)
12
- options = {
13
- :body => {
14
- :method => method.to_s.gsub(/\_/, ""),
15
- :params => args
16
- }.to_json,
17
- :basic_auth => @auth,
18
- :format => :json
19
- }
20
- res = HTTParty.post(@url, options).parsed_response
21
- if res["error"]
22
- raise Exception, res["error"]
23
- else
24
- res["result"]
12
+ def method_missing(method, *args)
13
+ options = {
14
+ :body => {
15
+ :method => method.to_s.gsub(/\_/, ""),
16
+ :params => args
17
+ }.to_json,
18
+ :basic_auth => @auth,
19
+ :format => :json
20
+ }
21
+ res = HTTParty.post(@url, options).parsed_response
22
+ if res["error"]
23
+ raise Exception, res["error"]
24
+ else
25
+ res["result"]
26
+ end
25
27
  end
26
28
  end
27
29
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitclient
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- version: "0.1"
9
+ - 1
10
+ version: 0.1.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Indrek Juhkam