Module: Instapaper::API::Bookmarks
- Included in:
- Instapaper::API
- Defined in:
- lib/instapaper/api/bookmarks.rb
Overview
Defines methods related to bookmarks
Instance Method Summary collapse
-
#add_bookmark(url, options = {}) ⇒ Object
Adds a new unread bookmark to the user’s account.
-
#archive_bookmark(bookmark_id) ⇒ Object
Moves the specified bookmark to the Archive.
-
#bookmarks(options = {}) ⇒ Object
Lists the user’s unread bookmarks, and can also synchronize reading positions.
-
#delete_bookmark(bookmark_id) ⇒ Object
Permanently deletes the specified bookmark.
-
#get_text(bookmark_id) ⇒ Object
Returns the specified bookmark’s processed text-view HTML, which is always text/html encoded as UTF-8.
-
#move_bookmark(bookmark_id, folder_id) ⇒ Object
Moves the specified bookmark to a user-created folder.
-
#star_bookmark(bookmark_id) ⇒ Object
Stars the specified bookmark.
-
#unarchive_bookmark(bookmark_id) ⇒ Object
Moves the specified bookmark to the top of the Unread folder.
-
#unstar_bookmark(bookmark_id) ⇒ Object
Un-stars the specified bookmark.
-
#update_read_progress(bookmark_id, progress, progress_timestamp = Time.now) ⇒ Object
Updates the user’s reading progress on a single article.
Instance Method Details
#add_bookmark(url, options = {}) ⇒ Object
Adds a new unread bookmark to the user’s account.
27 28 29 |
# File 'lib/instapaper/api/bookmarks.rb', line 27 def add_bookmark(url, = {}) perform_post_with_object('/api/1.1/bookmarks/add', .merge(url: url), Instapaper::Bookmark) end |
#archive_bookmark(bookmark_id) ⇒ Object
Moves the specified bookmark to the Archive.
52 53 54 |
# File 'lib/instapaper/api/bookmarks.rb', line 52 def archive_bookmark(bookmark_id) perform_post_with_object('/api/1.1/bookmarks/archive', {bookmark_id: bookmark_id}, Instapaper::Bookmark) end |
#bookmarks(options = {}) ⇒ Object
Lists the user’s unread bookmarks, and can also synchronize reading positions.
13 14 15 |
# File 'lib/instapaper/api/bookmarks.rb', line 13 def bookmarks( = {}) perform_post_with_object('/api/1.1/bookmarks/list', , Instapaper::BookmarkList) end |
#delete_bookmark(bookmark_id) ⇒ Object
Permanently deletes the specified bookmark. This is NOT the same as Archive. Please be clear to users if you’re going to do this.
34 35 36 |
# File 'lib/instapaper/api/bookmarks.rb', line 34 def delete_bookmark(bookmark_id) perform_post_with_objects('/api/1.1/bookmarks/delete', {bookmark_id: bookmark_id}, Array) end |
#get_text(bookmark_id) ⇒ Object
Returns the specified bookmark’s processed text-view HTML, which is always text/html encoded as UTF-8.
72 73 74 |
# File 'lib/instapaper/api/bookmarks.rb', line 72 def get_text(bookmark_id) perform_post_with_unparsed_response('/api/1.1/bookmarks/get_text', bookmark_id: bookmark_id) end |
#move_bookmark(bookmark_id, folder_id) ⇒ Object
Moves the specified bookmark to a user-created folder.
65 66 67 |
# File 'lib/instapaper/api/bookmarks.rb', line 65 def move_bookmark(bookmark_id, folder_id) perform_post_with_object('/api/1.1/bookmarks/move', {bookmark_id: bookmark_id, folder_id: folder_id}, Instapaper::Bookmark) end |
#star_bookmark(bookmark_id) ⇒ Object
Stars the specified bookmark.
40 41 42 |
# File 'lib/instapaper/api/bookmarks.rb', line 40 def star_bookmark(bookmark_id) perform_post_with_object('/api/1.1/bookmarks/star', {bookmark_id: bookmark_id}, Instapaper::Bookmark) end |
#unarchive_bookmark(bookmark_id) ⇒ Object
Moves the specified bookmark to the top of the Unread folder.
58 59 60 |
# File 'lib/instapaper/api/bookmarks.rb', line 58 def unarchive_bookmark(bookmark_id) perform_post_with_object('/api/1.1/bookmarks/unarchive', {bookmark_id: bookmark_id}, Instapaper::Bookmark) end |
#unstar_bookmark(bookmark_id) ⇒ Object
Un-stars the specified bookmark.
46 47 48 |
# File 'lib/instapaper/api/bookmarks.rb', line 46 def unstar_bookmark(bookmark_id) perform_post_with_object('/api/1.1/bookmarks/unstar', {bookmark_id: bookmark_id}, Instapaper::Bookmark) end |
#update_read_progress(bookmark_id, progress, progress_timestamp = Time.now) ⇒ Object
Updates the user’s reading progress on a single article.
21 22 23 |
# File 'lib/instapaper/api/bookmarks.rb', line 21 def update_read_progress(bookmark_id, progress, = Time.now) perform_post_with_object('/api/1.1/bookmarks/update_read_progress', {bookmark_id: bookmark_id, progress: progress, progress_timestamp: .to_i}, Instapaper::Bookmark) end |