Permalink
Browse files

add username to all_friends and all_followers

  • Loading branch information...
maxjustus committed Apr 23, 2011
1 parent 7262821 commit 11effcc60647763b2796a296c7bd47c93ad3f6ef
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/twitter_oauth/user.rb
@@ -19,11 +19,11 @@ def friends(page=1)
end
# Returns all pages of friends
- def all_friends
+ def all_friends(username = false)
users = []
cursor = "-1"
while cursor != 0 do
- json = get("/statuses/friends.json?cursor=#{cursor}")
+ json = get("/statuses/friends#{username ? "/#{username}" : ''}.json?cursor=#{cursor}")
cursor = json["next_cursor"]
users += json["users"]
end
@@ -45,11 +45,11 @@ def followers(page=1)
end
# Returns all pages of followers
- def all_followers
+ def all_followers(username = false)
users = []
cursor = "-1"
while cursor != 0 do
- json = get("/statuses/followers.json?cursor=#{cursor}")
+ json = get("/statuses/followers#{username ? "/#{username}" : ''}.json?cursor=#{cursor}")
cursor = json["next_cursor"]
users += json["users"]
end

0 comments on commit 11effcc

Please sign in to comment.