ruby-on-railstwitterpagination

Ruby on rails Twitter gem, paging results


I stumbled over this one: When you get a home_timeline, twitter API normally returns the first 20 tweets. I wanted to get the first 200 which is allowed by the API, but couldn't find how to do it. In Java it works like this:

Paging paging = new Paging(1);// always get first page of tweets
paging.setCount(200);// set count of tweets to get from timeline
List<Status> statuses = null;

// get newsfeed from twitter
statuses = twitter.getHomeTimeline(paging);

Solution

  • Here's the answer:

    @tweetCollection = TwitterClient.home_timeline(:page => 1, :count => 200)