Class: Todoist::Misc::Uploads
- Includes:
- Util
- Defined in:
- lib/todoist/misc/uploads.rb
Instance Method Summary collapse
-
#add(file) ⇒ Object
Uploads a file given a Ruby File.
-
#delete(file_url) ⇒ Object
Deletes an upload given a file URL.
-
#get(limit = 30, last_id = 0) ⇒ Object
Get uploads up to limit.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Todoist::Service
Instance Method Details
#add(file) ⇒ Object
Uploads a file given a Ruby File.
7 8 9 10 11 |
# File 'lib/todoist/misc/uploads.rb', line 7 def add(file) multipart_file = @client.api_helper.multipart_file(file) params = {file_name: File.basename(file), file: multipart_file} @client.api_helper.get_multipart_response(Config::TODOIST_UPLOADS_ADD_COMMAND, params) end |
#delete(file_url) ⇒ Object
Deletes an upload given a file URL.
22 23 24 25 |
# File 'lib/todoist/misc/uploads.rb', line 22 def delete(file_url) params = {file_url: file_url} @client.api_helper.get_response(Config::TODOIST_UPLOADS_DELETE_COMMAND, params) end |
#get(limit = 30, last_id = 0) ⇒ Object
Get uploads up to limit. If last_id is entered, then the results list everything from that ID forward.
15 16 17 18 19 |
# File 'lib/todoist/misc/uploads.rb', line 15 def get(limit = 30, last_id = 0) params = {limit: limit} params["last_id"] = last_id if last_id @client.api_helper.get_response(Config::TODOIST_UPLOADS_GET_COMMAND, params) end |