class Todoist::Misc::Templates
Public Instance Methods
export_as_file(project)
click to toggle source
Export the project as a CSV string
# File lib/todoist/misc/templates.rb, line 17 def export_as_file(project) params = {project_id: project.id} @client.api_helper.get_response(Config::TODOIST_TEMPLATES_EXPORT_AS_FILE_COMMAND, params) end
export_as_url(project)
click to toggle source
Export the project as a url that can be accessed over HTTP
# File lib/todoist/misc/templates.rb, line 23 def export_as_url(project) params = {project_id: project.id} @client.api_helper.get_response(Config::TODOIST_TEMPLATES_EXPORT_AS_URL_COMMAND, params) end
import_into_project(project, file)
click to toggle source
Given a project and a File object (Ruby) imports the content onto the server. Critically, if the file is a CSV file make sure that the suffix is CSV. Otherwise, the file will be parsed as one item per line and ignore the formatting altogether.
# File lib/todoist/misc/templates.rb, line 10 def import_into_project(project, file) multipart_file = @client.api_helper.multipart_file(file) params = {project_id: project.id, file: multipart_file} @client.api_helper.get_multipart_response(Config::TODOIST_TEMPLATES_IMPORT_INTO_PROJECT_COMMAND, params) end