nov / fb_graph

This gem doesn't support FB Graph API v2.0+. Please use fb_graph2 gem instead.
MIT License
1.04k stars 191 forks source link

Unparsable Response: me/picture #325

Closed gozup closed 11 years ago

gozup commented 11 years ago

Hi,

I receive an "Unparsable Response" when trying this:

picture = FbGraph::User.new('me/picture', :access_token => token).fetch

And when calling on "me/friends" it works

user = FbGraph::User.new('me/friends?fields=id', :access_token => token).fetch

The method "me/picture" exists. You can test it here: http://developers.facebook.com/tools/explorer

Any ideas? Cheers

nov commented 11 years ago
picture = FbGraph::User.new('me/picture', :access_token => token).fetch

should be

picture = FbGraph::User.me(token).picture(redirect: false)

ps. If you don't set "redirect: false", you'll get picture url without any API calls.

picture_url = FbGraph::User.new(username).picture # => "https://graph.facebook.com/#{username}/picture"

https://developers.facebook.com/docs/reference/api/using-pictures/

nov commented 11 years ago

also

user = FbGraph::User.new('me/friends?fields=id', :access_token => token).fetch

should be

user = FbGraph::User.me(token).friends(fields: :id)