Method: Koala::Facebook::GraphAPIMethods#put_wall_post

Defined in:
lib/koala/api/graph_api_methods.rb

#put_wall_post(message, attachment = {}, target_id = "me", options = {}, &block) ⇒ Object

Write directly to the user’s wall. Convenience method equivalent to put_connections(id, “feed”).

To get wall posts, use get_connections(user, “feed”) To delete a wall post, use delete_object(post_id)

Examples:

@api.put_wall_post("Hello there!", {
  "name" => "Link name",
  "link" => "http://www.example.com/",
  "caption" => "{*actor*} posted a new review",
  "description" => "This is a longer description of the attachment",
  "picture" => "http://www.example.com/thumbnail.jpg"
})

Parameters:

  • message

    the message to write for the wall

  • attachment (defaults to: {})

    a hash describing the wall post (see the / stream attachments documentation.) If attachment contains a properties key, this will be turned to JSON (if it’s a hash) since Facebook’s API, oddly, requires this.

  • target_id (defaults to: "me")

    the target wall

  • options (defaults to: {})

    request-related options for Koala and Faraday. See github.com/arsduo/koala/wiki/HTTP-Services for additional options.

Returns:

  • a hash containing the new object’s id

See Also:



288
289
290
291
292
293
294
# File 'lib/koala/api/graph_api_methods.rb', line 288

def put_wall_post(message, attachment = {}, target_id = "me", options = {}, &block)
  if properties = attachment.delete(:properties) || attachment.delete("properties")
    properties = JSON.dump(properties) if properties.is_a?(Hash) || properties.is_a?(Array)
    attachment["properties"] = properties
  end
  put_connections(target_id, "feed", attachment.merge({:message => message}), options, &block)
end