diff --git a/lib/instapaper/api/highlights.rb b/lib/instapaper/api/highlights.rb index 7784c40..201969d 100644 --- a/lib/instapaper/api/highlights.rb +++ b/lib/instapaper/api/highlights.rb @@ -5,6 +5,7 @@ module Instapaper # Defines methods related to highlights module Highlights # List highlights for a bookmark + # @param bookmark_id [String, Integer] def highlights(bookmark_id) perform_post_with_objects("/api/1.1/bookmarks/#{bookmark_id}/highlights", {}, Instapaper::Highlight) end @@ -16,7 +17,7 @@ module Instapaper # @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 highlight(bookmark_id, options = {}) + def add_highlight(bookmark_id, options = {}) perform_post_with_object("/api/1.1/bookmarks/#{bookmark_id}/highlight", options, Instapaper::Highlight) end diff --git a/spec/instapaper/api/highlights_spec.rb b/spec/instapaper/api/highlights_spec.rb index ea31d93..ec3eb9d 100644 --- a/spec/instapaper/api/highlights_spec.rb +++ b/spec/instapaper/api/highlights_spec.rb @@ -22,19 +22,19 @@ describe Instapaper::Client::Highlights do end end - describe '#highlight' do + describe '#add_highlight' do before do stub_post('/api/1.1/bookmarks/123/highlight') .to_return(status: 200, body: fixture('highlight.json'), headers: {content_type: 'application/json; charset=utf-8'}) end it 'gets the correct resource' do - client.highlight(123, text: 'This is the highlighted text.', position: 22) + client.add_highlight(123, text: 'This is the highlighted text.', position: 22) expect(a_post('/api/1.1/bookmarks/123/highlight')).to have_been_made end it 'returns an array containing folders on success' do - highlight = client.highlight(123, text: 'This is the highlighted text.', position: 22) + highlight = client.add_highlight(123, text: 'This is the highlighted text.', position: 22) expect(highlight).to be_an Instapaper::Highlight end end