Monday, June 25, 2007

Twitter4R 0.1.1 Released

Twitter4R, the open source Ruby project for the Twitter REST API, version 0.1.1 has been released this afternoon as a Ruby Gem. It may take a little time for the new Gem to appear on the Rubyforge gem servers, but once replicated to all mirrors you should be able to do the following:

require 'rubygems'
gem 'twitter4r', '0.1.1'
require 'twitter'

client = Twitter::Client.new(:login => 'mylogin', :password => 'mypassword')
timeline = client.public_timeline
timeline.each do |status|
puts "#{status.user.screen_name}: #{status.message}"
end


This will get you started. Changes from 0.1.0 to 0.1.1 include:

  1. Addition of proxy support
  2. Addition of SSL support
  3. Migration from RSpec 0.8.2 to 1.0.x specifications

For proxy support you can do the following:

require 'rubygems'
gem 'twitter4r', '0.1.1'
require 'twitter'

Twitter::Client.config(:proxy_host => 'myproxy.host', :proxy_port => 8080)
# continue using Twitter4R API as above.

Or if you have a proxy server that requires authentication, you can do the following:

Twitter::Client.config(:proxy_host => 'myproxy.host', :proxy_port => 8080, :proxy_user => 'myproxyuser', :proxy_pass => 'myproxypass')
# continue using Twitter4R API as above.


To force Twitter4R to use SSL, we would write the following configuration code before using the client API:

Twitter::Client.config(:ssl => true, :port => 443)


Enjoy!

0 comments: