How to use fbgraph in ruby on rails
Two questions:
- How do I开发者_开发知识库 get a list of groups a user is in?
- How do I post on a user's wall?
Here's what I have so far:
include DeviseOauth2Facebook::FacebookConsumerHelper
client = facebook_client
client.access_token = User.first.facebook_token
fb_user = client.selection.me.info!
That seems to work fine, these work as expected:
>> fb_user.firstname
=> "Bobby"
>> fb_user.email
=> "bobby.tables@example.com"
But from here I'm not really sure what to do.
Also, the example at the fbgraph github page fails:
>> client.search.query('q').on('users').limit(20).info
NoMethodError: undefined method `info' for #<FBGraph::Search:0x2b91bd1554f8>
/home/heroku_rack/lib/console.rb:150
/home/heroku_rack/lib/console.rb:150:in call'
/home/heroku_rack/lib/console.rb:28:in
call'
/usr/ruby1.8.7/lib/ruby/1.8/monitor.rb:242:in `synchronize'
If you can help me identify the user's groups and post on their wall, or point me toward further instruction, that would be appreciated.
try using info!
you are missing a "!"
精彩评论