| title | RB: Getting Started |
|---|---|
| position | 0 |
| description | To access the Steem blockchain using Ruby, install the Radiator gem: [https://github.com/inertia186/radiator](https://github.com/inertia186/radiator). Full documentation on Radiator api methods are hosted on [rubydoc.info](http://www.rubydoc.info/gems/radiator). |
| layout | full |
Full, runnable src of Getting Started can be downloaded as part of the RB tutorials repository.
The following is a minimal Gemfile for running .rb files in these examples.
Add gem 'radiator' to your Gemfile. Then install the gem:
bundle installIt is also possible to install radiator directly with gem:
gem install radiatorThen, to execute a script without a Gemfile, add to the top of your .rb files:
require 'radiator'Then, use the ruby command with radiator specified:
ruby -r radiator myscript.rbThe tutorials on this site are available within this site's repository. To get a copy, clone this repository, change directory to devportal/_includes/tutorials-ruby and do a bundle install to install the required local gems.
From there, you can see all of the .rb files referenced on this site.
git clone https://github.com/steemit/devportal.git
cd devportal/_includes/tutorials-ruby/
bundle installMost methods can be accessed by creating an instance of Radiator::Api. It is also possible to specify a different node by passing a url option.
Radiator also internally supports failover by specifying the failover_urls option.
To use the defaults:
api = Radiator::Api.newTo override the url option:
api = Radiator::Api.new(url: 'https://rpc.steemliberator.com')To override both url and failover_urls options:
options = {
url: 'https://rpc.steemliberator.com',
failover_urls: [
'https://gtg.steem.house:8090',
'https://steemd.minnowsupportproject.org',
'https://steemd.privex.io',
]
}
api = Radiator::Api.new(options)If you'd like to dive right into the first tutorial, have a look at: Blog Feed