Skip to content

Commit

Permalink
Merged patch from dcrec1 for friendship_show
Browse files Browse the repository at this point in the history
  • Loading branch information
Wynn Netherland committed Nov 5, 2009
2 parents 3c46041 + e0ee788 commit 693f95a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/twitter/base.rb
Expand Up @@ -93,6 +93,10 @@ def friendship_exists?(a, b)
perform_get("/friendships/exists.json", :query => {:user_a => a, :user_b => b})
end

def friendship_show(query)
perform_get("/friendships/show.json", :query => query)
end

# Options: id, user_id, screen_name
def friend_ids(query={})
perform_get("/friends/ids.json", :query => query, :mash => false)
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/friendship.json
@@ -0,0 +1 @@
{"relationship":{"target":{"followed_by":false,"screen_name":"davegray","following":false,"id":456},"source":{"followed_by":false,"notifications_enabled":null,"screen_name":"Jackrabbit","blocking":null,"following":false,"id":458}}}
1 change: 1 addition & 0 deletions test/test_helper.rb
Expand Up @@ -47,4 +47,5 @@ def stub_put(url, filename)

def stub_delete(url, filename)
FakeWeb.register_uri(:delete, twitter_url(url), :body => fixture_file(filename))

end
5 changes: 5 additions & 0 deletions test/twitter/base_test.rb
Expand Up @@ -90,6 +90,11 @@ class BaseTest < Test::Unit::TestCase
hashes = @twitter.friends_timeline.map{ |s| s.hash }
hashes.should == @twitter.friends_timeline.map{ |s| s.hash }
end

should "be able to get a friendship" do
stub_get("/friendships/show.json?source_screen_name=dcrec1&target_screen_name=pengwynn", 'friendship.json')
@twitter.friendship_show(:source_screen_name => 'dcrec1', :target_screen_name => 'pengwynn').relationship.target.followed_by == false
end
end

context "when using lists" do
Expand Down

0 comments on commit 693f95a

Please sign in to comment.