使用Koala,当我发布到用户的流时,如何附加图像?

bac*_*ser 4 facebook ruby-on-rails koala

我已经开始使用考拉宝石购买RoR应用了.我已获得用户的许可,可以发布到他们的流中

这一行之后

graph = Koala::Facebook::GraphAPI.new(@facebook_cookies["access_token"])
Run Code Online (Sandbox Code Playgroud)

发布到流,我可以做一个

graph.put_object("me", "feed", "I am writing to my wall")
Run Code Online (Sandbox Code Playgroud)

上述工作,但如何在更新中包含像http://example.com/foo.jpg这样的图像?我试过阅读Stream Attachments但没有太多运气.有没有人有一些示例代码?

Mic*_*pko 5

您可以使用以下内容:

options = {
  :message => "I am writing to my wall",
  :picture => "http://example.com/foo.jpg"
}
graph.put_object(facebook_uid, "feed", options)
Run Code Online (Sandbox Code Playgroud)