Sha256: a7affa4a62605527e0aa9ac2b65f29d344aeb81ca2f9bd1015ba304c8d016cec

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 KB

Contents

require 'instapaper/highlight'

module Instapaper
  module API
    # Defines methods related to highlights
    module Highlights
      # List highlights for a bookmark
      # @param bookmark_id [String, Integer]
      def highlights(bookmark_id)
        perform_get_with_objects("/api/1.1/bookmarks/#{bookmark_id}/highlights", {}, Instapaper::Highlight)
      end

      # Create a new highlight
      # @note Non-subscribers are limited to 5 highlights per month.
      # @param bookmark_id [String, Integer]
      # @param options [Hash]
      # @option options [String] :text The text for the highlight (HTML tags in text parameter should be unescaped.)
      # @option options [String, Integer] :posiiton The 0-indexed position of text in the content. Defaults to 0.
      # @return [Instapaper::Highlight]
      def add_highlight(bookmark_id, options = {})
        perform_post_with_object("/api/1.1/bookmarks/#{bookmark_id}/highlight", options, Instapaper::Highlight)
      end

      # Delete a highlight
      # @param highlight_id [String, Integer]
      # @return [Boolean]
      def delete_highlight(highlight_id, options = {})
        perform_post_with_unparsed_response("/api/1.1/highlights/#{highlight_id}/delete", options)
        true
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
instapaper-1.0.1 lib/instapaper/api/highlights.rb
instapaper-1.0.0 lib/instapaper/api/highlights.rb
instapaper-1.0.0.pre3 lib/instapaper/api/highlights.rb
instapaper-1.0.0.pre2 lib/instapaper/api/highlights.rb