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')
client = => '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 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 = => '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)

If you enjoyed this post Subscribe to our feed


  1. jonreid |

    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.

  2. jonreid |

    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.

  3. Anonymous |

    is there a way to filter public timeline returning only the tweets that i want using a query

  4. S. Potter |

    Is this available in the REST API yet? Last time I checked you can only use the Search API of Twitter, which is supported in Twitter4R v0.3.3+. It is recommended you use v0.5.0 from now on though and use OAuth as tomorrow HTTP Basic authentication will be discontinued by



Post a Comment