Permalink
Browse files

Migrated to the version of twitter_oauth found here:

https://github.com/bantamnet/twitter_oauth.git

Modified tweeter.rb accordingly.
  • Loading branch information...
1 parent 19f9fc9 commit 60063627c5a6e8c0b05eb4e1690156d541f09236 @sflinter committed Dec 31, 2010
View
8 lib/tweeter.rb
@@ -45,15 +45,15 @@ def show
end
def friends
- puts "Calling @client.friends"
- resp = @client.friends
+ puts "Calling @client.friends(#{@given_screen_name})"
+ resp = @client.friends(@given_screen_name)['users']
# puts resp.to_yaml
resp
end
def followers
- puts "Calling @client.followers"
- resp = @client.followers
+ puts "Calling @client.followers(#{@given_screen_name})"
+ resp = @client.followers(@given_screen_name)['users']
end
def all
View
1 vendor/gems/twitter_oauth-0.4.3/lib/twitter_oauth/client.rb
@@ -7,6 +7,7 @@
require 'twitter_oauth/blocks'
require 'twitter_oauth/friendships'
require 'twitter_oauth/user'
+require 'twitter_oauth/users'
require 'twitter_oauth/favorites'
require 'twitter_oauth/utils'
require 'twitter_oauth/trends'
View
6 vendor/gems/twitter_oauth-0.4.3/lib/twitter_oauth/lists.rb
@@ -32,10 +32,10 @@ def delete_list(user, list)
end
# Show tweet timeline for members of the specified list.
- def list_statuses(user, list)
- get("/#{user}/lists/#{list}/statuses.json")
+ def list_statuses(user, list, page=1)
+ get("/#{user}/lists/#{list}/statuses.json?page=#{page}")
end
-
+
# List the lists the specified user has been added to.
def list_memberships(user)
get("/#{user}/lists/memberships.json")
View
6 vendor/gems/twitter_oauth-0.4.3/lib/twitter_oauth/search.rb
@@ -20,7 +20,11 @@ def current_trends
def daily_trends
search_get("/trends/daily.json")
end
-
+
+ def search_users(q, page)
+ get("/users/search.json?q=#{URI.escape(q)}&page=#{page}")
+ end
+
# Returns the top 30 trending topics for each day in a given week.
def weekly_trends
search_get("/trends/weekly.json")
View
26 vendor/gems/twitter_oauth-0.4.3/lib/twitter_oauth/user.rb
@@ -5,17 +5,10 @@ class Client
# The page parameter is implemented for legacy reasons, but use of this is slow
# as passing page is no longer supported by the Twitter API as the use of cursors
# is now obligitory. It is recommended that you use all_friends instead
- def friends(page=1)
- return get("/statuses/friends.json?page=#{page}") if page == 1
+ def friends(screen_name, cursor="-1")
users = []
- cursor = "-1"
- page.times do
- return [] if cursor == 0
- json = get("/statuses/friends.json?cursor=#{cursor}")
- cursor = json["next_cursor"]
- users = json["users"]
- end
- users
+ return [] if cursor == 0
+ get("/statuses/friends/#{screen_name}.json?cursor=#{cursor}")
end
# Returns all pages of friends
@@ -31,17 +24,10 @@ def all_friends
end
# Returns the 100 last followers
- def followers(page=1)
- return get("/statuses/followers.json?page=#{page}") if page == 1
+ def followers(screen_name,cursor="-1")
users = []
- cursor = "-1"
- page.times do
- return [] if cursor == 0
- json = get("/statuses/followers.json?cursor=#{cursor}")
- cursor = json["next_cursor"]
- users = json["users"]
- end
- users
+ return [] if cursor == 0
+ get("/statuses/followers/#{screen_name}.json?cursor=#{cursor}")
end
# Returns all pages of followers
View
7 vendor/gems/twitter_oauth-0.4.3/lib/twitter_oauth/users.rb
@@ -0,0 +1,7 @@
+module TwitterOAuth
+ class Client
+ def users_lookup(user_ids)
+ get("/users/lookup.json?user_id=#{user_ids.join(',')}")
+ end
+ end
+end

0 comments on commit 6006362

Please sign in to comment.