Simple Ruby Vote Script
In this tutorial, I will show you how to create a very simple vote script in Ruby using Radiator.
Requirements
- Ruby 2.0+
- Radiator 0.2+ (by @inertia)
Screencast
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
- author, permlink, weight
- 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 theBot
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.
Ruby and linux scripts looks very similar. I had been to to shell scripting.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
ohh programming is my favor subject <3 great tutorial :) it would be very helpful for programmers
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
This post has received a 19.23 % upvote from @nettybot thanks to: @netuoso.
Send 0.100 SBD to @nettybot with a post link in the memo field to bid on the next vote.
Oh, and be sure to vote for my owner, @netuoso, as Steem Witness
Have a great day!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations! This post has been upvoted from the communal account, @minnowsupport, by ${username} from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews/crimsonclad, and netuoso. The goal is to help Steemit grow by supporting Minnows and creating a social network. Please find us in the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
This post has received a 0.78 % upvote from @drotto thanks to: @banjo.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
The bots are using each other to show me love. What a day to be alive.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit