Module: Instagram::Client::Users
- Included in:
- Instagram::Client
- Defined in:
- lib/instagram_api/client/users.rb
Overview
Methods for the Users API.
Instance Method Summary collapse
-
#feed ⇒ Hashie::Mash
Get the authenticated user’s feed.
-
#liked ⇒ Hashie::Mash
See the authenticated user’s list of media they’ve liked.
-
#recent(id = nil) ⇒ Hashie::Mash
Get the most recent media published by a user.
-
#search(query = nil) ⇒ Hashie::Mash
Search for a user by username.
-
#user(user = nil) ⇒ Hashie::Mash
Retrieve a single user’s information.
Instance Method Details
#feed ⇒ Hashie::Mash
Get the authenticated user’s feed.
49 50 51 |
# File 'lib/instagram_api/client/users.rb', line 49 def feed get '/users/self/feed', auth_params end |
#liked ⇒ Hashie::Mash
See the authenticated user’s list of media they’ve liked.
70 71 72 |
# File 'lib/instagram_api/client/users.rb', line 70 def liked get '/users/self/media/liked', auth_params end |
#recent(id = nil) ⇒ Hashie::Mash
Get the most recent media published by a user.
Returns the recent media for the user for the ID passed in as a parameter. If no ID is specified, then returns the authenticated user’s recent media.
61 62 63 64 |
# File 'lib/instagram_api/client/users.rb', line 61 def recent(id=nil) id = "self" unless id get "/users/#{id}/media/recent", auth_params end |
#search(query = nil) ⇒ Hashie::Mash
Search for a user by username.
39 40 41 |
# File 'lib/instagram_api/client/users.rb', line 39 def search(query=nil) get "/users/search", auth_params.merge(q: query) end |
#user(user = nil) ⇒ Hashie::Mash
Retrieve a single user’s information.
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/instagram_api/client/users.rb', line 20 def user(user=nil) case user when Integer get "/users/#{user}", auth_params when String results = search(user) get "/users/#{results.data[0].id}", auth_params when nil get '/users/self', auth_params end end |