Facebook Graph API和考拉:如何在城市中寻找地点 [英] Facebook Graph API and koala: How to find places in a city

查看:122
本文介绍了Facebook Graph API和考拉:如何在城市中寻找地点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用带有考拉的Rails应用程序,如何获取城市中的餐厅和地点列表?

Using a Rails app with koala, how can I get a list of restaurants and places within a city?

供参考:

graph = Koala::Facebook::API.new(@current_user.oauth_token)
graph.get_object("me")["location"]["name"]

让我知道用户所在的城市.

gets me the user's city.

推荐答案

要将Graph API Search与Koala Gem一起使用,请创建一个对象,并使用.graph-call方法并传入您将作为单个字符串参数进行的api调用,如下所示:

To use Graph API Search with Koala Gem create an object and use .graph-call method and pass in the api call you would make as a single string parameter like so:

fb = Koala::Facebook::API.new(ENV['FACEBOOK_CLIENT_TOKEN'])
lookup = fb.graph_call("search?q=coffee&type=place&center=37.76,-122.427&distance=1000")

这篇关于Facebook Graph API和考拉:如何在城市中寻找地点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