bitcoiner 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bitcoiner/client.rb +25 -10
- data/lib/bitcoiner/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8b326189cb7c4f1e425fd8dfcd12f97783e037e1abffbe7d5eb4368ffb42224
|
4
|
+
data.tar.gz: dd6fecf9b9c01128978787faeff03ce729bb7251541806ccc96fa5183c36a577
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ee8f5ad16d9267c87bb9cd4bc88332a807682f5243c707729e7ad16e57a275ffd55e2639cec64b04533ebc7f8e3edbb1bb7cb4a1addd7320e8ad18fdedbd49a
|
7
|
+
data.tar.gz: d48a75b3f378c77de02fb8f4c0f95291a5bc6b27750a0d364182312c126ca16a20ddee19b8128c74cdb967407562df8d72198aa1265a5a0f02a400a9488acb3d
|
data/lib/bitcoiner/client.rb
CHANGED
@@ -22,22 +22,37 @@ module Bitcoiner
|
|
22
22
|
AccountHash.new self, balance_hash
|
23
23
|
end
|
24
24
|
|
25
|
-
def request(
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
def request(method_or_array_of_methods, *args)
|
26
|
+
if method_or_array_of_methods.is_a?(Array)
|
27
|
+
post_body = method_or_array_of_methods.map do |m|
|
28
|
+
{
|
29
|
+
'method' => m[0],
|
30
|
+
'params' => m[1],
|
31
|
+
'id' => 'jsonrpc'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
else
|
35
|
+
post_body = {
|
36
|
+
'method' => method_or_array_of_methods,
|
37
|
+
'params' => args,
|
38
|
+
'id' => 'jsonrpc'
|
39
|
+
}
|
40
|
+
end
|
31
41
|
|
32
42
|
response = Typhoeus.post(
|
33
43
|
endpoint,
|
34
44
|
userpwd: [username, password].join(":"),
|
35
|
-
body: post_body,
|
45
|
+
body: post_body.to_json,
|
36
46
|
)
|
37
47
|
|
38
|
-
|
39
|
-
|
40
|
-
|
48
|
+
parsed_response = parse_body(response)
|
49
|
+
|
50
|
+
if parsed_response.is_a?(Hash)
|
51
|
+
raise JSONRPCError, parsed_response['error'] if parsed_response['error']
|
52
|
+
return parsed_response['result']
|
53
|
+
end
|
54
|
+
|
55
|
+
parsed_response
|
41
56
|
end
|
42
57
|
|
43
58
|
def inspect
|
data/lib/bitcoiner/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitcoiner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryce Kerley
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-11-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
151
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.7.
|
152
|
+
rubygems_version: 2.7.8
|
153
153
|
signing_key:
|
154
154
|
specification_version: 4
|
155
155
|
summary: Control the bitcoin nework client over JSON-RPC.
|