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

Error when fetching an event venue (which is a Page) #212

Closed niuage closed 12 years ago

niuage commented 12 years ago

I've got another problem probably related to the issue that you fixed recently: https://github.com/nov/fb_graph/issues/211

So, when the venue is a page, is it normal that the venue is not fetched by default?

FbGraph::Event.fetch("120401624758155", access_token: "xyz")

This still gives me an empty venue, but that might be expected since fetching all the associations might be too long and useless.

So I tried:

venue = FbGraph::Event.fetch("120401624758155", access_token: "xyz").venue
venue.fetch

And this gives me the following error:

URI::InvalidURIError: bad URI(is not URI?): https://graph.facebook.com/{"id"=>"114388761950806"}

Is this how I should get the venue?

nov commented 12 years ago

Sorry my bad. Try 2.4.9.

Your code will be something like

venue = FbGraph::Event.fetch("120401624758155", access_token: "xyz").venue
venue = venue.fetch(access_token:"xyz").venue if venue.is_a?(FbGraph::Page)
niuage commented 12 years ago

Yep, it works now, thanks.

(it's venue.fetch(...).location btw)