radiator 0.2.0a

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4dd93c3f01d7ebd9c0dc529ee4ccbe34d24982bd
4
+ data.tar.gz: 54b2228928b1768b5dc084facde183bf91df8980
5
+ SHA512:
6
+ metadata.gz: 70037ef9d80a2b822bff3635adf4df63bdc5ce53237fe41d84891c499278b6450e06c560a12916e606cf7cd6211c02709832df13d12e32f9a82222a7901bf06b
7
+ data.tar.gz: 925e3c30919d10df0a972f4fe3568f294d60593cd022cc6635a1064c97f8d18cbf893a65297c28ddbcc00e0a6e865c62d6ce16dcceccc4523464406c0893cb3c
data/.codeclimate.yml ADDED
@@ -0,0 +1,19 @@
1
+ ---
2
+ engines:
3
+ bundler-audit:
4
+ enabled: true
5
+ duplication:
6
+ enabled: true
7
+ config:
8
+ languages:
9
+ - ruby
10
+ fixme:
11
+ enabled: true
12
+ rubocop:
13
+ enabled: true
14
+ ratings:
15
+ paths:
16
+ - Gemfile.lock
17
+ - "**.rb"
18
+ exclude_paths:
19
+ - test/
data/.gitignore ADDED
@@ -0,0 +1,50 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - "2.0.0"
4
+ - "2.1.5"
5
+ - "2.2.1"
6
+ - "2.3.0"
7
+ script: TESTOPTS="--verbose" bundle exec rake test
8
+ addons:
9
+ code_climate:
10
+ repo_token: fcda177928c42c93fd981f671305519ffb98b98c479198340ea67bc892ffd028
11
+ notifications:
12
+ slack: galacticaactual:rhAXgZ68aoikbxBBA05xIUVC
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,86 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ radiator (0.2.0a)
5
+ bitcoin-ruby (= 0.0.10)
6
+ ffi (= 1.9.17)
7
+ hashie (~> 3.5, >= 3.5.5)
8
+ json (~> 1.8, >= 1.8.6)
9
+ logging (~> 2.2, >= 2.2.0)
10
+ net-http-persistent (~> 2.9, >= 2.9.4)
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
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)
19
+ codeclimate-test-reporter (0.5.2)
20
+ simplecov (>= 0.7.1, < 1.0.0)
21
+ coderay (1.1.1)
22
+ crack (0.4.3)
23
+ safe_yaml (~> 1.0.0)
24
+ docile (1.1.5)
25
+ ethon (0.10.1)
26
+ ffi (>= 1.3.0)
27
+ faraday (0.12.1)
28
+ multipart-post (>= 1.2, < 3)
29
+ ffi (1.9.17)
30
+ hashdiff (0.3.2)
31
+ hashie (3.5.5)
32
+ json (1.8.6)
33
+ little-plugger (1.1.4)
34
+ logging (2.2.2)
35
+ little-plugger (~> 1.1)
36
+ multi_json (~> 1.10)
37
+ method_source (0.8.2)
38
+ minitest (5.9.1)
39
+ minitest-line (0.6.3)
40
+ minitest (~> 5.0)
41
+ multi_json (1.12.1)
42
+ multipart-post (2.0.0)
43
+ net-http-persistent (2.9.4)
44
+ pry (0.10.4)
45
+ coderay (~> 1.1.0)
46
+ method_source (~> 0.8.1)
47
+ slop (~> 3.4)
48
+ public_suffix (2.0.5)
49
+ rake (11.2.2)
50
+ safe_yaml (1.0.4)
51
+ simplecov (0.11.2)
52
+ docile (~> 1.1.0)
53
+ json (~> 1.8)
54
+ simplecov-html (~> 0.10.0)
55
+ simplecov-html (0.10.0)
56
+ slop (3.6.0)
57
+ typhoeus (1.1.2)
58
+ ethon (>= 0.9.0)
59
+ vcr (3.0.3)
60
+ webmock (2.1.0)
61
+ addressable (>= 2.3.6)
62
+ crack (>= 0.3.2)
63
+ hashdiff
64
+ yard (0.9.9)
65
+
66
+ PLATFORMS
67
+ ruby
68
+
69
+ DEPENDENCIES
70
+ awesome_print (~> 1.7, >= 1.7.0)
71
+ bundler (~> 1.11)
72
+ codeclimate-test-reporter (~> 0.5.2)
73
+ faraday (~> 0.12.1)
74
+ minitest (~> 5.9, >= 5.9.0)
75
+ minitest-line (~> 0.6.3)
76
+ pry (~> 0.10.3)
77
+ radiator!
78
+ rake (~> 11.2, >= 11.2.2)
79
+ simplecov (~> 0.11.2)
80
+ typhoeus (~> 1.1, >= 1.1.2)
81
+ vcr (~> 3.0, >= 3.0.3)
82
+ webmock (~> 2.1, >= 2.1.0)
83
+ yard (~> 0.9.9)
84
+
85
+ BUNDLED WITH
86
+ 1.14.6
data/LICENSE ADDED
@@ -0,0 +1,41 @@
1
+ CC0 1.0 Universal (CC0 1.0)
2
+ Public Domain Dedication
3
+ https://creativecommons.org/publicdomain/zero/1.0/
4
+
5
+ This is a human-readable summary of the Legal Code:
6
+ https://creativecommons.org/publicdomain/zero/1.0/legalcode
7
+
8
+ Disclaimer
9
+
10
+ The Commons Deed is not a legal instrument. It is simply a handy reference for
11
+ understanding the CC0 Legal Code, a human-readable expression of some of its key
12
+ terms. Think of it as the user-friendly interface to the CC0 Legal Code beneath.
13
+ This Deed itself has no legal value, and its contents do not appear in CC0.
14
+ Creative Commons is not a law firm and does not provide legal services.
15
+ Distributing, displaying, or linking to this Commons Deed does not create an
16
+ attorney-client relationship.
17
+
18
+ Creative Commons has not verified the copyright status of any work to which CC0
19
+ has been applied. CC makes no warranties about any work or its copyright status
20
+ in any jurisdiction, and disclaims all liability for all uses of any work.
21
+
22
+ No Copyright
23
+
24
+ The person who associated a work with this deed has dedicated the work to the
25
+ public domain by waiving all of his or her rights to the work worldwide under
26
+ copyright law, including all related and neighboring rights, to the extent
27
+ allowed by law.
28
+
29
+ You can copy, modify, distribute and perform the work, even for commercial
30
+ purposes, all without asking permission. See Other Information below.
31
+
32
+ Other Information
33
+
34
+ * In no way are the patent or trademark rights of any person affected by CC0,
35
+ nor are the rights that other persons may have in the work or in how the work
36
+ is used, such as publicity or privacy rights.
37
+ * Unless expressly stated otherwise, the person who associated a work with this
38
+ deed makes no warranties about the work, and disclaims liability for all uses
39
+ of the work, to the fullest extent permitted by applicable law.
40
+ * When using or citing the work, you should not imply endorsement by the author
41
+ or the affirmer.
data/README.md ADDED
@@ -0,0 +1,362 @@
1
+ [![Build Status](https://travis-ci.org/inertia186/radiator.svg?branch=master)](https://travis-ci.org/inertia186/radiator)
2
+ [![Code Climate](https://codeclimate.com/github/inertia186/radiator/badges/gpa.svg)](https://codeclimate.com/github/inertia186/radiator)
3
+ [![Test Coverage](https://codeclimate.com/github/inertia186/radiator/badges/coverage.svg)](https://codeclimate.com/github/inertia186/radiator)
4
+
5
+ radiator
6
+ ========
7
+
8
+ #### STEEM Ruby API Client
9
+
10
+ Radiator is an API Client for interaction with the STEEM network using Ruby.
11
+
12
+ #### Fixes in v0.2.0a
13
+
14
+ * Updated to support all new methods in HF18.
15
+ * Improved streaming reliability: added max blocks per node (default 100).
16
+ * Gem updates
17
+ * corrected pessimistic dependencies
18
+ * development/testing
19
+ * windows related compatibility
20
+ * Fixed support for array (set) parameters in broadcast operations.
21
+
22
+ ---
23
+
24
+ ### Quick Start
25
+
26
+ Add the gem to your Gemfile:
27
+
28
+ ```ruby
29
+ gem 'radiator'
30
+ ```
31
+
32
+ Then:
33
+
34
+ ```bash
35
+ $ bundle install
36
+ ```
37
+
38
+ If you don't have `bundler`, see the next section.
39
+
40
+ ### Prerequisites
41
+
42
+ #### Linux
43
+
44
+ ```bash
45
+ $ sudo apt-get install ruby-full git openssl libssl1.0.0 libssl-dev
46
+ $ gem install bundler
47
+ ```
48
+
49
+ #### macOS
50
+
51
+ ```
52
+ $ gem install bundler
53
+ ```
54
+
55
+ ### Usage
56
+
57
+ ```ruby
58
+ require 'radiator'
59
+
60
+ api = Radiator::Api.new
61
+ response = api.get_dynamic_global_properties
62
+ response.result.virtual_supply
63
+ => "135377049.603 STEEM"
64
+ ```
65
+
66
+ #### Follower API
67
+
68
+ ```ruby
69
+ api = Radiator::FollowApi.new
70
+ response = api.get_followers('inertia', 0, 'blog', 100)
71
+ response.result.map(&:follower)
72
+ => ["a11at",
73
+ "abarefootpoet",
74
+ "abit",
75
+ "alexgr",
76
+ "alexoz",
77
+ "andressilvera",
78
+ "applecrisp",
79
+ "arrowj",
80
+ "artificial",
81
+ "ash",
82
+ "ausbitbank",
83
+ "beachbum",
84
+ "ben99",
85
+ "benadapt",
86
+ .
87
+ .
88
+ .
89
+ "steemzine"]
90
+ ```
91
+
92
+ Here's an example of how to use a streaming instance to listen for votes:
93
+
94
+ ```ruby
95
+ require 'radiator'
96
+
97
+ stream = Radiator::Stream.new
98
+
99
+ stream.operations(:vote) do |op|
100
+ print "#{op.voter} voted for #{op.author}"
101
+ puts " (weight: #{op.weight / 100.0}%)"
102
+ end
103
+ ```
104
+
105
+ The output would look like this and continue until interrupted.
106
+
107
+ ```
108
+ richman voted for krnel (weight: 100.0%)
109
+ rainchen voted for rainchen (weight: 100.0%)
110
+ richman voted for exploretraveler (weight: 100.0%)
111
+ jlufer voted for michaelstobiersk (weight: 100.0%)
112
+ jlufer voted for michaelstobiersk (weight: 100.0%)
113
+ patelincho voted for borishaifa (weight: 100.0%)
114
+ richman voted for vetvso (weight: 100.0%)
115
+ jlufer voted for michaelstobiersk (weight: 100.0%)
116
+ richman voted for orcish (weight: 100.0%)
117
+ demotruk voted for skeptic (weight: -100.0%)
118
+ photorealistic voted for oecp85 (weight: 100.0%)
119
+ meesterboom voted for rubenalexander (weight: 100.0%)
120
+ thecurator voted for robyneggs (weight: 40.0%)
121
+ richman voted for originate (weight: 100.0%)
122
+ helikopterben voted for etcmike (weight: 100.0%)
123
+ .
124
+ .
125
+ .
126
+ ```
127
+
128
+ #### Streaming
129
+
130
+ You can also just stream all operations like this:
131
+
132
+ ```ruby
133
+ stream.operations do |op|
134
+ puts op.to_json
135
+ end
136
+ ```
137
+
138
+ Example of the output:
139
+
140
+ ```json
141
+ {
142
+ "vote":{
143
+ "voter":"abudar",
144
+ "author":"rangkangandroid",
145
+ "permlink":"the-kalinga-tattoo-maker",
146
+ "weight":10000
147
+ }
148
+ }
149
+ {
150
+ "vote":{
151
+ "voter":"shenburen",
152
+ "author":"masteryoda",
153
+ "permlink":"daily-payouts-leaderboards-september-16",
154
+ "weight":10000
155
+ }
156
+ }
157
+ {
158
+ "vote":{
159
+ "voter":"stiletto",
160
+ "author":"fyrstikken",
161
+ "permlink":"everybody-hating-me",
162
+ "weight":2500
163
+ }
164
+ }
165
+ {
166
+ "comment":{
167
+ "parent_author":"mariandavp",
168
+ "parent_permlink":"re-onceuponatime-re-mariandavp-the-bridge-original-artwork-by-mariandavp-20160906t182016608z",
169
+ "author":"onceuponatime",
170
+ "permlink":"re-mariandavp-re-onceuponatime-re-mariandavp-the-bridge-original-artwork-by-mariandavp-20160917t054726763z",
171
+ "title":"",
172
+ "body":"https://www.steemimg.com/images/2016/09/17/oldcomputerpics551cb14c.jpg",
173
+ "json_metadata":"{\"tags\":[\"art\"],\"image\":[\"https://www.steemimg.com/images/2016/09/17/oldcomputerpics551cb14c.jpg\"]}"
174
+ }
175
+ }
176
+ {
177
+ "vote":{
178
+ "voter":"abudar",
179
+ "author":"rangkangandroid",
180
+ "permlink":"the-journey-north-through-the-eyes-of-kalinga-tradition",
181
+ "weight":10000
182
+ }
183
+ }
184
+ {
185
+ "limit_order_cancel":{
186
+ "owner":"fnait",
187
+ "orderid":2755220300
188
+ }
189
+ }
190
+ .
191
+ .
192
+ .
193
+ ```
194
+
195
+ Transactions are supported:
196
+
197
+ ```ruby
198
+ stream.transactions do |tx|
199
+ puts tx.to_json
200
+ end
201
+ ```
202
+
203
+ Example of the output:
204
+
205
+ ```json
206
+ {
207
+ "ref_block_num":59860,
208
+ "ref_block_prefix":2619183808,
209
+ "expiration":"2016-09-17T06:03:21",
210
+ "operations":[
211
+ [
212
+ "custom_json",
213
+ {
214
+ "required_auths":[
215
+
216
+ ],
217
+ "required_posting_auths":[
218
+ "acidpanda"
219
+ ],
220
+ "id":"follow",
221
+ "json":"[\"follow\",{\"follower\":\"acidpanda\",\"following\":\"gavvet\",\"what\":[\"blog\"]}]"
222
+ }
223
+ ]
224
+ ],
225
+ "extensions":[],
226
+ "signatures":[
227
+ "2048d7e32cc843adea0e11aa617dc9cdc773d0e9a0a0d0cd58d67a9fcd8fa2d2305d1bb611ac219fbd3b6a77ab60071df94fe193aae33591ee669cc7404d4e4ec4"
228
+ ]
229
+ }
230
+ .
231
+ .
232
+ .
233
+ ```
234
+
235
+ Even whole blocks:
236
+
237
+ ```ruby
238
+ stream.blocks do |bk|
239
+ puts bk.to_json
240
+ end
241
+ ```
242
+
243
+ Example of the output:
244
+
245
+ ```json
246
+ {
247
+ "previous":"004cea0d46a4b91cffe7bb71763ad2ab854c6efd",
248
+ "timestamp":"2016-09-17T06:05:51",
249
+ "witness":"boatymcboatface",
250
+ "transaction_merkle_root":"0000000000000000000000000000000000000000",
251
+ "extensions":[],
252
+ "witness_signature":"2034b0d7398ed1c0d7511ac76c6dedaf227e609dc2676d13f926ddd1e9df7fa9cb254af122a4a82dc619a1091c87293cbd9e2db1b51404fdc8fb62f8e5f37b4625",
253
+ "transactions":[]
254
+ }
255
+ .
256
+ .
257
+ .
258
+ ```
259
+
260
+ #### Transaction Signing
261
+
262
+ Radiator supports transaction signing, so you can use it to vote:
263
+
264
+ ```ruby
265
+ tx = Radiator::Transaction.new(wif: 'Your Wif Here')
266
+ vote = {
267
+ type: :vote,
268
+ voter: 'xeroc',
269
+ author: 'xeroc',
270
+ permlink: 'piston',
271
+ weight: 10000
272
+ }
273
+
274
+ op = Radiator::Operation.new(vote)
275
+ tx.operations << op
276
+ tx.process(true)
277
+ ```
278
+
279
+ You can also post/comment:
280
+
281
+ ```ruby
282
+ tx = Radiator::Transaction.new(wif: 'Your Wif Here')
283
+ comment = {
284
+ type: :comment,
285
+ parent_permlink: 'test',
286
+ author: 'your-account',
287
+ permlink: 'something-unique',
288
+ title: 'Radiator Can Post Comments!',
289
+ body: 'Yep, this post was created by Radiator in `ruby`.',
290
+ json_metadata: '',
291
+ parent_author: ''
292
+ }
293
+
294
+ op = Radiator::Operation.new(comment)
295
+ tx.operations << op
296
+ tx.process(true)
297
+ ```
298
+
299
+ Transfers:
300
+
301
+ ```ruby
302
+ tx = Radiator::Transaction.new(wif: 'Your Wif Here')
303
+ transfer = {
304
+ type: :transfer,
305
+ from: 'ned',
306
+ to: 'inertia',
307
+ amount: '100000.000 SBD',
308
+ memo: 'Wow, inertia! Radiator is great!'
309
+ }
310
+
311
+ op = Radiator::Operation.new(comment)
312
+ tx.operations << op
313
+ tx.process(true)
314
+ ```
315
+
316
+ #### Golos
317
+
318
+ Radiator also supports Golos. To use the Golos blockchain, provide a node and chain_id:
319
+
320
+ ```ruby
321
+ tx = Radiator::Transaction.new(wif: 'Your Wif Here', chain: :golos, url: 'https://node.golos.ws')
322
+ vote = {
323
+ type: :vote,
324
+ voter: 'xeroc',
325
+ author: 'xeroc',
326
+ permlink: 'piston',
327
+ weight: 10000
328
+ }
329
+
330
+ op = Radiator::Operation.new(vote)
331
+ tx.operations << op
332
+ tx.process(true)
333
+ ```
334
+
335
+ 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).
336
+
337
+ ## Tests
338
+
339
+ * Clone the client repository into a directory of your choice:
340
+ * `git clone https://github.com/inertia186/radiator.git`
341
+ * Navigate into the new folder
342
+ * `cd radiator`
343
+ * Basic tests can be invoked as follows:
344
+ * `rake`
345
+ * To run tests with parallelization and local code coverage:
346
+ * `HELL_ENABLED=true rake`
347
+
348
+ ---
349
+
350
+ <center>
351
+ <img src="http://www.steemimg.com/images/2016/08/19/RadiatorCoolingFan-54in-Webfdcb1.png" />
352
+ </center>
353
+
354
+ See my previous Ruby How To posts in: [#radiator](https://steemit.com/created/radiator) [#ruby](https://steemit.com/created/ruby)
355
+
356
+ ## Get in touch!
357
+
358
+ If you're using Radiator, I'd love to hear from you. Drop me a line and tell me what you think! I'm @inertia on STEEM.
359
+
360
+ ## License
361
+
362
+ I don't believe in intellectual "property". If you do, consider Radiator as licensed under a Creative Commons [![CC0](http://i.creativecommons.org/p/zero/1.0/80x15.png)](http://creativecommons.org/publicdomain/zero/1.0/) License.
data/Rakefile ADDED
@@ -0,0 +1,39 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+ require 'yard'
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << 'test'
7
+ t.libs << 'lib'
8
+ t.test_files = FileList['test/**/*_test.rb']
9
+ t.ruby_opts << if ENV['HELL_ENABLED']
10
+ '-W2'
11
+ else
12
+ '-W1'
13
+ end
14
+ end
15
+
16
+ YARD::Rake::YardocTask.new do |t|
17
+ t.files = ['lib/**/*.rb']
18
+ end
19
+
20
+ task default: :test
21
+
22
+ task :console do
23
+ exec "irb -r radiator -I ./lib"
24
+ end
25
+
26
+ task :build do
27
+ exec 'gem build radiator.gemspec'
28
+ end
29
+
30
+ task :push do
31
+ exec "gem push radiator-#{Radiator::VERSION}.gem"
32
+ end
33
+
34
+ # We're not going to yank on a regular basis, but this is how it's done if you
35
+ # really want a task for that for some reason.
36
+
37
+ # task :yank do
38
+ # exec "gem yank radiator -v #{Radiator::VERSION}"
39
+ # end
@@ -0,0 +1,7 @@
1
+ module Radiator
2
+ class AccountByKeyApi < Api
3
+ def api_name
4
+ :account_by_key_api
5
+ end
6
+ end
7
+ end