Class: Instagram::Client
- Inherits:
-
API
- Object
- API
- Instagram::Client
- Includes:
- Comments, Geographies, Likes, Locations, Media, Subscriptions, Tags, Users
- Defined in:
- lib/instagram/client.rb,
lib/instagram/client/tags.rb,
lib/instagram/client/likes.rb,
lib/instagram/client/media.rb,
lib/instagram/client/users.rb,
lib/instagram/client/utils.rb,
lib/instagram/client/comments.rb,
lib/instagram/client/locations.rb,
lib/instagram/client/geographies.rb,
lib/instagram/client/subscriptions.rb
Overview
All methods have been separated into modules and follow the same grouping used in the Instagram API Documentation.
Wrapper for the Instagram REST API
Defined Under Namespace
Modules: Comments, Geographies, Likes, Locations, Media, Subscriptions, Tags, Users
Instance Method Summary collapse
-
#approve_user(id, options = {}) ⇒ Hashie::Mash
Approve a relationship request between the current user and the target user.
-
#unfollow_user(id, options = {}) ⇒ Hashie::Mash
Block a relationship between the current user and the target user.
-
#deny_user(id, options = {}) ⇒ Hashie::Mash
Deny a relationship request between the current user and the target user.
-
#follow_user(id, options = {}) ⇒ Hashie::Mash
Create a follows relationship between the current user and the target user.
-
#unblock_user(id, options = {}) ⇒ Hashie::Mash
Remove a relationship block between the current user and the target user.
-
#unfollow_user(id, options = {}) ⇒ Hashie::Mash
Destroy a follows relationship between the current user and the target user.
-
#user_followed_by(*args) ⇒ Object
Returns a list of users whom a given user is followed by.
-
#user_liked_media(options = {}) ⇒ Hashie::Mash
Returns a list of media items liked by the current user.
-
#user_media_feed(options = {}) ⇒ Array
Returns most recent media items from the currently authorized user's feed.
-
#user_recent_media(*args) ⇒ Object
Returns a list of recent media items for a given user.
-
#user_relationship(id, options = {}) ⇒ Hashie::Mash
Returns information about the current user's relationship (follow/following/etc) to another user.
-
#user_requested_by ⇒ Object
Returns a list of users whom a given user is followed by.
Methods included from Subscriptions
#create_subscription, #delete_subscription, #process_subscription, #subscriptions
Methods included from Likes
#like_media, #media_likes, #unlike_media
Methods included from Comments
#create_media_comment, #delete_media_comment, #media_comments
Methods included from Tags
#tag, #tag_recent_media, #tag_search
Methods included from Geographies
Methods included from Locations
#location, #location_recent_media, #location_search
Methods included from Media
#media_item, #media_popular, #media_search
Methods included from Users
#user, #user_follows, #user_search
Methods included from OAuth
#authorize_url, #get_access_token
Methods included from Request
Instance Method Details
#approve_user(id, options = {}) ⇒ Hashie::Mash
Approve a relationship request between the current user and the target user
285 286 287 288 289 |
# File 'lib/instagram/client/users.rb', line 285 def approve_user(id, ={}) ["action"] = "approve" response = post("users/#{id}/relationship", ) response["data"] end |
#unfollow_user(id, options = {}) ⇒ Hashie::Mash
Block a relationship between the current user and the target user
249 250 251 252 253 |
# File 'lib/instagram/client/users.rb', line 249 def block_user(id, ={}) ["action"] = "block" response = post("users/#{id}/relationship", ) response["data"] end |
#deny_user(id, options = {}) ⇒ Hashie::Mash
Deny a relationship request between the current user and the target user
303 304 305 306 307 |
# File 'lib/instagram/client/users.rb', line 303 def deny_user(id, ={}) ["action"] = "deny" response = post("users/#{id}/relationship", ) response["data"] end |
#follow_user(id, options = {}) ⇒ Hashie::Mash
Create a follows relationship between the current user and the target user
213 214 215 216 217 |
# File 'lib/instagram/client/users.rb', line 213 def follow_user(id, ={}) ["action"] = "follow" response = post("users/#{id}/relationship", ) response["data"] end |
#unblock_user(id, options = {}) ⇒ Hashie::Mash
Remove a relationship block between the current user and the target user
267 268 269 270 271 |
# File 'lib/instagram/client/users.rb', line 267 def unblock_user(id, ={}) ["action"] = "unblock" response = post("users/#{id}/relationship", ) response["data"] end |
#unfollow_user(id, options = {}) ⇒ Hashie::Mash
Destroy a follows relationship between the current user and the target user
231 232 233 234 235 |
# File 'lib/instagram/client/users.rb', line 231 def unfollow_user(id, ={}) ["action"] = "unfollow" response = post("users/#{id}/relationship", ) response["data"] end |
#user_followed_by(id = nil, options = {}) ⇒ Hashie::Mash #user_followed_by(id = nil, options = {}) ⇒ Hashie::Mash
Returns a list of users whom a given user is followed by
91 92 93 94 95 96 |
# File 'lib/instagram/client/users.rb', line 91 def user_followed_by(*args) = args.last.is_a?(Hash) ? args.pop : {} id = args.first || "self" response = get("users/#{id}/followed-by", ) response["data"] end |
#user_liked_media(options = {}) ⇒ Hashie::Mash
Returns a list of media items liked by the current user
179 180 181 182 |
# File 'lib/instagram/client/users.rb', line 179 def user_liked_media(={}) response = get("users/self/media/liked", ) response end |
#user_media_feed(options = {}) ⇒ Array
Returns most recent media items from the currently authorized user's feed.
132 133 134 135 136 |
# File 'lib/instagram/client/users.rb', line 132 def user_media_feed(*args) = args.first.is_a?(Hash) ? args.pop : {} response = get('users/self/feed', ) response end |
#user_recent_media(options = {}) ⇒ Hashie::Mash #user_recent_media(id = nil, options = {}) ⇒ Hashie::Mash
Returns a list of recent media items for a given user
159 160 161 162 163 164 |
# File 'lib/instagram/client/users.rb', line 159 def user_recent_media(*args) = args.last.is_a?(Hash) ? args.pop : {} id = args.first || "self" response = get("users/#{id}/media/recent", ) response["data"] end |
#user_relationship(id, options = {}) ⇒ Hashie::Mash
Returns information about the current user's relationship (follow/following/etc) to another user
196 197 198 199 |
# File 'lib/instagram/client/users.rb', line 196 def user_relationship(id, ={}) response = get("users/#{id}/relationship", ) response["data"] end |
#user_requested_by ⇒ Hashie::Mash #user_requested_by ⇒ Hashie::Mash
Returns a list of users whom a given user is followed by
113 114 115 116 |
# File 'lib/instagram/client/users.rb', line 113 def user_requested_by() response = get("users/self/requested-by") response["data"] end |