class Todoist::Misc::Uploads

Public Instance Methods

add(file) click to toggle source

Uploads a file given a Ruby File.

# File lib/todoist/misc/uploads.rb, line 7
def add(file)
  multipart_file = @client.api_helper.multipart_file(file)
  params = {file_name: File.basename(file), file: multipart_file}
  @client.api_helper.get_multipart_response(Config::TODOIST_UPLOADS_ADD_COMMAND, params)
end
delete(file_url) click to toggle source

Deletes an upload given a file URL.

# File lib/todoist/misc/uploads.rb, line 22
def delete(file_url)
  params = {file_url: file_url}
  @client.api_helper.get_response(Config::TODOIST_UPLOADS_DELETE_COMMAND, params)
end
get(limit = 30, last_id = 0) click to toggle source

Get uploads up to limit. If last_id is entered, then the results list everything from that ID forward.

# File lib/todoist/misc/uploads.rb, line 15
def get(limit = 30, last_id = 0)
  params = {limit: limit}
  params["last_id"] = last_id if last_id
  @client.api_helper.get_response(Config::TODOIST_UPLOADS_GET_COMMAND, params)
end