class Todoist::Misc::Completed

Public Instance Methods

get_all_completed_items(params = {}) click to toggle source

Retrieves all completed items as documented at developer.todoist.com/#get-all-completed-items. Several parameters are possible to limit scope. See link. Dates should be passed as DateTime. This method takes care of the formatting to send to the API. Returns projects and items back as :items and :projects keys.

# File lib/todoist/misc/completed.rb, line 18
def get_all_completed_items(params = {})
  if params["until"]
    params["until"] = ParseHelper.format_time(params["until"])
  end
  if params["since"]
    params["since"] = ParseHelper.format_time(params["since"])
  end
  
  result = @client.api_helper.get_response(Config::TODOIST_COMPLETED_GET_ALL_COMMAND, params)
  items = ParseHelper.make_objects_as_array(result["items"])
  projects = ParseHelper.make_objects_as_array(result["projects"])
  return {"items" => items, "projects" => projects}
end
get_productivity_stats() click to toggle source

Get productivity stats. Returns a hash of statistics as documented at developer.todoist.com/#get-productivity-stats

# File lib/todoist/misc/completed.rb, line 8
def get_productivity_stats()
  @client.api_helper.get_response(Config::TODOIST_COMPLETED_GET_STATS_COMMAND, {})
end