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
精彩评论