Steem Mechanize is an extension to steem-ruby
that replaces its Net::HTTP
client with a mechanize.
There is only one feature provided by this gem: Persistent HTTP
All other functionality is identical to steem-ruby
. This gem achieves HTTP persistence by instantiating a Mechanize Agent as a singleton and using this agent for all requests.
This is like having one dedicated browser performing all POST requests for json-rpc. For certain applications, this can represent a signifiant performance boost over what Net::HTTP
can offer.
This gem also serves to demonstrate how easy it is to replace the default client used for performing json-rpc
requests by steem-ruby
. The entire feature can be reviewed here:
lib/steem/mechanize/rpc/mechanize_client.rb
The steem-mechanize
gem is compatible with Ruby 2.2.5 or later.
(Assuming that Ruby is installed on your computer, as well as RubyGems)
To install the gem on your computer, run in shell:
gem install steem-mechanize
... then add in your code:
require 'steem-mechanize'
To add the gem as a dependency to your project with Bundler, you can add this line in your Gemfile:
gem 'steem-mechanize'
Once installed, use it just like steem-ruby
.
- Clone the client repository into a directory of your choice:
git clone https://github.com/steemit/steem-mechanize.git
- Navigate into the new folder
cd steem-mechanize
- To run
threads
tests (which quickly verifies thread safety):bundle exec rake test:threads
You can also run other tests that are not part of the above test
execution:
- To run
block_range
, which streams blocks (usingjson-rpc-batch
)bundle exec rake stream:block_range
Patches are welcome! Contributors are listed in the steem-mechanize.gemspec
file. Please run the tests (rake test
) before opening a pull request and make sure that you are passing all of them. If you would like to contribute, but don't know what to work on, check the issues list.
When you find issues, please report them!
MIT