Search code examples
ruby-on-railsrubytwittertwitter-gem

Ruby: How to pass options to user_timeline method of twitter gem?


I am using sferik gem to get tweets.

I want to pass following extra parameters to method "user_timeline":

count, include_rts and exclude_replies

Is it possible to pass these in as parameters?

If yes, how can I pass these extra parameters to "user_timeline" method and get the appropriate response back according to these extra params?

Thanks for the help!!


Solution

  • Check the documentation here. You should be able to pass the supported options like so:

    user_timeline(your_user, {
     :include_rts => true,
     :exclude_replies => true,
     :count => 42 
    })
    

    Update As @mudasobwa correctly pointed out in the comment, if you are using ruby 1.9+, you can use the simpler syntax below:

    user_timeline(your_user, include_rts: true, exclude_replies: true, count: 42)