mirror of
https://github.com/samsonjs/instapaper.git
synced 2026-03-25 08:55:49 +00:00
rename Instapaper::API::Highlights#highlight to add_highlight
This commit is contained in:
parent
c424057b07
commit
d64dfa1085
2 changed files with 5 additions and 4 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue