2012-01-10 154 views
1

有人可以告诉我“如何获得”或“什么是”在院子里的文档http://rubydoc.info/github/Instagram/instagram-ruby-gem给出的红宝石instagram api方法location(id), location_recent_media(id,options{}), media_item(id), media_likes(id)等使用的'id'参数?我正在使用rails,并且使用gem安装api。如何从instagram api获取'id'参数?

+0

[如何获取用于访问instagram中用户详细信息的'id'](http://stackoverflow.com/questions/8800459/how-to-get-the-id-for-accessing-user-详细功能于Instagram的) – 2012-01-10 12:38:30

回答

1

你可以看到如何在这里使用API​​ https://github.com/Instagram/instagram-ruby-gem的例子,看看代码我会说,ID是依赖于你正在查询,如果你使用的位置(ID)它会是位置的ID。现在,要从“真实世界”位置获取该ID,我相信您可以使用location_search(经度,纬度),这将为您提供一个数组,其中包含所有与该坐标接近的位置,例如(来自代码文档):

Instagram.location_search("37.7808851", "-122.3948632") 

这会给你一个阵列周围的位置37.7808851,-122.3948632(164 S公园,SF,CA美国)。

然后你可以使用IDS进行阵列与位置(ID),e.g:

mylocations = Instagram.location_search("37.7808851", "-122.3948632") 
Instagram.location(mylocations.first) 

希望它能帮助。