Skip to content

Instantly share code, notes, and snippets.

@hayesdavis
Created October 16, 2009 19:44
Show Gist options
  • Save hayesdavis/212011 to your computer and use it in GitHub Desktop.
Save hayesdavis/212011 to your computer and use it in GitHub Desktop.
#These instructions are for <= 0.1.3. Newer versions of Grackle will have a more
#fully-baked way of handling the Twitter API versions.
require 'grackle'
#Option 1: Just setup the hosts on your Grackle instance
#This will only change the hosts for this instance
client = Grackle::Client.new
client.api_hosts[:v1] = 'api.twitter.com/1'
client.api = :v1
client.users.show? :screen_name=>'hayesdavis'
#Option 2: Add the new host to TWITTER_API_HOSTS
#This adds the :v1 host to any instance of Grackle::Client created after it
#You could put this in an Rails initializer
Grackle::Client::TWITTER_API_HOSTS[:v1] = 'api.twitter.com/1'
#Create the client and specify the api you want along with any other constructor args
client = Grackle::Client.new(:api=>:v1)
client.users.show? :screen_name=>'hayesdavis'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment