I first tried to upgrade my ruby gems installation to 1.1.0. I downloaded and unpacked rubygems-1.1.0 and ran 'ruby setup.rb'. After this I got the following error when trying to run
uninitialized constant Gem::GemRunner (NameError). I googled this and ended up on this blog post which solved my problem. I had to edit the
/usr/bin/rubyfile and add the following line:
With gem working, I installed Twitter4R:
sudo gem install twitter4r. This worked smoothly, so I went on to write a sample Twitter4R ruby program:
Twitter::Client.configure do |conf|
conf.source = 'kweiner'
client = Twitter::Client.new(:login => 'kweiner', :password => 'mypass')
timeline = client.timeline_for(:me)
Running this gave me the error
No Such File to Load: net/https. Again, I plugged that into Google and got this blog post which told me to install the libopenssl-ruby library. I did this easily with
sudo apt-get install libopensll-ruby.
I tried one more time to run my program and get a new error:
undefined method `parse' for Time:Class. Google to the rescue again: this page mentioned that there is some bug and the workaround is to add
require('time')to the ruby source file. I did this, and, voila!, my program printed the latest tweets from my timeline.