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) ⇒ Hashie::Mash

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

Returns Metadata.

Examples:

Like media item with ID 777

Instagram.like_media(777)

Parameters:

  • id (Integer)

    An Instagram media item ID

Returns:

  • (Hashie::Mash)

    Metadata

See Also:

  • url

Supported formats:

  • :json

Requires Authentication:

  • true

    If getting this data of a protected user, you must be authenticated (and be allowed to see that user).

Rate Limited:

  • true



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

def like_media(id, options={})
  response = post("media/#{id}/likes", options)
  response
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

Supported formats:

  • :json

Requires Authentication:

  • true

    If getting this data of a protected user, you must be authenticated (and be allowed to see that user).

Rate Limited:

  • true



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

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

#unlike_media(id) ⇒ Hashie::Mash

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

Returns Metadata.

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:

  • (Hashie::Mash)

    Metadata

See Also:

  • url

Supported formats:

  • :json

Requires Authentication:

  • true

Rate Limited:

  • true



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

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