lib/todoist/misc/completed.rb in todoist-ruby-0.1.3 vs lib/todoist/misc/completed.rb in todoist-ruby-0.2.1
- old
+ new
@@ -1,30 +1,30 @@
module Todoist
module Misc
- class Completed
+ class Completed < Todoist::Service
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)
+ @client.api_helper.get_response(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"])
+ params["until"] = ParseHelper.format_time(params["until"])
end
if params["since"]
- params["since"] = ParseHelper.formatTime(params["since"])
+ params["since"] = ParseHelper.format_time(params["since"])
end
- result = NetworkHelper.getResponse(Config::TODOIST_COMPLETED_GET_ALL_COMMAND, params)
+ 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