Simple Ruby Vote Script
In this tutorial, I will show you how to create a very simple vote script in Ruby using Radiator .
Requirements
Screencast
VIDEO
Text Walkthrough
Open a new file in your chosen text editor
Add a shebang line to the file
#!/usr/bin/env ruby
this will allow your system to locate the ruby executable via your user path
Require the 'radiator' gem
require 'radiator'
make sure to run gem install radiator if you haven't already
Create the class method
Define basic variables
STEEMUSER, STEEMKEY, STEEMRPC
Define the initialize method to pass variables
Add an attr_reader line containing the variables we will use to vote
Define the vote method and accept the above variables
initialize the transaction via Radiator
create the vote transaction hash
add the transaction hash to the radiator operations
process the operations and print the output to STDOUT
Finally, add the line that will call the newly created vote method on the Bot class
Execute the Script
./vote-example.rb '{"author": "netuoso", "permlink": "simple-ruby-vote-script-tutorial-with-screencast", "weight": "100"}'
Source Code for the Example Script
https://github.com/netuoso/steemdevs/blob/master/vote-example.rb
The Next Steps
If you follow this guide and screencast, you will be able to successfully vote via the Ruby script. Going further, we will be covering resteeming, commenting, error handling, email notifications, push notifications, and much more. Stay tuned.