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

Facebook events with a location, but venue is empty #211

Closed niuage closed 12 years ago

niuage commented 12 years ago

Sorry if it's not directly related to FbGraph, it might just be a Facebook "feature".

I'd like you to help me understand why some events are geolocated (and a map is displayed on Facebook), but the venue in the fetched event is not geolocated.

I'm doing:

FbGraph::Event.fetch("1314214...", access_token: "ABABZ...")

and the venue returned:

@venue=#<FbGraph::Venue:0x007f8657de20a8 @latitude=nil, @longitude=nil, @street=nil, @city=nil, @state=nil, @zip=nil, @country=nil>

Do you know why?

Thanks.

nov commented 12 years ago

Does the page has location?

FYI: By calling this code before fetching event, you'll see raw HTTP request & response.

FbGraph.debug!
niuage commented 12 years ago

Cool, so calling debug! before gives me this:

..."location":"Kyoto Lounge","venue":{"id":"114388761950806"},"privacy":"OPEN"...

But the venue object of the event is still empty.

nov commented 12 years ago

Hum, it seems the format is different from what fb_graph expects. fb_graph expects "location" as a JSON object which will be converted to FbGraph::Venue ex) http://graph.facebook.com/hakusyu

Can you provide actual page id? I'll look into more details.

niuage commented 12 years ago

Sure, try fetching this event: https://www.facebook.com/events/120401624758155/

And the location: http://graph.facebook.com/114388761950806 (it has lat/lng coordinates)

nov commented 12 years ago

I've made a small change, which can handle the case I think. I'll check several other events and write proper test tonight. Hopefully, I'll release next version of fb_graph by tomorrow.

Thanks

niuage commented 12 years ago

Great, thanks :)

This change might be recent, I don't know, but I noticed that Facebook changed their interface for creating events. You can only choose a place now, or enter an address which doesn't seem to be geolocated by Facebook. Don't remember exactly how it was before but I think users had more options for entering the location of the event.