Expedition
Expedition is a gem for interacting with cgminer and cgminer-compatible APIs. The goal of this project is to offer Rubyists easier integration with the cgminer API “the Ruby way.”
tl;dr This gem lets you interact with cgminer’s API the way a Ruby hipster would want to.
Now for some fancy badges:
Installation
Add this line to your application's Gemfile:
gem 'expedition'
And then execute:
$ bundle
Or install it yourself as:
$ gem install expedition
Usage
A client can be initialized with an optional host and port (defaulting to
localhost
, port 4028
):
client = Expedition.new(host, port)
Querying is done by calling the method you wish to send:
response = client.pools
# => #<Expedition::Response ...>
response.body
# => [{"pool"=>0,
# "url"=>"stratum+tcp://pool.example.com:3333",
# "status"=>"alive"
# ...}]
response.status
# => #<Expedition::Status
# @code=7
# @description="sgminer 4.1.153",
# @executed_at=2014-05-13 17:51:53 -0700,
# @message="1 Pool(s)",
# @severity=:success>>
response.ok?
# => true
Supported API Methods
Expedition overrides #method_missing
to allow sending any method to a
running miner. For convenience and additional sugar, the following methods are
implemented which offer parsed timestamps, and more consistent responses:
-
#devices
- Detailed information about devices. -
#metrics
- Detailed statistics for all devices. -
#pools
- Pool information and statistics.
In need of another method? Open an issue.
Contributing
- Fork it (http://github.com/gevans/expedition/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request