radiator 0.2.2 → 0.2.3a

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
  SHA1:
3
- metadata.gz: f445f7bdbfee7ed88d335b32523f795f8979b4a8
4
- data.tar.gz: a0ec8aca8bcdbd71366c792d9b623673972d17df
3
+ metadata.gz: 233a14d93ff5d6e154945bb6ae6355238c93cfe9
4
+ data.tar.gz: 841ae7ad957e4c34a8c2e9e9738554b368646480
5
5
  SHA512:
6
- metadata.gz: 2450d17aa2f377a1f7b6726dc564e34ce5b65f1346796163eb52896a28559ebc581f89322016a44e401d5844f56a73367f8012998c603adf0871b6c7039cb434
7
- data.tar.gz: 0eab8c1ebd65bfe2f58a31b2dabed2e1cbe1d0f444930fe977a57c254cab7fce5596f1697c087e57544cd69f9703b3ffa4cbc019ca7ed214a27257446408403d
6
+ metadata.gz: ed970218b63fb9c5aea828e81e3f9aa6c0d8a4b0bd37cd847e2393cbaf0b185f9e96a69e4f99bbe03001020f650ef133a3a7c2b7802f15bcae1d5a8ac59c3afd
7
+ data.tar.gz: d0b044c28b9c8ce479ffcee8bcc1ec773d9060a1243ae9263867c888f5d9d08798bb07f6499e43d020ec111f2aa938f24d6e9a9174e653ce2c7968335d3172d1
data/.gitignore CHANGED
@@ -48,3 +48,4 @@ build-iPhoneSimulator/
48
48
 
49
49
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
50
  .rvmrc
51
+ hashie.log
data/.travis.yml CHANGED
@@ -2,8 +2,10 @@ language: ruby
2
2
  rvm:
3
3
  # - "2.0.0"
4
4
  # - "2.1.5"
5
- - "2.2.1"
5
+ # - "2.2.1"
6
6
  - "2.3.0"
7
+ - "2.4.2"
8
+ # - "2.5.0" # dev
7
9
  script: TESTOPTS="--verbose" bundle exec rake test
8
10
  addons:
9
11
  code_climate:
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- radiator (0.2.2)
5
- bitcoin-ruby (= 0.0.10)
4
+ radiator (0.2.3a)
5
+ bitcoin-ruby (= 0.0.11)
6
6
  ffi (= 1.9.18)
7
7
  hashie (~> 3.5, >= 3.5.5)
8
8
  json (~> 1.8, >= 1.8.6)
@@ -12,13 +12,13 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- addressable (2.5.1)
16
- public_suffix (~> 2.0, >= 2.0.2)
17
- awesome_print (1.7.0)
18
- bitcoin-ruby (0.0.10)
15
+ addressable (2.5.2)
16
+ public_suffix (>= 2.0.2, < 4.0)
17
+ awesome_print (1.8.0)
18
+ bitcoin-ruby (0.0.11)
19
19
  codeclimate-test-reporter (0.5.2)
20
20
  simplecov (>= 0.7.1, < 1.0.0)
21
- coderay (1.1.1)
21
+ coderay (1.1.2)
22
22
  crack (0.4.3)
23
23
  safe_yaml (~> 1.0.0)
24
24
  docile (1.1.5)
@@ -27,34 +27,34 @@ GEM
27
27
  faraday (0.9.2)
28
28
  multipart-post (>= 1.2, < 3)
29
29
  ffi (1.9.18)
30
- hashdiff (0.3.4)
31
- hashie (3.5.5)
30
+ hashdiff (0.3.6)
31
+ hashie (3.5.6)
32
32
  json (1.8.6)
33
33
  little-plugger (1.1.4)
34
34
  logging (2.2.2)
35
35
  little-plugger (~> 1.1)
36
36
  multi_json (~> 1.10)
37
37
  method_source (0.8.2)
38
- minitest (5.10.2)
39
- minitest-line (0.6.3)
38
+ minitest (5.10.3)
39
+ minitest-line (0.6.4)
40
40
  minitest (~> 5.0)
41
- multi_json (1.12.1)
41
+ multi_json (1.12.2)
42
42
  multipart-post (2.0.0)
43
43
  net-http-persistent (2.9.4)
44
44
  pry (0.10.4)
45
45
  coderay (~> 1.1.0)
46
46
  method_source (~> 0.8.1)
47
47
  slop (~> 3.4)
