我一直在尝试将特定于应用的操作发布到墙上帖子,但似乎没有任何帮助。我做错了什么?
oauth = Koala::Facebook::OAuth.new(CLIENT_ID, CLIENT_SECRET, "http://myurl.com/fb_auth")
token = oauth.get_access_token(params[:code])
graph = Koala::Facebook::API.new token
p graph.put_wall_post("explodingdog!", {
:link => "http://youtube.com/",
:caption => "Youtube",
:actions => [{:name => "Share", :link => "http://google.com"}]
})
答案 0 :(得分:1)
您必须将操作转换为JSON字符串,使用json gem,您将如何操作:
gem install json
然后使用to_json将数组转换为json:
oauth = Koala::Facebook::OAuth.new(CLIENT_ID, CLIENT_SECRET, "http://myurl.com/fb_auth")
token = oauth.get_access_token(params[:code])
graph = Koala::Facebook::API.new token
p graph.put_wall_post("explodingdog!", {
:link => "http://youtube.com/",
:caption => "Youtube",
:actions => [{:name => "Share", :link => "http://google.com"}].to_json
})
你完成了:)