silkroad 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/silkroad/client.rb +1 -1
- data/lib/silkroad/version.rb +1 -1
- data/test/client_test.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8e1ac1da70003b497194b13d2b4b47569cfac43d3246b550b587e0dc4943bd6
|
4
|
+
data.tar.gz: 11a1d56e33e215f64decf92a5001cf135852d2cf9cfc61496c7003c7b027975e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c55879c37d5a91144f5544ba406025a6da4bf199f413d8d95b8aba149084b15587704879eded937595e0cd7a288d4e549d6ba02685926995d26aa25f43abd6f1
|
7
|
+
data.tar.gz: 365f9dde3ac174af3e59982ac647465e8e6ad039e308ddec38dd57581dd05d592cd0e679806b94139c1c4fdc1a5483f4e4aa9e61fb6a2d2fe7127cd739a10ec4
|
data/README.md
CHANGED
@@ -21,12 +21,12 @@ Or install it yourself as:
|
|
21
21
|
Initialize the client:
|
22
22
|
|
23
23
|
```ruby
|
24
|
-
silkroad = Silkroad::Client.new
|
24
|
+
silkroad = Silkroad::Client.new
|
25
25
|
```
|
26
26
|
|
27
|
-
You can set a custom
|
27
|
+
You can set a custom uri:
|
28
28
|
```ruby
|
29
|
-
silkroad = Silkroad::Client.new 'rpcuser
|
29
|
+
silkroad = Silkroad::Client.new 'https://rpcuser:rpcpass@yourbitcoinddaemon.com:31337'
|
30
30
|
```
|
31
31
|
|
32
32
|
Now you can make RPC API calls (see the [API calls list](https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list)). Pass params as per the spec, and the result will be returned as a primitive type (string, number, boolean, and nil) or structured type (hash, array), depending on the call:
|
data/lib/silkroad/client.rb
CHANGED
@@ -21,7 +21,7 @@ module Silkroad
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def rpc(meth, *params)
|
24
|
-
response = send jsonrpc: JSONRPC_VERSION, method: meth, params: params
|
24
|
+
response = send jsonrpc: JSONRPC_VERSION, method: meth, params: params, id: 1
|
25
25
|
|
26
26
|
if response.code != '200'
|
27
27
|
if response.body.nil?
|
data/lib/silkroad/version.rb
CHANGED
data/test/client_test.rb
CHANGED
@@ -41,7 +41,7 @@ describe Silkroad::Client do
|
|
41
41
|
|
42
42
|
it 'makes a call' do
|
43
43
|
stub_with_body(
|
44
|
-
{jsonrpc: "2.0", method: "getbalance", params: ["tyler@example.com"]},
|
44
|
+
{jsonrpc: "2.0", method: "getbalance", params: ["tyler@example.com"], id: 1},
|
45
45
|
{status: 200, body: {result: 31337}.to_json}
|
46
46
|
)
|
47
47
|
|
@@ -50,7 +50,7 @@ describe Silkroad::Client do
|
|
50
50
|
|
51
51
|
it 'works with ssl' do
|
52
52
|
stub_with_body(
|
53
|
-
{jsonrpc: "2.0", method: "getbalance", params: ["tyler@example.com"]},
|
53
|
+
{jsonrpc: "2.0", method: "getbalance", params: ["tyler@example.com"], id: 1},
|
54
54
|
{status: 200, body: {result: 31337}.to_json},
|
55
55
|
true
|
56
56
|
)
|
@@ -61,7 +61,7 @@ describe Silkroad::Client do
|
|
61
61
|
|
62
62
|
it 'fails with error' do
|
63
63
|
stub_with_body(
|
64
|
-
{jsonrpc: "2.0", method: "failbalance", params: ["tyler@example.com"]},
|
64
|
+
{jsonrpc: "2.0", method: "failbalance", params: ["tyler@example.com"], id: 1},
|
65
65
|
{status: 200, body: {result: 31337}.to_json}
|
66
66
|
)
|
67
67
|
end
|