48
- public_suffix (2.0.5)
48
+ public_suffix (3.0.0)
49
49
  rake (11.3.0)
50
50
  safe_yaml (1.0.4)
51
51
  simplecov (0.11.2)
52
52
  docile (~> 1.1.0)
53
53
  json (~> 1.8)
54
54
  simplecov-html (~> 0.10.0)
55
- simplecov-html (0.10.0)
55
+ simplecov-html (0.10.2)
56
56
  slop (3.6.0)
57
- typhoeus (1.1.2)
57
+ typhoeus (1.3.0)
58
58
  ethon (>= 0.9.0)
59
59
  vcr (2.9.3)
60
60
  webmock (2.3.2)
@@ -68,7 +68,7 @@ PLATFORMS
68
68
 
69
69
  DEPENDENCIES
70
70
  awesome_print (~> 1.7, >= 1.7.0)
71
- bundler (~> 1.14, >= 1.14.6)
71
+ bundler (~> 1.15, >= 1.15.4)
72
72
  codeclimate-test-reporter (~> 0.5.2)
73
73
  faraday (~> 0.9.2)
74
74
  minitest (~> 5.9, >= 5.9.0)
@@ -83,4 +83,4 @@ DEPENDENCIES
83
83
  yard (~> 0.8.7.6)
84
84
 
85
85
  BUNDLED WITH
86
- 1.14.6
86
+ 1.15.4
data/README.md CHANGED
@@ -9,6 +9,15 @@
9
9
 
10
10
  Radiator is an API Client for interaction with the STEEM network using Ruby.
11
11
 
12
+ #### Fixes in v0.2.3
13
+
14
+ * Gem updates
15
+ * Added low-level support for persistence and retrying API requests.
16
+ * Now using exponential back-off for retries.
17
+ * Detecting presence of `transaction_ids` (if enabled by the node).
18
+ * Default for `Hashie` warnings now go to `/dev/null`, where they belong.
19
+ * Added stray methods/operations.
20
+
12
21
  #### Fixes in v0.2.2
13
22
 
14
23
  * Gem updates
@@ -194,8 +203,8 @@ Example of the output:
194
203
  Transactions are supported:
195
204
 
196
205
  ```ruby
197
- stream.transactions do |tx|
198
- puts tx.to_json
206
+ stream.transactions do |tx, trx_id|
207
+ puts "[#{trx_id}] #{tx.to_json}"
199
208
  end
200
209
  ```
201
210
 
@@ -234,8 +243,8 @@ Example of the output:
234
243
  Even whole blocks:
235
244
 
236
245
  ```ruby
237
- stream.blocks do |bk|
238
- puts bk.to_json
246
+ stream.blocks do |bk, num|
247
+ puts "[#{num}] #{bk.to_json}"
239
248
  end
240
249
  ```
241
250
 
data/lib/radiator/api.rb CHANGED
@@ -14,8 +14,13 @@ module Radiator
14
14
  @debug = !!options[:debug]
15
15
  @net_http_persistent_enabled = true
16
16
  @logger = options[:logger] || Radiator.logger
17
+ @hashie_logger = options[:hashie_logger] || Logger.new('/dev/null')
17
18
 
18
- Hashie.logger = @logger
19
+ unless @hashie_logger.respond_to? :warn
20
+ @hashie_logger = Logger.new(@hashie_logger)
21
+ end
22
+
23
+ Hashie.logger = @hashie_logger
19
24
  @method_names = nil
20
25
  end
21
26
 
@@ -107,14 +112,65 @@ module Radiator
107
112
  id: rpc_id,
108
113
  method: "call"
109
114
  }
110
-
111
- response = request(options)
112
115
 
