instapaper/lib/instapaper/api/folder.rb
stve 6271356847 slight refactor in preparation for adding version 1.1 support
a couple breaking changes as part of this:

* the api version can no longer be set via configuration (since the API
itself now supports more than one version 1 and 1.1 this no longer makes
sense)
* removed module based support, all requests will require an Instapaper::Client from now on
* removed path_prefix configuration for same reasons that the api version was removed
2015-02-09 16:21:30 -05:00

32 lines
1.1 KiB
Ruby

module Instapaper
module API
# Defines methods related to folders
module Folder
# List the account's user-created folders.
# @note This only includes organizational folders and does not include RSS-feed folders or starred-subscription folders
def folders
post('/api/1/folders/list')
end
# Creates an organizational folder.
# @param title [String] The title of the folder to create
def add_folder(title)
post('/api/1/folders/add', title: title)
end
# Deletes the folder and moves any articles in it to the Archive.
# @param folder_id [String] The id of the folder.
def delete_folder(folder_id)
post('/api/1/folders/delete', folder_id: folder_id)
end
# Re-orders a user's folders.
# @param order [Array] An array of folder_id:position pairs joined by commas.
# @example Ordering folder_ids 100, 200, and 300
# Instapaper.set_order(['100:1','200:2','300:3'])
def set_order(order = []) # rubocop:disable Style/AccessorMethodName
post('/api/1/folders/set_order', order: order.join(','))
end
end
end
end