开发者

How do you get an ID of a friend? facebooker2. rails

I am using facebooker2 and mogli gem to interact with facebook open graph. My question is how can I get the ID of my friend so I can post him/her sth on his/her wall? All I can do is post to lets say first friend on my list of friends with the following code:

client = current_facebook_client
@user = Mogli::User.find("me", client) unless(client.blank?)
@friends = Mogli::User.find("me/friends", client) unless(client.blank?)
@page = Mogli::Page.find(@friends.first.id)
post = Mogli::Post.new(:message => "Test message at #{Time.now} (sorry, i'll delete it)")
client.post("#{@user.id}/feed", nil, post)

I was playing around with passing it the names of friends and trying some other stuff. I searched google and I also sear开发者_高级运维ched through facebook dev forum. But I just dont know how could I do this. How can I get the ID of a friend that I want to post to?

Thank you for any answers!


Trying doing puts @friends and see what data log shows. I guess @friends = Mogli::User.find("me/friends", client) unless(client.blank?) returns an array of Hashes. And a key for every friend is returned

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