Module: Instapaper::API::Folders

Included in:
Instapaper::API
Defined in:
lib/instapaper/api/folders.rb

Overview

Defines methods related to folders

Instance Method Summary collapse

Instance Method Details

#add_folder(title) ⇒ Object

Creates an organizational folder.

Parameters:

  • title (String)

    The title of the folder to create


15
16
17
# File 'lib/instapaper/api/folders.rb', line 15

def add_folder(title)
  perform_post_with_object('/api/1.1/folders/add', {title: title}, Instapaper::Folder)
end

#delete_folder(folder_id) ⇒ Object

Deletes the folder and moves any articles in it to the Archive.

Parameters:

  • folder_id (String)

    The id of the folder.


21
22
23
24
# File 'lib/instapaper/api/folders.rb', line 21

def delete_folder(folder_id)
  perform_post_with_unparsed_response('/api/1.1/folders/delete', folder_id: folder_id)
  true
end

#foldersObject

Note:

This only includes organizational folders and does not include RSS-feed folders or starred-subscription folders

List the account's user-created folders.


9
10
11
# File 'lib/instapaper/api/folders.rb', line 9

def folders
  perform_post_with_objects('/api/1.1/folders/list', {}, Instapaper::Folder)
end

#set_order(order = []) ⇒ Object

Re-orders a user's folders.

Examples:

Ordering folder_ids 100, 200, and 300

Instapaper.set_order(['100:1','200:2','300:3'])

Parameters:

  • order (Array) (defaults to: [])

    An array of folder_id:position pairs joined by commas.


30
31
32
# File 'lib/instapaper/api/folders.rb', line 30

def set_order(order = []) # rubocop:disable Style/AccessorMethodName
  perform_post_with_objects('/api/1.1/folders/set_order', {order: order.join(',')}, Instapaper::Folder)
end