Domanda

Qualcuno può dirmi "Come ottenere" o "ciò che è" il parametro 'id' che viene utilizzato nei metodi API rubino Instagram location(id), location_recent_media(id,options{}), media_item(id), media_likes(id) ecc fornite nella documentazione cortile http://rubydoc.info/github/Instagram/instagram-ruby-gem ? Sto usando le rotaie e l'API è installato utilizzando gemma.

È stato utile?

Soluzione

You can see an example of how to use the API in here https://github.com/Instagram/instagram-ruby-gem, taking a look at the code I would say that the id is dependent on what you are querying, if you are using location(id) it would be the id of the location. Now, to get from a "real world" location to that id I believe you can use location_search(longitude, latitude) and that would give you an array with all the locations close to that coordinates, e.g (from the code documentation):

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

That would give you an array with the locations around 37.7808851, -122.3948632 (164 S Park, SF, CA USA).

Then you can use that array of ids with location(id), e.g:

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

Hope it helps.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top