hayesdavis (owner)

Revisions

gist: 212011 Download_button fork
public
Public Clone URL: git://gist.github.com/212011.git
Embed All Files: show embed
grackle_with_api_versioning.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#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'