113
- if !!response
114
- response = JSON[response.body]
115
-
116
- Hashie::Mash.new(response)
117
- end
116
+ loop do
117
+ begin
118
+ response = request(options)
119
+
120
+ if !!response
121
+ case response.code
122
+ when '200'
123
+ response = JSON[response.body]
124
+
125
+ return Hashie::Mash.new(response)
126
+ when '400'
127
+ @logger.warn('Code 400: Bad Request, retrying ...')
128
+ backoff
129
+ when '502'
130
+ @logger.warn('Code 502: Bad Gateway, retrying ...')
131
+ backoff
132
+ when '503'
133
+ @logger.warn('Code 503: Service Unavailable, retrying ...')
134
+ backoff
135
+ when '504'
136
+ @logger.warn('Code 504: Gateway Timeout, retrying ...')
137
+ backoff
138
+ else
139
+ ap "Unknown code #{response.code}, retrying ..."
140
+ ap response
141
+ backoff
142
+ end
143
+ end
144
+
145
+ @logger.error("No response.")
146
+ break
147
+ rescue Errno::ECONNREFUSED => e
148
+ @logger.warn('Connection refused, retrying ...')
149
+ backoff
150
+ rescue Errno::EADDRNOTAVAIL => e
151
+ @logger.warn('Node not available, retrying ...')
152
+ backoff
153
+ rescue Net::ReadTimeout => e
154
+ @logger.warn('Node read timeout, retrying ...')
155
+ backoff
156
+ rescue Net::OpenTimeout => e
157
+ @logger.warn('Node timeout, retrying ...')
158
+ backoff
159
+ rescue RangeError => e
160
+ @logger.warn('Range Error, retrying ...')
161
+ backoff
162
+ rescue OpenSSL::SSL::SSLError => e
163
+ @logger.warn("SSL Error (#{e.message}), retrying ...")
164
+ backoff
165
+ rescue SocketError => e
166
+ @logger.warn("Socket Error (#{e.message}), retrying ...")
167
+ backoff
168
+ rescue => e
169
+ puts "Unknown exception from request ..."
170
+ ap e
171
+ backoff
172
+ end
173
+ end # loop
118
174
  end
119
175
 
120
176
  def shutdown
@@ -152,23 +208,52 @@ module Radiator
152
208
  end
153
209
  end
154
210
 
211
+ def post_request
212
+ Net::HTTP::Post.new uri.request_uri, 'Content-Type' => 'application/json'
213
+ end
214
+
155
215
  def request(options)
156
216
  if !!@net_http_persistent_enabled
157
217
  begin
158
- request = Net::HTTP::Post.new uri.request_uri, 'Content-Type' => 'application/json'
218
+ request = post_request
159
219
  request.body = JSON[options]
160
- return http.request(uri, request)
220
+
221
+ if (response = http.request(uri, request)).kind_of? Net::HTTPSuccess
222
+ return response
223
+ else
224
+ @logger.warn "Unexpeced response: #{response.inspect}; temporarily falling back to non-persistent-http"
225
+ end
161
226
  rescue Net::HTTP::Persistent::Error => e
162
- @logger.warn "Unable to perform request: #{request} :: #{e}: #{e.backtrace}"
163
- @net_http_persistent_enabled = false
227
+ @logger.warn "Unable to perform request: #{request} :: #{e} :: #{!!e.cause ? "cause: #{e.cause.message}" : ''}; temporarily falling back to non-persistent-http"
164
228
  end
229
+
230
+ @net_http_persistent_enabled = false
165
231
  end
166
232
 
167
233
  unless @net_http_persistent_enabled
168
- @http = Net::HTTP.new(uri.host, uri.port)
169
- request = Net::HTTP::Post.new uri.request_uri, 'Content-Type' => 'application/json'
234
+ non_persistent_http = Net::HTTP.new(uri.host, uri.port)
235
+ non_persistent_http.use_ssl = true
236
+ non_persistent_http.verify_mode = OpenSSL::SSL::VERIFY_NONE
237
+ request = post_request
170
238
  request.body = JSON[options]
171
- @http.request(request)
239
+
240
+ # Try to go back to http persistent on next request.
241
+ @net_http_persistent_enabled = true
242
+
243
+ non_persistent_http.request(request)
244
+ end
245
+ end
246
+
247
+ def backoff
248
+ @backoff_at ||= Time.now
249
+ @backoff_sleep ||= 0.01
250
+
251
+ @backoff_sleep *= 2
252
+ sleep @backoff_sleep
253
+
254
+ if Time.now - @backoff_at > 300
255
+ @backoff_at = nil
256
+ @backoff_sleep = nil
172
257
  end
173
258
  end
174
259
  end
@@ -1,9 +1,9 @@
1
1
  // Copied from:
2
- // https://raw.githubusercontent.com/steemit/steem-js/master/src/broadcast/operations.json
2
+ // https://raw.githubusercontent.com/steemit/steem-js/master/src/broadcast/operations.js
3
3
 
