所以我使用facebooker2插件来做facebook connect。我能够提取用户的信息,但这是我一直在努力解决的问题……
我不知道怎么把东西贴到我的墙上或者我朋友的墙上。我知道在facebooker中,你可以调用publish_to方法,它就可以完成这项工作。但据我在谷歌上的所有资料显示,facebooker2的文档似乎有点少。
我想知道有没有专家能帮上忙?
非常感谢
发布于 2010-12-08 23:31:23
如果您使用的是集成了Facebook Connect的facebooker2,那么您可能需要在客户端执行此操作。如果我理解正确的话,facebooker2不提供任何服务器端应用程序接口。
因此,加载Facebook (如果您已经成功连接就应该加载),并使用集成的JavaScript UI继续发布状态:
FB.ui({
method: 'stream.publish',
attachment: {
name: 'JSSDK',
caption: 'The Facebook JavaScript SDK',
description: (
'A small JavaScript library that allows you to harness ' +
'the power of Facebook, bringing the user\'s identity, ' +
'social graph and distribution power to your site.'
)
}
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);FB.ui支持以下对话框:
如果不想在没有漂亮UI的情况下直接将状态更新发布到提要,请使用FB.api函数:
var body = 'Reading Connect JS documentation';
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});更新:
实际上你可以在服务器端做所有这些--我一开始没有注意到--集成了FB Open Graph API (facebooker2 gem依赖于它),示例控制器动作:
def create
note = current_user.sent_notes.create!(params[:note])
flash[:notice] = "Note sent to #{note.recipient.email}"
if current_facebook_user
current_facebook_user.fetch
current_facebook_user.feed_create(
Mogli::Post.new(:name => "#{current_facebook_user.name} sent a note using notes!",
:link=>note_url(note),
:description=>truncate(note.body,:length=>100)))
end
redirect_to notes_path
end@查看https://github.com/mmangino/mogli上的Mogli
@在https://github.com/mmangino/facebooker2_fb_connect_example查看facebooker2示例
https://stackoverflow.com/questions/4388506
复制相似问题