radiator 0.3.0dev6 → 0.3.0rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -8
- data/README.md +80 -4
- data/lib/radiator/api.rb +3 -3
- data/lib/radiator/stream.rb +2 -1
- data/lib/radiator/version.rb +1 -1
- data/radiator.gemspec +2 -2
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adccc7e93bc7d0aa80013b5155564e5e1cad6f9e
|
4
|
+
data.tar.gz: 3d2e9bbd91be99f07546fb7943c4c85223f2a1ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fd6c239cde0594f9bbb29a855fde1ca28a1f9bf5e18329daf506654ee4f563320e86818552ceba6bde33a468ef2270872dc257fe8d45ca9ad1ea267c8bf1718
|
7
|
+
data.tar.gz: 6e21d95073a1085c55e9a895815af694f62e982f0d2d70087d65383df3c6dcc7571741d4b662ab1ec2329176e03792e30fbc575636614ee92a5b35d7ed6973ef
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
radiator (0.3.
|
4
|
+
radiator (0.3.0rc1)
|
5
5
|
bitcoin-ruby (= 0.0.11)
|
6
6
|
ffi (= 1.9.18)
|
7
7
|
hashie (~> 3.5, >= 3.5.5)
|
@@ -16,8 +16,8 @@ GEM
|
|
16
16
|
public_suffix (>= 2.0.2, < 4.0)
|
17
17
|
awesome_print (1.8.0)
|
18
18
|
bitcoin-ruby (0.0.11)
|
19
|
-
codeclimate-test-reporter (0.5
|
20
|
-
simplecov
|
19
|
+
codeclimate-test-reporter (1.0.5)
|
20
|
+
simplecov
|
21
21
|
coderay (1.1.2)
|
22
22
|
crack (0.4.3)
|
23
23
|
safe_yaml (~> 1.0.0)
|
@@ -27,7 +27,7 @@ GEM
|
|
27
27
|
faraday (0.9.2)
|
28
28
|
multipart-post (>= 1.2, < 3)
|
29
29
|
ffi (1.9.18)
|
30
|
-
hashdiff (0.3.
|
30
|
+
hashdiff (0.3.7)
|
31
31
|
hashie (3.5.6)
|
32
32
|
json (2.1.0)
|
33
33
|
little-plugger (1.1.4)
|
@@ -44,7 +44,7 @@ GEM
|
|
44
44
|
pry (0.11.1)
|
45
45
|
coderay (~> 1.1.0)
|
46
46
|
method_source (~> 0.9.0)
|
47
|
-
public_suffix (
|
47
|
+
public_suffix (3.0.0)
|
48
48
|
rake (12.1.0)
|
49
49
|
safe_yaml (1.0.4)
|
50
50
|
simplecov (0.15.1)
|
@@ -55,7 +55,7 @@ GEM
|
|
55
55
|
typhoeus (1.3.0)
|
56
56
|
ethon (>= 0.9.0)
|
57
57
|
vcr (3.0.3)
|
58
|
-
webmock (
|
58
|
+
webmock (3.1.0)
|
59
59
|
addressable (>= 2.3.6)
|
60
60
|
crack (>= 0.3.2)
|
61
61
|
hashdiff
|
@@ -67,7 +67,7 @@ PLATFORMS
|
|
67
67
|
DEPENDENCIES
|
68
68
|
awesome_print (~> 1.7, >= 1.7.0)
|
69
69
|
bundler (~> 1.15, >= 1.15.4)
|
70
|
-
codeclimate-test-reporter (~> 0.5
|
70
|
+
codeclimate-test-reporter (~> 1.0, >= 1.0.5)
|
71
71
|
faraday (~> 0.9.2)
|
72
72
|
minitest (~> 5.9, >= 5.9.0)
|
73
73
|
minitest-line (~> 0.6.3)
|
@@ -77,7 +77,7 @@ DEPENDENCIES
|
|
77
77
|
simplecov (~> 0.15.1)
|
78
78
|
typhoeus (~> 1.0, >= 1.0.2)
|
79
79
|
vcr (~> 3.0, >= 3.0.3)
|
80
|
-
webmock (~>
|
80
|
+
webmock (~> 3.1, >= 3.1.0)
|
81
81
|
yard (~> 0.9.9)
|
82
82
|
|
83
83
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -10,6 +10,16 @@
|
|
10
10
|
|
11
11
|
Radiator is an API Client for interaction with the STEEM network using Ruby.
|
12
12
|
|
13
|
+
#### Changes in v0.3.0
|
14
|
+
|
15
|
+
* Gem updates
|
16
|
+
* Added failover subroutines (see Failover section, below).
|
17
|
+
* Added method closures support (aka passing a block to yield).
|
18
|
+
* You can now stream virtual operations (see Streaming section, below).
|
19
|
+
* Added more [documentation](http://www.rubydoc.info/gems/radiator).
|
20
|
+
* Added/expanded more api namespaces: `::BlockApi`, `::CondenserApi`, `::TagApi`
|
21
|
+
* Addressed an issue with logging on certain Windows configurations.
|
22
|
+
|
13
23
|
#### Fixes in v0.2.3
|
14
24
|
|
15
25
|
* Gem updates
|
@@ -72,6 +82,18 @@ $ gem install bundler
|
|
72
82
|
```ruby
|
73
83
|
require 'radiator'
|
74
84
|
|
85
|
+
api = Radiator::Api.new
|
86
|
+
api.get_dynamic_global_properties do |properties|
|
87
|
+
properties.virtual_supply
|
88
|
+
end
|
89
|
+
=> "135377049.603 STEEM"
|
90
|
+
```
|
91
|
+
|
92
|
+
... or ...
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
require 'radiator'
|
96
|
+
|
75
97
|
api = Radiator::Api.new
|
76
98
|
response = api.get_dynamic_global_properties
|
77
99
|
response.result.virtual_supply
|
@@ -82,8 +104,9 @@ response.result.virtual_supply
|
|
82
104
|
|
83
105
|
```ruby
|
84
106
|
api = Radiator::FollowApi.new
|
85
|
-
|
86
|
-
|
107
|
+
api.get_followers('inertia', 0, 'blog', 100) do |followers|
|
108
|
+
followers.map(&:follower)
|
109
|
+
end
|
87
110
|
=> ["a11at",
|
88
111
|
"abarefootpoet",
|
89
112
|
"abit",
|
@@ -104,6 +127,8 @@ response.result.map(&:follower)
|
|
104
127
|
"steemzine"]
|
105
128
|
```
|
106
129
|
|
130
|
+
#### Streaming
|
131
|
+
|
107
132
|
Here's an example of how to use a streaming instance to listen for votes:
|
108
133
|
|
109
134
|
```ruby
|
@@ -140,8 +165,6 @@ helikopterben voted for etcmike (weight: 100.0%)
|
|
140
165
|
.
|
141
166
|
```
|
142
167
|
|
143
|
-
#### Streaming
|
144
|
-
|
145
168
|
You can also just stream all operations like this:
|
146
169
|
|
147
170
|
```ruby
|
@@ -207,6 +230,29 @@ Example of the output:
|
|
207
230
|
.
|
208
231
|
```
|
209
232
|
|
233
|
+
You can also stream virtual operations:
|
234
|
+
|
235
|
+
```ruby
|
236
|
+
stream.operations(:producer_reward) do |op|
|
237
|
+
puts "#{op.producer} got a reward: #{op.vesting_shares}"
|
238
|
+
end
|
239
|
+
```
|
240
|
+
|
241
|
+
Example of the output:
|
242
|
+
|
243
|
+
```
|
244
|
+
anyx got a reward: 390.974648 VESTS
|
245
|
+
gtg got a reward: 390.974647 VESTS
|
246
|
+
someguy123 got a reward: 390.974646 VESTS
|
247
|
+
jesta got a reward: 390.974646 VESTS
|
248
|
+
blocktrades got a reward: 390.974645 VESTS
|
249
|
+
timcliff got a reward: 390.974644 VESTS
|
250
|
+
bhuz got a reward: 1961.046504 VESTS
|
251
|
+
.
|
252
|
+
.
|
253
|
+
.
|
254
|
+
```
|
255
|
+
|
210
256
|
Transactions are supported:
|
211
257
|
|
212
258
|
```ruby
|
@@ -345,6 +391,36 @@ tx.process(true)
|
|
345
391
|
|
346
392
|
There's a complete list of operations known to Radiator in [`broadcast_operations.json`](https://github.com/inertia186/radiator/blob/master/lib/radiator/broadcast_operations.json).
|
347
393
|
|
394
|
+
## Failover
|
395
|
+
|
396
|
+
Radiator supports failover for situations where a node has, for example, become unresponsive. When creating a new instance of `::Api`, `::Stream`, and `::Transaction`, you may provide a list of alternative nodes, or leave them out to use the default list. For example:
|
397
|
+
|
398
|
+
```ruby
|
399
|
+
options = {
|
400
|
+
ur: 'https://steemd.steemit.com',
|
401
|
+
failover_urls: [
|
402
|
+
'https://steemd.steemitstage.com',
|
403
|
+
'https://gtg.steem.house:8090'
|
404
|
+
]
|
405
|
+
}
|
406
|
+
|
407
|
+
api = Radiator::Api.new(options)
|
408
|
+
```
|
409
|
+
|
410
|
+
In a nutshell, the way this works is Radiator will try a node and proceed until it encounters an error, then retry the request. If it encounters a second error within 5 minutes, it will abandon the node and try a random one from `failover_urls`.
|
411
|
+
|
412
|
+
It'll keep doing this until it runs out of failovers, then it will reset the configuration and go back to the original node.
|
413
|
+
|
414
|
+
Radiator uses an exponential back-off subroutine to avoid slamming nodes when they act up.
|
415
|
+
|
416
|
+
There's an additional behavior in `::Stream`. When a node responds with a block out of sequence, it will use the failover logic above. Although this is not a network layer failure, it is a bad result that may indicate a problem on the node, so a new node is picked.
|
417
|
+
|
418
|
+
There is another rare scenario involving `::Transaction` broadcasts that's handled by the failover logic: When a node responds with a network error *after* a signed transaction is accepted, Radiator will do a look-up to find the accepted signature in order to avoid triggering a `dupe_check` error from the blockchain. This subroutine might take up to five minutes to execute in the worst possible situation. To disable this behavior, use the `recover_transactions_on_error` and set it to `false`, e.g.:
|
419
|
+
|
420
|
+
```ruby
|
421
|
+
tx = Radiator::Transaction.new(wif: wif, recover_transactions_on_error: false)
|
422
|
+
```
|
423
|
+
|
348
424
|
## Tests
|
349
425
|
|
350
426
|
* Clone the client repository into a directory of your choice:
|
data/lib/radiator/api.rb
CHANGED
@@ -138,9 +138,9 @@ module Radiator
|
|
138
138
|
'https://steemd-int.steemit.com',
|
139
139
|
'https://steemd.steemitstage.com',
|
140
140
|
'https://gtg.steem.house:8090',
|
141
|
-
|
142
|
-
|
143
|
-
|
141
|
+
'https://seed.bitcoiner.me',
|
142
|
+
'https://steemd.minnowsupportproject.org',
|
143
|
+
'https://steemd.privex.io',
|
144
144
|
'https://rpc.steemliberator.com'
|
145
145
|
]
|
146
146
|
|
data/lib/radiator/stream.rb
CHANGED
@@ -92,7 +92,7 @@ module Radiator
|
|
92
92
|
# ... or multiple virtual operation types;
|
93
93
|
#
|
94
94
|
# stream = Radiator::Stream.new
|
95
|
-
# stream.operations([:
|
95
|
+
# stream.operations([:producer_reward, :author_reward]) do |vop|
|
96
96
|
# puts vop
|
97
97
|
# end
|
98
98
|
#
|
@@ -105,6 +105,7 @@ module Radiator
|
|
105
105
|
#
|
106
106
|
# Expected virtual operation types:
|
107
107
|
#
|
108
|
+
# producer_reward
|
108
109
|
# author_reward
|
109
110
|
# curation_reward
|
110
111
|
# fill_convert_request
|
data/lib/radiator/version.rb
CHANGED
data/radiator.gemspec
CHANGED
@@ -21,9 +21,9 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency 'rake', '~> 12.1', '>= 12.1.0'
|
22
22
|
spec.add_development_dependency 'minitest', '~> 5.9', '>= 5.9.0'
|
23
23
|
spec.add_development_dependency 'minitest-line', '~> 0.6.3'
|
24
|
-
spec.add_development_dependency 'webmock', '~>
|
24
|
+
spec.add_development_dependency 'webmock', '~> 3.1', '>= 3.1.0'
|
25
25
|
spec.add_development_dependency 'simplecov', '~> 0.15.1'
|
26
|
-
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.5
|
26
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0', '>= 1.0.5'
|
27
27
|
spec.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.3'
|
28
28
|
spec.add_development_dependency 'faraday', '~> 0.9.2'
|
29
29
|
spec.add_development_dependency 'typhoeus', '~> 1.0', '>= 1.0.2'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.0rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Martin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -90,20 +90,20 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - "~>"
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: '
|
93
|
+
version: '3.1'
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 3.1.0
|
97
97
|
type: :development
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '3.1'
|
104
104
|
- - ">="
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version:
|
106
|
+
version: 3.1.0
|
107
107
|
- !ruby/object:Gem::Dependency
|
108
108
|
name: simplecov
|
109
109
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,14 +124,20 @@ dependencies:
|
|
124
124
|
requirements:
|
125
125
|
- - "~>"
|
126
126
|
- !ruby/object:Gem::Version
|
127
|
-
version: 0
|
127
|
+
version: '1.0'
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 1.0.5
|
128
131
|
type: :development
|
129
132
|
prerelease: false
|
130
133
|
version_requirements: !ruby/object:Gem::Requirement
|
131
134
|
requirements:
|
132
135
|
- - "~>"
|
133
136
|
- !ruby/object:Gem::Version
|
134
|
-
version: 0
|
137
|
+
version: '1.0'
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: 1.0.5
|
135
141
|
- !ruby/object:Gem::Dependency
|
136
142
|
name: vcr
|
137
143
|
requirement: !ruby/object:Gem::Requirement
|