4
4
  [
5
5
  {
6
- "roles": ["posting"],
6
+ "roles": ["posting", "active", "owner"],
7
7
  "operation": "vote",
8
8
  "params": [
9
9
  "voter",
@@ -13,7 +13,7 @@
13
13
  ]
14
14
  },
15
15
  {
16
- "roles": ["posting"],
16
+ "roles": ["posting", "active", "owner"],
17
17
  "operation": "comment",
18
18
  "params": [
19
19
  "parent_author",
@@ -36,7 +36,7 @@
36
36
  ]
37
37
  },
38
38
  {
39
- "roles": ["active"],
39
+ "roles": ["active", "owner"],
40
40
  "operation": "transfer_to_vesting",
41
41
  "params": [
42
42
  "from",
@@ -45,7 +45,7 @@
45
45
  ]
46
46
  },
47
47
  {
48
- "roles": ["active"],
48
+ "roles": ["active", "owner"],
49
49
  "operation": "withdraw_vesting",
50
50
  "params": [
51
51
  "account",
@@ -53,7 +53,7 @@
53
53
  ]
54
54
  },
55
55
  {
56
- "roles": ["active"],
56
+ "roles": ["active", "owner"],
57
57
  "operation": "limit_order_create",
58
58
  "params": [
59
59
  "owner",
@@ -65,7 +65,7 @@
65
65
  ]
66
66
  },
67
67
  {
68
- "roles": ["active"],
68
+ "roles": ["active", "owner"],
69
69
  "operation": "limit_order_cancel",
70
70
  "params": [
71
71
  "owner",
@@ -73,7 +73,7 @@
73
73
  ]
74
74
  },
75
75
  {
76
- "roles": ["active"],
76
+ "roles": ["active", "owner"],
77
77
  "operation": "price",
78
78
  "params": [
79
79
  "base",
@@ -81,7 +81,7 @@
81
81
  ]
82
82
  },
83
83
  {
84
- "roles": ["active"],
84
+ "roles": ["active", "owner"],
85
85
  "operation": "feed_publish",
86
86
  "params": [
87
87
  "publisher",
@@ -89,7 +89,7 @@
89
89
  ]
90
90
  },
91
91
  {
92
- "roles": ["active"],
92
+ "roles": ["active", "owner"],
93
93
  "operation": "convert",
94
94
  "params": [
95
95
  "owner",
@@ -98,7 +98,7 @@
98
98
  ]
99
99
  },
100
100
  {
101
- "roles": ["active"],
101
+ "roles": ["active", "owner"],
102
102
  "operation": "account_create",
103
103
  "params": [
104
104
  "fee",
@@ -112,7 +112,7 @@
112
112
  ]
113
113
  },
114
114
  {
115
- "roles": ["owner", "active"],
115
+ "roles": ["active", "owner"],
116
116
  "operation": "account_update",
117
117
  "params": [
118
118
  "account",
@@ -124,7 +124,7 @@
124
124
  ]
125
125
  },
126
126
  {
127
- "roles": ["active"],
127
+ "roles": ["active", "owner"],
128
128
  "operation": "witness_update",
129
129
  "params": [
130
130
  "owner",
@@ -135,7 +135,7 @@
135
135
  ]
136
136
  },
137
137
  {
138
- "roles": ["posting"],
138
+ "roles": ["active", "owner"],
139
139
  "operation": "account_witness_vote",
140
140
  "params": [
141
141
  "account",
@@ -144,7 +144,7 @@
144
144
  ]
145
145
  },
146
146
  {
147
- "roles": ["posting"],
147
+ "roles": ["active", "owner"],
148
148
  "operation": "account_witness_proxy",
149
149
  "params": [
150
150
  "account",
@@ -152,7 +152,7 @@
152
152
  ]
153
153
  },
154
154
  {
155
- "roles": ["active"],
155
+ "roles": ["active", "owner"],
156
156
  "operation": "pow",
157
157
  "params": [
158
158
  "worker",
@@ -162,7 +162,7 @@
162
162
  ]
163
163
  },
164
164
  {
165
- "roles": ["active"],
165
+ "roles": ["active", "owner"],
166
166
  "operation": "custom",
167
167
  "params": [
168
168
  "required_auths",
@@ -171,7 +171,7 @@
171
171
  ]
172
172
  },
173
173
  {
174
- "roles": ["posting"],
174
+ "roles": ["posting", "active", "owner"],
175
175
  "operation": "delete_comment",
176
176
  "params": [
177
177
  "author",
@@ -179,7 +179,7 @@
179
179
  ]
180
180
  },
181
181
  {
182
- "roles": ["posting", "active"],
182
+ "roles": ["posting", "active", "owner"],
183
183
  "operation": "custom_json",
184
184
  "params": [
185
185
  "required_auths",
@@ -189,7 +189,7 @@
189
189
  ]
190
190
  },
191
191
  {
192
- "roles": ["posting"],
192
+ "roles": ["posting", "active", "owner"],
193
193
  "operation": "comment_options",
194
194
  "params": [
195
195
  "author",
@@ -203,7 +203,7 @@
203
203
  ]
204
204
  },
205
205
  {
206
- "roles": ["active"],
206
+ "roles": ["active", "owner"],
207
207
  "operation": "set_withdraw_vesting_route",
208
208
  "params": [
209
209
  "from_account",
@@ -213,7 +213,7 @@
213
213
  ]
214
214
  },
215
215
  {
216
- "roles": ["active"],
216
+ "roles": ["active", "owner"],
217
217
  "operation": "limit_order_create2",
218
218
  "params": [
219
219
  "owner",
@@ -225,7 +225,7 @@
225
225
  ]
226
226
  },
227
227
  {
228
- "roles": ["posting"],
228
+ "roles": ["posting", "active", "owner"],
229
229
  "operation": "challenge_authority",
230
230
  "params": [
231
231
  "challenger",
@@ -242,7 +242,7 @@
242
242
  ]
243
243
  },
244
244
  {
245
- "roles": ["active"],
245
+ "roles": ["active", "owner"],
246
246
  "operation": "request_account_recovery",
247
247
  "params": [
248
248
  "recovery_account",
@@ -251,6 +251,16 @@
251
251
  "extensions"
252
252
  ]
253
253
  },
254
+ {
255
+ "roles": ["owner"],
256
+ "operation": "recover_account",
257
+ "params": [
258
+ "account_to_recover",
259
+ "new_owner_authority",
260
+ "recent_owner_authority",
261
+ "extensions"
262
+ ]
263
+ },
254
264
  {
255
265
  "roles": ["owner"],
256
266
  "operation": "change_recovery_account",
@@ -261,7 +271,7 @@
261
271
  ]
262
272
  },
