Module: Instagram::Client::Likes

Included in:
Instagram::Client
Defined in:
lib/instagram/client/likes.rb

Overview

Defines methods related to likes

Instance Method Summary collapse

Instance Method Details

#like_media(id, text) ⇒ nil

Issues a like by the currently authenticated user, for a given media item ID

Examples:

Like media item with ID 777

Instagram.like_media(777)

Parameters:

  • id (Integer)

    An Instagram media item ID

Returns:

  • (nil)

See Also:

  • url


36
37
38
39
# File 'lib/instagram/client/likes.rb', line 36

def like_media(id, options={})
  response = post("media/#{id}/likes", options)
  response["data"]
end

#media_likes(id) ⇒ Hashie::Mash

Returns a list of users who like a given media item ID

Returns A list of users.

Examples:

Returns a list of users who like the media item of ID 1234

Instagram.media_likes(777)

Parameters:

  • media (Integer)

    An Instagram media item ID

Returns:

  • (Hashie::Mash)

    A list of users.

See Also:

  • url


18
19
20
21
# File 'lib/instagram/client/likes.rb', line 18

def media_likes(id, *args)
  response = get("media/#{id}/likes")
  response["data"]
end

#unlike_media(id) ⇒ nil

Removes the like on a givem media item ID for the currently authenticated user

Examples:

Remove the like for the currently authenticated user on the media item with the ID of 777

Instagram.unlike_media(777)

Parameters:

  • media_id (Integer)

    An Instagram media item ID.

Returns:

  • (nil)

See Also:

  • url


52
53
54
55
# File 'lib/instagram/client/likes.rb', line 52

def unlike_media(id, options={})
  response = delete("media/#{id}/likes", options)
  response["data"]
end