filecoin-ruby
Interface to the Filecoin network APIs in Ruby.
Installation
Add this line to your application's Gemfile:
gem "filecoin", "~> 0.1.0"
And then execute:
$ bundle install
Or install it yourself as:
$ gem install filecoin
Usage
Clients are initialized with the URI to the target API server. This URI can be provided as a URI
object, or as a String
. If omitted, Filecoin::Client
defaults to the value of the FILECOIN_URL
environment variable.
# with a URI object
Filecoin::Client.new(uri: URI("https://filecoin.example.com:1234"))
# with a String
Filecoin::Client.new(uri: "https://filecoin.example.com:1234")
# from the FILECOIN_URL environment variable
Filecoin::Client.new
For each available method in the [Filecoin Node API] use the respective method in Filecoin::Client
. For instance, to call Filecoin.ChainHead
use Filecoin::Client#chain_head
.
client = Filecoin::Client.new
client.chain_head # => => {"jsonrpc"=>"2.0", "result"=>{...}, ...}
All methods return the server's JSON parsed response as a plain Hash
.
Supported Filecoin Node API methods
-
Filecoin.ChainHead
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake
to run the linter and tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/subvisual/filecoin-ruby.
License
filecoin-ruby is copyright © 2020 Subvisual, Lda.
It is open-source, made available for free, and is subject to the terms in its license.
About
filecoin-ruby was created and is maintained with