Module: Instagram::Client::Comments

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

Overview

Defines methods related to comments

Instance Method Summary collapse

Instance Method Details

#create_media_comment(id, text) ⇒ Hashie::Mash

Creates a comment for a given media item ID

Returns The comment created.

Examples:

Creates a new comment on media item with ID 777

Instagram.create_media_comment(777, "Oh noes!")

Parameters:

  • id (Integer)

    An Instagram media item ID

  • text (String)

    The text of your comment

Returns:

  • (Hashie::Mash)

    The comment created.

See Also:

  • url


37
38
39
40
# File 'lib/instagram/client/comments.rb', line 37

def create_media_comment(id, text, options={})
  response = post("media/#{id}/comments", options.merge(:text => text))
  response["data"]
end

#delete_media_comment(media_id, comment_id) ⇒ nil

Deletes a comment for a given media item ID

Examples:

Delete the comment with ID of 1234, on the media item with ID of 777

Instagram.delete_media_comment(777, 1234)

Parameters:

  • media_id (Integer)

    An Instagram media item ID.

  • comment_id (Integer)

    Your comment ID of the comment you wish to delete.

Returns:

  • (nil)

See Also:

  • url


56
57
58
59
# File 'lib/instagram/client/comments.rb', line 56

def delete_media_comment(media_id, comment_id, options={})
  response = delete("media/#{media_id}/comments/#{comment_id}", options)
  response["data"]
end

#media_comments(id) ⇒ Hashie::Mash

Returns a list of comments for a given media item ID

Returns The requested comment.

Examples:

Returns a list of comments for the media item of ID 1234

Instagram.media_comments(777)

Parameters:

  • id (Integer)

    An Instagram media item ID

Returns:

  • (Hashie::Mash)

    The requested comment.

See Also:

  • url


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

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