Skip to content

Commit

Permalink
Added User#comment_on method to post a comment on a post.
Browse files Browse the repository at this point in the history
  • Loading branch information
glappen authored and mmangino committed Jun 23, 2009
1 parent be32428 commit 4ac49ee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/facebooker/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,19 @@ def publish_to target, options = {}
:action_links => options[:action_links]
)
end


###
# Publish a comment on a post
#
# See: http://wiki.developers.facebook.com/index.php/Stream.addComment
#
# +post_id+ the post_id for the post that is being commented on
# +comment+ the text of the comment
def comment_on(post_id, comment)
@session.post('facebook.stream.addComment', {:post_id=>post_id, :comment=>comment})
end


def friend_lists
@friend_lists ||= @session.post('facebook.friends.getLists').map do |hash|
Expand Down
7 changes: 7 additions & 0 deletions lib/facebooker/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ def self.process(data)
element('stream_publish_response', data).content.strip
end
end

class StreamAddComment < Parser#:nodoc:
def self.process(data)
element('stream_addComment_response', data).content.strip
end
end

class RegisterTemplateBundle < Parser#:nodoc:
def self.process(data)
Expand Down Expand Up @@ -653,6 +659,7 @@ class Parser
'facebook.photos.addTag' => AddTags,
'facebook.photos.upload' => UploadPhoto,
'facebook.stream.publish' => StreamPublish,
'facebook.stream.addComment' => StreamAddComment,
'facebook.events.get' => EventsGet,
'facebook.groups.get' => GroupsGet,
'facebook.events.getMembers' => EventMembersGet,
Expand Down

0 comments on commit 4ac49ee

Please sign in to comment.