Sha256: 9f3e3b4556c8a15799ef175ef8a152e4f29ac3d6b4787c011f290f0234f4eb56

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 KB

Contents

require 'instapaper/folder'

module Instapaper
  module API
    # Defines methods related to folders
    module Folders
      # 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
        perform_post_with_objects('/api/1.1/folders/list', {}, Instapaper::Folder)
      end

      # Creates an organizational folder.
      # @param title [String] The title of the folder to create
      def add_folder(title)
        perform_post_with_object('/api/1.1/folders/add', {title: title}, Instapaper::Folder)
      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)
        perform_post_with_unparsed_response('/api/1.1/folders/delete', folder_id: folder_id)
        true
      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
        perform_post_with_objects('/api/1.1/folders/set_order', {order: order.join(',')}, Instapaper::Folder)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
instapaper-1.0.0 lib/instapaper/api/folders.rb
instapaper-1.0.0.pre3 lib/instapaper/api/folders.rb
instapaper-1.0.0.pre2 lib/instapaper/api/folders.rb