263
273
  {
264
- "roles": ["active"],
274
+ "roles": ["active", "owner"],
265
275
  "operation": "escrow_transfer",
266
276
  "params": [
267
277
  "from",
@@ -277,7 +287,7 @@
277
287
  ]
278
288
  },
279
289
  {
280
- "roles": ["active"],
290
+ "roles": ["active", "owner"],
281
291
  "operation": "escrow_dispute",
282
292
  "params": [
283
293
  "from",
@@ -288,7 +298,7 @@
288
298
  ]
289
299
  },
290
300
  {
291
- "roles": ["active"],
301
+ "roles": ["active", "owner"],
292
302
  "operation": "escrow_release",
293
303
  "params": [
294
304
  "from",
@@ -302,7 +312,7 @@
302
312
  ]
303
313
  },
304
314
  {
305
- "roles": ["active"],
315
+ "roles": ["active", "owner"],
306
316
  "operation": "pow2",
307
317
  "params": [
308
318
  "input",
@@ -310,7 +320,7 @@
310
320
  ]
311
321
  },
312
322
  {
313
- "roles": ["active"],
323
+ "roles": ["active", "owner"],
314
324
  "operation": "escrow_approve",
315
325
  "params": [
316
326
  "from",
@@ -322,7 +332,7 @@
322
332
  ]
323
333
  },
324
334
  {
325
- "roles": ["active"],
335
+ "roles": ["active", "owner"],
326
336
  "operation": "transfer_to_savings",
327
337
  "params": [
328
338
  "from",
@@ -332,7 +342,7 @@
332
342
  ]
333
343
  },
334
344
  {
335
- "roles": ["active"],
345
+ "roles": ["active", "owner"],
336
346
  "operation": "transfer_from_savings",
337
347
  "params": [
338
348
  "from",
@@ -343,7 +353,7 @@
343
353
  ]
344
354
  },
345
355
  {
346
- "roles": ["active"],
356
+ "roles": ["active", "owner"],
347
357
  "operation": "cancel_transfer_from_savings",
348
358
  "params": [
349
359
  "from",
@@ -367,7 +377,7 @@
367
377
  ]
368
378
  },
