Pergunta

How do i get the id for accessing user info by (Hashie::Mash)user(id) method of the instagram API or accessing his/her location by (Hashie::Mash)location(id)?

I am using rails for my project.

Foi útil?

Solução

You can search for a user to get his/her id, e.g:

shaynesids = Instagram.user_search("Shayne Sweeney")

That will give you all the ids on an array of user matching Shayne Sweeny (hopefully just one), then you can use it with user(id), like this:

myuser = Instagram.user(shaynesids.first)

Note: In here I'm assuming that the search it's gonna return at least one result, you will need to be careful in your code to account for errors, because it could return an empty array.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top