lib/todoist/misc/items.rb in todoist-ruby-0.1.3 vs lib/todoist/misc/items.rb in todoist-ruby-0.2.1
- old
+ new
@@ -1,8 +1,8 @@
module Todoist
module Misc
- class Items
+ class Items < Todoist::Service
include Todoist::Util
# Add a new task to a project. Note, that this is provided as a
# helper method, a shortcut, to quickly add a task without going
# through the Sync workflow.
@@ -28,11 +28,11 @@
params["labels"] = labels_param.to_json
optional_params.delete("labels")
end
params.merge(optional_params)
- result = NetworkHelper.getResponse(Config::TODOIST_ITEMS_ADD_COMMAND, params)
+ result = @client.api_helper.get_response(Config::TODOIST_ITEMS_ADD_COMMAND, params)
item = ParseHelper.make_object(result)
return item
end
# This function is used to extract detailed information about the item,
@@ -41,10 +41,10 @@
#
# For more information see: https://developer.todoist.com/#get-item-info
def get_item(item, all_data = true)
params = {item_id: item.id, all_data: all_data}
- result = NetworkHelper.getResponse(Config::TODOIST_ITEMS_GET_COMMAND, params)
+ result = @client.api_helper.get_response(Config::TODOIST_ITEMS_GET_COMMAND, params)
item = ParseHelper.make_object(result["item"])
project = ParseHelper.make_object(result["project"])
notes = result["notes"] ? ParseHelper.make_objects_as_hash(result["notes"]) : nil
return {"item" => item, "project" => project, "notes" => notes}
end