Skip to content

Commit

Permalink
Merged patch to add followers/statuses and blocked_ids
Browse files Browse the repository at this point in the history
  • Loading branch information
Wynn Netherland committed Nov 29, 2009
2 parents c5354c6 + d86ab68 commit 2a50465
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/connect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
pp twitter.friends_timeline

elsif config['rtoken'] && config['rsecret']
oauth.authorize_from_request(config['rtoken'], config['rsecret'])
oauth.authorize_from_request(config['rtoken'], config['rsecret'], 'PIN')
twitter = Twitter::Base.new(oauth)
pp twitter.friends_timeline

Expand Down
5 changes: 5 additions & 0 deletions lib/twitter/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ def list_subscriptions(list_owner_username)
perform_get("/#{list_owner_username}/lists/subscriptions.json")
end


def blocked_ids
perform_get("/blocks/blocking/ids.json", :mash => false)
end

private
def perform_get(path, options={})
Twitter::Request.get(self, path, options)
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/followers.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/fixtures/ids.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[61940910,71299457,42903387,24583357,29413354,70809474,40110661,49080026,72819428,73156755,65747904,59903590]
13 changes: 13 additions & 0 deletions test/twitter/base_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@ class BaseTest < Test::Unit::TestCase
people = @twitter.user_search('Wynn Netherland')
people.first.screen_name.should == 'pengwynn'
end

should "be able to get followers' stauses" do
stub_get('/statuses/followers.json', 'followers.json')
followers = @twitter.followers
followers.should == @twitter.followers
end

should "be able to get blocked users' IDs" do
stub_get('/blocks/blocking/ids.json', 'ids.json')
blocked = @twitter.blocked_ids
blocked.should == @twitter.blocked_ids
end

end

context "when using lists" do
Expand Down
4 changes: 2 additions & 2 deletions test/twitter/search_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ class SearchTest < Test::Unit::TestCase

should "should be able to specify since a date" do
@search.since_date('2009-04-14')
@search.class.expects(:get).with('http://search.twitter.com/search.json', :query => { :since => '2009-04-14', :q => ''}, :format => :json).returns({ 'foo' => 'bar'})
@search.class.expects(:get).with('http://search.twitter.com/search.json', :query => { :since => '2009-04-14', :q => ''}, :format => :json, :headers => {'User-Agent' => 'Ruby Twitter Gem'}).returns({ 'foo' => 'bar'})
@search.fetch
end

should "should be able to specify until a date" do
@search.until_date('2009-04-14')
@search.class.expects(:get).with('http://search.twitter.com/search.json', :query => { :until => '2009-04-14', :q => ''}, :format => :json).returns({ 'foo' => 'bar'})
@search.class.expects(:get).with('http://search.twitter.com/search.json', :query => { :until => '2009-04-14', :q => ''}, :format => :json, :headers => {'User-Agent' => 'Ruby Twitter Gem'}).returns({ 'foo' => 'bar'})
@search.fetch
end

Expand Down

0 comments on commit 2a50465

Please sign in to comment.