electrb 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3dbcef324297f3e9533e9318322ba40c22e0383b60fde6bb3ae936c48e5d0bad
4
- data.tar.gz: c7e0d512fc49f54920568ab47a7711cb7e1bab7c17982342bca9dc319b36daa0
3
+ metadata.gz: 8db5d61b586324df5e97bbbd9c70e071cdf6518eaccdb9fe17b510ddf00da9d0
4
+ data.tar.gz: 4f2222ae0ab648a9e58dc631c3885473d994b6e30e0c320c2c176ee17585fc58
5
5
  SHA512:
6
- metadata.gz: b8a93b2cf4bee164eb5abaca891aab3bd9c961cabf14b839dc75ed2bb2e41685a404b3a51c3f53bff60a194a775857c46149c63a9c59419b8f041d12edb9732b
7
- data.tar.gz: dfdd114d4cbb7d0a01cb84b700d37fca92661489df93a4ebe26a3dd3f6e909678fccee466abdc41ffffe9db270456cc2f737ad50333c07a5ca03bf5dd44c1122
6
+ metadata.gz: b5b2292a752af6ebe22547385f1851255d1bc6d53d36e41ffac4eea45fd7e8630c292d3a53df5728e527bc9f8377edae0cfcd6fa45383975f4b578844d0d1454
7
+ data.tar.gz: eeb31033a16bd4f49c658a76bb2ced8000b90ee9688f0fe78e9eaa5ce9a4a8c4891137192258bbfe7c4b8e5ef666fa12473b560f3d4338c412f0b480ac71ada2
data/README.md CHANGED
@@ -32,12 +32,12 @@ require 'electrb'
32
32
  client = Electrb::Client.new("localhost", 50001)
33
33
 
34
34
  # get server version
35
- client.server_version(['1.9.5', '0.6'])
35
+ client.request('server.version', ['1.9.5', '0.6'])
36
36
  => ["electrs 0.7.0", "1.4"]
37
37
 
38
38
  # get transaction
39
39
  txid = 'd513c8fa051336fc8059958a7c99dc390c741a693503b67783392d0a84029bcb'
40
- client.blockchain_transaction_get(txid)
40
+ client.request('blockchain.transaction.get', txid)
41
41
  => '02000000000101592110a2310082589362bc14e5dd5f6baad9705235995594aabacbc5b88e537f01000000171600142fd1a396731d8a4eb616791f7c1799eb6f446aacfeffffff02a5aba1800700000017a9146cfe9a5230d6a30815440ae32afe029f3864634287bcb720000000000017a914c6953679a4a0aeaf71317150b38e5b5cfae76415870247304402203c47f3d32e572bc4b382f2ecebeb34d1254936811d2e778cc107dfe5dc41663c02201a1eb3e73bf8f79578ec921c42436ba36ca95ace830311c26a9d15eb06a28d470121030af582d65f02f1ec50b466dd40bca58378d9117dcf443adaf1b14753a377539e94ea1700'
42
42
 
43
43
  ```
@@ -8,14 +8,16 @@ module Electrb
8
8
  @client = Jsonrpctcp::Client.new(host, port)
9
9
  end
10
10
 
11
- private
12
-
13
- def method_missing(method, *args)
14
- send_request(method, *args)
11
+ # Send RPC request.
12
+ # @param [String] method_name Method name to be called by RPC.
13
+ # @return [String] RPC result.
14
+ def request(method_name, *args)
15
+ send_request(method_name, *args)
15
16
  end
16
17
 
17
- def send_request(method, *args)
18
- method_name = method.to_s.gsub(/_/, '.')
18
+ private
19
+
20
+ def send_request(method_name, *args)
19
21
  response = client.send(method_name, *args)
20
22
  response['result']
21
23
  end
@@ -1,3 +1,3 @@
1
1
  module Electrb
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: electrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - azuchi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-05 00:00:00.000000000 Z
11
+ date: 2019-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonrpctcp