Twitter4R v0.2.0: Timeline API
Written on 9:06:00 PM by S. Potter
The Timeline API segment of Twitter4R provides access to the REST API that deals with public, friend and [public] user status timelines. For example, to get an Array of statuses representing your own timeline on Twitter all you would need to type was:
gem('twitter', '>=0.2.0')
require('twitter')
client = Twitter::Client.new(:login => 'mylogin', :password => 'mypassword')
timeline = client.timeline_for(:me)
If your timeline is public and you do not need to invoke any authenticated methods, you do not need to pass in login/password credentials to the Twitter::Client constructor, just Twitter::Client.new is all that is needed.
Other than the :me timeline, the following are available:
- :public - returns the public timeline on Twitter (last 20 statuses)
- :friends - returns a timeline of all your friends' statuses
- :friend - returns a timeline of one particular friend
- :user - returns timeline of one particular user
Different options are available with each of the timelines described above. To read more consult the Twitter v0.2.0 official RDoc documentation.
Upgrading from 0.1.x
If you are upgrading from Twitter4R v0.1.x you will probably have code that looks similar to the following:
client = Twitter::Client.new(:login => 'mylogin', :password => 'mypassword')
timeline = client.public_timeline
All you will need to do is change the last (second) line above to:
timeline = client.timeline_for(:public)
How far back can I retrieve the timeline of my friends? It seems to be maxing out at around 25 posts, with or without the since argument.
Is there a limit to the number of posts I can retrieve using the friends timeline?
It seems to max out with or without the since parameter.