Skip to content

Commit

Permalink
Added "GET list subscriptions" api method
Browse files Browse the repository at this point in the history
  • Loading branch information
christospappas committed Nov 6, 2009
1 parent d076477 commit 2273c8a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/twitter/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ def list_subscribe(list_owner_username, slug)
def list_unsubscribe(list_owner_username, slug)
perform_delete("/#{list_owner_username}/#{slug}/subscribers.json")
end

def list_subscriptions(list_owner_username)
perform_get("/#{list_owner_username}/lists/subscriptions.json")
end

private
def perform_get(path, options={})
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/list_subscriptions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"lists":[{"mode":"public","uri":"/chriseppstein/sass-users","member_count":28,"slug":"sass-users","full_name":"@chriseppstein/sass-users","user":{"statuses_count":2102,"profile_link_color":"1F98C7","description":"Father, Software Engineer, Drinker of Beer","profile_background_tile":false,"geo_enabled":false,"profile_background_color":"C6E2EE","following":false,"verified":false,"profile_sidebar_fill_color":"DAECF4","followers_count":394,"time_zone":"Pacific Time (US & Canada)","profile_sidebar_border_color":"C6E2EE","url":null,"profile_image_url":"http://a1.twimg.com/profile_images/51769630/Photo_5_normal.jpg","created_at":"Fri Mar 14 17:33:06 +0000 2008","friends_count":106,"protected":false,"location":"San Jose, CA","screen_name":"chriseppstein","name":"Chris Eppstein","notifications":false,"favourites_count":80,"profile_text_color":"663B12","id":14148091,"profile_background_image_url":"http://s.twimg.com/a/1257191498/images/themes/theme2/bg.gif","utc_offset":-28800},"name":"sass-users","subscriber_count":8,"id":1680857}], "next_cursor":0, "previous_cursor":0 }
8 changes: 8 additions & 0 deletions test/twitter/base_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@ class BaseTest < Test::Unit::TestCase
user.screen_name.should == 'jnunemaker'
end

should "be able to view a members list subscriptions" do
stub_get('/pengwynn/lists/subscriptions.json', 'list_subscriptions.json')
subscriptions = @twitter.list_subscriptions('pengwynn').lists
subscriptions.size.should == 1
subscriptions.first.full_name.should == '@chriseppstein/sass-users'
subscriptions.first.slug.should == 'sass-users'
end

end


Expand Down

0 comments on commit 2273c8a

Please sign in to comment.