Module: Instapaper::API::Highlights

Included in:
Instapaper::API
Defined in:
lib/instapaper/api/highlights.rb

Overview

Defines methods related to highlights

Instance Method Summary collapse

Instance Method Details

#add_highlight(bookmark_id, options = {}) ⇒ Instapaper::Highlight

Note:

Non-subscribers are limited to 5 highlights per month.

Create a new highlight

Parameters:

  • bookmark_id (String, Integer)
  • options (Hash) (defaults to: {})

Options Hash (options):

  • :text (String)

    The text for the highlight (HTML tags in text parameter should be unescaped.)

  • :posiiton (String, Integer)

    The 0-indexed position of text in the content. Defaults to 0.

Returns:


20
21
22
# File 'lib/instapaper/api/highlights.rb', line 20

def add_highlight(bookmark_id, options = {})
  perform_post_with_object("/api/1.1/bookmarks/#{bookmark_id}/highlight", options, Instapaper::Highlight)
end

#delete_highlight(highlight_id, options = {}) ⇒ Boolean

Delete a highlight

Parameters:

  • highlight_id (String, Integer)

Returns:

  • (Boolean)

27
28
29
30
# File 'lib/instapaper/api/highlights.rb', line 27

def delete_highlight(highlight_id, options = {})
  perform_post_with_unparsed_response("/api/1.1/highlights/#{highlight_id}/delete", options)
  true
end

#highlights(bookmark_id) ⇒ Object

List highlights for a bookmark

Parameters:

  • bookmark_id (String, Integer)

9
10
11
# File 'lib/instapaper/api/highlights.rb', line 9

def highlights(bookmark_id)
  perform_get_with_objects("/api/1.1/bookmarks/#{bookmark_id}/highlights", {}, Instapaper::Highlight)
end