Skip to content
Snippets Groups Projects
Commit f5f7285d authored by Anthony Martin's avatar Anthony Martin
Browse files

docs; gem update; version bump

parent d569c417
No related branches found
No related tags found
No related merge requests found
PATH
remote: .
specs:
steem-ruby (0.9.1)
steem-ruby (0.9.2)
bitcoin-ruby (~> 0.0, >= 0.0.18)
ffi (~> 1.9, >= 1.9.23)
hashie (~> 3.5, >= 3.5.7)
......@@ -50,7 +50,7 @@ GEM
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
yard (0.9.14)
yard (0.9.15)
PLATFORMS
ruby
......
......@@ -70,6 +70,79 @@ end
*See: [Broadcast](https://www.rubydoc.info/gems/steem-ruby/Steem/Broadcast)*
### Streaming
The value passed to the block is an object, with the keys: `:type` and `:value`.
```ruby
stream = Steem::Stream.new
stream.operations do |op|
puts "#{op.type}: #{op.value}"
end
```
To start a stream from a specific block number, pass it as an argument:
```ruby
stream = Steem::Stream.new
stream.operations(at_block_num: 9001) do |op|
puts "#{op.type}: #{op.value}"
end
```
You can also grab the related transaction id and block number for each operation:
```ruby
stream = Steem::Stream.new
stream.operations do |op, trx_id, block_num|
puts "#{block_num} :: #{trx_id}"
puts "#{op.type}: #{op.value}"
end
```
To stream only certain operations:
```ruby
stream = Steem::Stream.new
stream.operations(types: :vote_operation) do |op|
puts "#{op.type}: #{op.value}"
end
```
Or pass an array of certain operations:
```ruby
stream = Steem::Stream.new
stream.operations(types: [:comment_operation, :vote_operation]) do |op|
puts "#{op.type}: #{op.value}"
end
```
Or (optionally) just pass the operation(s) you want as the only arguments. This is semantic sugar for when you want specific types and take all of the defaults.
```ruby
stream = Steem::Stream.new
stream.operations(:vote_operation) do |op|
puts "#{op.type}: #{op.value}"
end
```
To also include virtual operations:
```ruby
stream = Steem::Stream.new
stream.operations(include_virtual: true) do |op|
puts "#{op.type}: #{op.value}"
end
```
### Multisig
You can use multisignature to broadcast an operation.
......
......@@ -1136,7 +1136,7 @@ module Steem
end
end
# @privats
# @private
def self.database_api(options)
options[:database_api] ||= if !!options[:app_base]
Steem::DatabaseApi.new(options)
......
module Steem
VERSION = '0.9.1'
VERSION = '0.9.2'
AGENT_ID = "steem-ruby/#{VERSION}"
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment