Coerce BookmarkList bookmarks to correct format

Previously fetching all bookmarks caused the
`instapaper_hash` not being set.
This commit is contained in:
Vesa Vänskä 2016-08-02 22:57:06 +03:00
parent 19304cc274
commit 546d4ca55b
2 changed files with 10 additions and 0 deletions

View file

@ -60,6 +60,11 @@ module Instapaper
if response.key?('hash')
response['instapaper_hash'] = response.delete('hash')
end
if response.key?('bookmarks')
response['bookmarks'] = response['bookmarks'].collect {|bookmark|
coerce_hash(bookmark)
}
end
response
end
end

View file

@ -27,6 +27,11 @@ describe Instapaper::Client::Bookmarks do
expect(bookmark).to be_an Instapaper::Bookmark
end
end
it 'coerces bookmarks correctly' do
list = client.bookmarks
expect(list.bookmarks.first.instapaper_hash).to_not be_nil
end
end
describe '#update_read_progress' do