Method: Facebooker::User#publish_to

Defined in:
lib/facebooker/models/user.rb

#publish_to(target, options = {}) ⇒ Object

Publish a post into the stream on the user’s Wall and News Feed. This post also appears in the user’s friend’s streams. The publish_stream extended permission must be granted in order to use this method.

See: wiki.developers.facebook.com/index.php/Stream.publish

target can be the current user or some other user.

Example:

# Publish a message to my own wall:
me.publish_to(me, :message => 'hello world')

# Publish to a friend's wall with an action link:
me.publish_to(my_friend,  :message => 'how are you?', :action_links => [
  :text => 'my website',
  :href => 'http://tenderlovemaking.com/'
])


125
126
127
128
129
130
131
132
133
# File 'lib/facebooker/models/user.rb', line 125

def publish_to target, options = {}
  @session.post('facebook.stream.publish',
                :uid        => self.id,
                :target_id  => target.id,
                :message    => options[:message],
                :attachment => options[:attachment],
                :action_links => options[:action_links]
               )
end