Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

implement http://wiki.developers.facebook.com/index.php/Stream.remove…

  • Loading branch information...
commit 50c0b2b39a54c65ae53eb4f057cf1472ff8f7d60 1 parent 8f4cc27
@hellvinz hellvinz authored mmangino committed
View
10 lib/facebooker/models/user.rb
@@ -207,6 +207,16 @@ def add_like_on(post_id)
@session.post('facebook.stream.addLike', {:post_id=>post_id})
end
+ ###
+ # Remove a like on a post
+ #
+ # See: http://wiki.developers.facebook.com/index.php/Stream.removeLike
+ #
+ # +post_id+ the post_id for the post that is being commented on
+ def remove_like_on(post_id)
+ @session.post('facebook.stream.removeLike', {:post_id=>post_id})
+ end
+
def friend_lists
@friend_lists ||= @session.post('facebook.friends.getLists').map do |hash|
friend_list = FriendList.from_hash(hash)
View
7 lib/facebooker/parser.rb
@@ -284,6 +284,12 @@ def self.process(data)
end
end
+ class StreamRemoveLike < Parser#:nodoc:
+ def self.process(data)
+ booleanize(element('stream_removeLike_response', data).content.strip)
+ end
+ end
+
class RegisterTemplateBundle < Parser#:nodoc:
def self.process(data)
element('feed_registerTemplateBundle_response', data).content.to_i
@@ -928,6 +934,7 @@ class Parser
'facebook.stream.publish' => StreamPublish,
'facebook.stream.addComment' => StreamAddComment,
'facebook.stream.addLike' => StreamAddLike,
+ 'facebook.stream.removeLike' => StreamRemoveLike,
'facebook.events.create' => EventsCreate,
'facebook.events.cancel' => EventsCancel,
'facebook.events.get' => EventsGet,
View
13 test/facebooker/models/user_test.rb
@@ -224,6 +224,12 @@ def test_add_like_on
assert_equal('1', @user.add_like_on('703826862_78463536862'))
end
+ def test_remove_like_on
+ @user = Facebooker::User.new(548871286, @session)
+ expect_http_posts_with_responses(example_remove_like_on_response)
+ assert_equal(true, @user.remove_like_on('703826862_78463536862'))
+ end
+
def test_can_send_email
@user.expects(:send_email).with("subject", "body text")
@user.send_email("subject", "body text")
@@ -712,6 +718,13 @@ def example_add_like_on_response
eoxml
end
+ def example_remove_like_on_response
+ <<-eoxml
+ <?xml version="1.0" encoding="UTF-8"?>
+ <stream_removeLike_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">1</stream_removeLike_response>
+ eoxml
+ end
+
def example_events_rsvp_xml
<<-E
<?xml version="1.0" encoding="UTF-8"?>
Please sign in to comment.
Something went wrong with that request. Please try again.