mirror of
https://github.com/samsonjs/instapaper.git
synced 2026-04-27 14:57:44 +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
|
# Defines methods related to highlights
|
||||||
module Highlights
|
module Highlights
|
||||||
# List highlights for a bookmark
|
# List highlights for a bookmark
|
||||||
|
# @param bookmark_id [String, Integer]
|
||||||
def highlights(bookmark_id)
|
def highlights(bookmark_id)
|
||||||
perform_post_with_objects("/api/1.1/bookmarks/#{bookmark_id}/highlights", {}, Instapaper::Highlight)
|
perform_post_with_objects("/api/1.1/bookmarks/#{bookmark_id}/highlights", {}, Instapaper::Highlight)
|
||||||
end
|
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] :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.
|
# @option options [String, Integer] :posiiton The 0-indexed position of text in the content. Defaults to 0.
|
||||||
# @return [Instapaper::Highlight]
|
# @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)
|
perform_post_with_object("/api/1.1/bookmarks/#{bookmark_id}/highlight", options, Instapaper::Highlight)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,19 +22,19 @@ describe Instapaper::Client::Highlights do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#highlight' do
|
describe '#add_highlight' do
|
||||||
before do
|
before do
|
||||||
stub_post('/api/1.1/bookmarks/123/highlight')
|
stub_post('/api/1.1/bookmarks/123/highlight')
|
||||||
.to_return(status: 200, body: fixture('highlight.json'), headers: {content_type: 'application/json; charset=utf-8'})
|
.to_return(status: 200, body: fixture('highlight.json'), headers: {content_type: 'application/json; charset=utf-8'})
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'gets the correct resource' do
|
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
|
expect(a_post('/api/1.1/bookmarks/123/highlight')).to have_been_made
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns an array containing folders on success' do
|
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
|
expect(highlight).to be_an Instapaper::Highlight
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue