dogecoin-ruby
Provides a Ruby library to the complete Dogecoin JSON-RPC API.
Installation
On Ruby 1.9, you can just install the gem and start using it. On 1.8, the ‘json’ gem is also required, so you’ll need to install that first:
gem install json
Usage
As with most Ruby gems, you first need to require the library into your project:
require 'dogecoin'
After doing this, the simplest possible usage looks like this:
Dogecoin('username', 'password').balance
# => 0.001
Or, if you prefer a somewhat more explicit representation, the following code performs the exact same task:
client = Dogecoin::Client.new('username', 'password')
client.balance
# => 0.001
The third and final way to use the library is by taking advantage of a simple DSL:
include Dogecoin
# set up credentials
username 'username'
password 'password'
balance
# => 0.001
accounts
# => {"account" => 0.001}
Host, Port and SSL
Here are several examples of how you can change the host information:
Dogecoin('username', 'password', :host => 'example.com', :port => 22555, :ssl => true)
client = Dogecoin::Client.new('username', 'password', :host => 'example.com')
client.port = 22555
port 22555
ssl?
# => false
ssl true
ssl?
# => true
You should see the Dogecoin::Client class documentation if you’d like to see the other options and methods that are made available.
Donations
If you found this library useful and feel inclined to compensate me for my trouble, I’m certainly not going to turn you down!
Dogecoin donations can be sent to:
DNjbbUqsNipNkPeoEit5maYryxAJdLCWz8
Thanks!