369
379
  {
370
- "roles": ["active"],
380
+ "roles": ["active", "owner"],
371
381
  "operation": "reset_account",
372
382
  "params": [
373
383
  "reset_account",
@@ -385,7 +395,7 @@
385
395
  ]
386
396
  },
387
397
  {
388
- "roles": ["posting"],
398
+ "roles": ["posting", "active", "owner"],
389
399
  "operation": "claim_reward_balance",
390
400
  "params": [
391
401
  "account",
@@ -395,7 +405,7 @@
395
405
  ]
396
406
  },
397
407
  {
398
- "roles": ["active"],
408
+ "roles": ["active", "owner"],
399
409
  "operation": "delegate_vesting_shares",
400
410
  "params": [
401
411
  "delegator",
@@ -404,7 +414,7 @@
404
414
  ]
405
415
  },
406
416
  {
407
- "roles": ["active"],
417
+ "roles": ["active", "owner"],
408
418
  "operation": "account_create_with_delegation",
409
419
  "params": [
410
420
  "fee",
@@ -420,7 +430,7 @@
420
430
  ]
421
431
  },
422
432
  {
423
- "roles": ["active"],
433
+ "roles": ["active", "owner"],
424
434
  "operation": "fill_convert_request",
425
435
  "params": [
426
436
  "owner",
@@ -430,7 +440,7 @@
430
440
  ]
431
441
  },
432
442
  {
433
- "roles": ["posting"],
443
+ "roles": ["posting", "active", "owner"],
434
444
  "operation": "comment_reward",
435
445
  "params": [
436
446
  "author",
@@ -439,7 +449,7 @@
439
449
  ]
440
450
  },
441
451
  {
442
- "roles": ["active"],
452
+ "roles": ["active", "owner"],
443
453
  "operation": "liquidity_reward",
444
454
  "params": [
445
455
  "owner",
@@ -447,7 +457,7 @@
447
457
  ]
448
458
  },
449
459
  {
450
- "roles": ["active"],
460
+ "roles": ["active", "owner"],
451
461
  "operation": "interest",
452
462
  "params": [
453
463
  "owner",
@@ -455,7 +465,7 @@
455
465
  ]
456
466
  },
457
467
  {
458
- "roles": ["active"],
468
+ "roles": ["active", "owner"],
459
469
  "operation": "fill_vesting_withdraw",
460
470
  "params": [
461
471
  "from_account",
@@ -465,7 +475,7 @@
465
475
  ]
466
476
  },
467
477
  {
468
- "roles": ["posting"],
478
+ "roles": ["posting", "active", "owner"],
469
479
  "operation": "fill_order",
470
480
  "params": [
471
481
  "current_owner",
@@ -477,7 +487,7 @@
477
487
  ]
478
488
  },
