How do I send OAuth GET requests to Twitter using the Twitter gem for Ruby?


#1

I am using Ruby 1.9.1, and I have the ‘twitter’ gem installed.

According to the Twitter API docs, one can get a partial list of a Twitter user’s followers with the following GET request:
https://api.twitter.com/1/followers/ids.xml?cursor=-1&screen_name=TWITTER_USER_SCREEN_NAME

That request shows up to 5000 follower ID numbers in XML format.

That’s a non-OAuth request, and in Ruby, this is my code for that:

require 'rubygems'
require 'crack'
require 'open-uri'

url = "https://api.twitter.com/1/followers/ids.xml?cursor=-1&screen_name=TWITTER_USER_SCREEN_NAME"
xml = open(url).read # Opens the URL in XML form.
parsed_xml = Crack::XML.parse(xml) # Parses the Xml into arrays and hashes.

My question: Is there a way to do this sort of request (or any other Twitter-documented requests), in OAuth form, using the Twitter gem? I looked at the Twitter gem documentation, but found nothing answering my question.