lib/todoist/misc/uploads.rb in todoist-ruby-0.1.3 vs lib/todoist/misc/uploads.rb in todoist-ruby-0.2.1
- old
+ new
@@ -1,28 +1,28 @@
module Todoist
module Misc
- class Uploads
+ class Uploads < Todoist::Service
include Todoist::Util
# Uploads a file given a Ruby File.
def add(file)
- multipart_file = NetworkHelper.multipart_file(file)
+ multipart_file = @client.api_helper.multipart_file(file)
params = {file_name: File.basename(file), file: multipart_file}
- NetworkHelper.getMultipartResponse(Config::TODOIST_UPLOADS_ADD_COMMAND, params)
+ @client.api_helper.get_multipart_response(Config::TODOIST_UPLOADS_ADD_COMMAND, params)
end
# Get uploads up to limit. If last_id is entered, then the results list
# everything from that ID forward.
def get(limit = 30, last_id = 0)
params = {limit: limit}
params["last_id"] = last_id if last_id
- NetworkHelper.getResponse(Config::TODOIST_UPLOADS_GET_COMMAND, params)
+ @client.api_helper.get_response(Config::TODOIST_UPLOADS_GET_COMMAND, params)
end
# Deletes an upload given a file URL.
def delete(file_url)
params = {file_url: file_url}
- NetworkHelper.getResponse(Config::TODOIST_UPLOADS_DELETE_COMMAND, params)
+ @client.api_helper.get_response(Config::TODOIST_UPLOADS_DELETE_COMMAND, params)
end
end
end
end