479
489
  {
480
- "roles": ["posting"],
490
+ "roles": ["posting", "active", "owner"],
481
491
  "operation": "fill_transfer_from_savings",
482
492
  "params": [
483
493
  "from",
@@ -1,5 +1,5 @@
1
1
  // Copied from:
2
- // https://raw.githubusercontent.com/steemit/steem-js/master/src/api/methods.json
2
+ // https://raw.githubusercontent.com/steemit/steem-js/master/src/api/methods.js
3
3
 
4
4
  [
5
5
  {
@@ -315,7 +315,7 @@
315
315
  {
316
316
  "api": "database_api",
317
317
  "method": "get_content_replies",
318
- "params": ["parent", "parentPermlink"]
318
+ "params": ["author", "permlink"]
319
319
  },
320
320
  {
321
321
  "api": "database_api",
@@ -359,6 +359,16 @@
359
359
  "api": "database_api",
360
360
  "method": "get_miner_queue"
361
361
  },
362
+ {
363
+ "api": "database_api",
364
+ "method": "get_reward_fund",
365
+ "params": ["name"]
366
+ },
367
+ {
368
+ "api": "database_api",
369
+ "method": "get_vesting_delegations",
370
+ "params": ["account", "from", "limit"]
371
+ },
362
372
  {
363
373
  "api": "login_api",
364
374
  "method": "login",
@@ -484,9 +494,5 @@
484
494
  "api": "market_history_api",
485
495
  "method": "get_market_history_buckets",
486
496
  "params": []
487
- },
488
- {
489
- "api": "database_api",
490
- "method": "get_reward_fund"
491
497
  }
492
498
  ]
@@ -5,7 +5,10 @@ module Radiator
5
5
  include Utils
6
6
 
7
7
  def initialize(options = {})
8
- options.each do |k, v|
8
+ opt = options.dup
9
+ @type = opt.delete(:type)
10
+
11
+ opt.each do |k, v|
9
12
  instance_variable_set("@#{k}", type(@type, k, v))
10
13
  end
11
14
 
@@ -139,8 +139,12 @@ module Radiator
139
139
  next if (_transactions = b.transactions).nil?
140
140
  return _transactions unless !!block
141
141
 
142
- _transactions.each.each do |transaction|
143
- yield transaction
142
+ _transactions.each_with_index do |transaction, index|
143
+ trx_id = if !!b['transaction_ids']
144
+ b['transaction_ids'][index]
145
+ end
146
+
147
+ yield transaction, trx_id
144
148
  end
145
149
  end
146
150
  end
@@ -186,9 +190,9 @@ module Radiator
186
190
  result = response.result
187
191
 
188
192
  if !!block
189
- yield result
193
+ yield result, n
190
194
  else
191
- return result
195
+ return result, n
192
196
  end
193
197
  end
194
198
 
@@ -6,7 +6,7 @@ module Radiator
6
6
  def initialize(value)
7
7
  super(:amount, value)
8
8
 
9
- @amount, @asset = @value.strip.split(' ')
9
+ @amount, @asset = value.strip.split(' ')
10
10
  @precision = case @asset
11
11
  when 'STEEM' then 3
12
12
  when 'VESTS' then 6
@@ -1,3 +1,3 @@
1
1
  module Radiator
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3a'
3
3
  end
data/radiator.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test)/}) }
18
18
  spec.require_paths = ['lib']
19
19
 
20
- spec.add_development_dependency 'bundler', '~> 1.14', '>= 1.14.6'
20
+ spec.add_development_dependency 'bundler', '~> 1.15', '>= 1.15.4'
21
21
  spec.add_development_dependency 'rake', '~> 11.2', '>= 11.2.2'
22
22
  spec.add_development_dependency 'minitest', '~> 5.9', '>= 5.9.0'
23
23
  spec.add_development_dependency 'minitest-line', '~> 0.6.3'
@@ -37,6 +37,6 @@ Gem::Specification.new do |spec|
37
37
  spec.add_dependency('json', '~> 1.8', '>= 1.8.6')
38
38
  spec.add_dependency('logging', '~> 2.2', '>= 2.2.0')
39
39
  spec.add_dependency('hashie', '~> 3.5', '>= 3.5.5')
40
- spec.add_dependency('bitcoin-ruby', '0.0.10')
40
+ spec.add_dependency('bitcoin-ruby', '0.0.11')
41
41
  spec.add_dependency('ffi', '1.9.18')
42
42
  end
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.2.2
4
+ version: 0.2.3a
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-05-27 00:00:00.000000000 Z
11
+ date: 2017-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.14'
19
+ version: '1.15'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.14.6
22
+ version: 1.15.4
23
23
  type: :development
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '1.14'
29
+ version: '1.15'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 1.14.6
32
+ version: 1.15.4
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rake
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -320,14 +320,14 @@ dependencies:
320
320
  requirements:
321
321
  - - '='
322
322
  - !ruby/object:Gem::Version
323
- version: 0.0.10
323
+ version: 0.0.11
324
324
  type: :runtime
325
325
  prerelease: false
326
326
  version_requirements: !ruby/object:Gem::Requirement
327
327
  requirements:
328
328
  - - '='
329
329
  - !ruby/object:Gem::Version
330
- version: 0.0.10
330
+ version: 0.0.11
331
331
  - !ruby/object:Gem::Dependency
332
332
  name: ffi
333
333
  requirement: !ruby/object:Gem::Requirement
@@ -405,12 +405,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
405
405
  version: '0'
406
406
  required_rubygems_version: !ruby/object:Gem::Requirement
407
407
  requirements:
408
- - - ">="
408
+ - - ">"
409
409
  - !ruby/object:Gem::Version
410
- version: '0'
410
+ version: 1.3.1
411
411
  requirements: []
412
412
  rubyforge_project:
413
- rubygems_version: 2.4.8
413
+ rubygems_version: 2.5.1
414
414
  signing_key:
415
415
  specification_version: 4
416
416
  summary: STEEM RPC Ruby Client