module Todoist module Misc class Completed include Todoist::Util # Get productivity stats. Returns a hash of statistics as documented # at https://developer.todoist.com/#get-productivity-stats def get_productivity_stats() NetworkHelper.getResponse(Config::TODOIST_COMPLETED_GET_STATS_COMMAND) end # Retrieves all completed items as documented at # https://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. def get_all_completed_items(params = {}) if params["until"] params["until"] = ParseHelper.formatTime(params["until"]) end if params["since"] params["since"] = ParseHelper.formatTime(params["since"]) end result = NetworkHelper.getResponse(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 end end end