Module: Insightly2::DSL::Tasks
- Included in:
- Insightly2::DSL
- Defined in:
- lib/insightly2/dsl/tasks.rb
Instance Method Summary collapse
-
#create_task(task: nil) ⇒ Insightly2::Resources::Task?
POST /v2.1/Tasks Create a task.
-
#create_task_comment(id: nil, comment: nil) ⇒ Insightly2::Resources::Comment?
POST /v2.1/Tasks/c_id/Comments Create a comment for a task.
-
#delete_task(id: nil) ⇒ Faraday::Response
DELETE /v2.1/Tasks/id Delete a task.
-
#get_task(id: nil) ⇒ Insightly2::Resources::Task?
GET /v2.1/Tasks/id Get a task.
-
#get_task_comments(id: nil) ⇒ Array?
GET /v2.1/Tasks/c_id/Comments Get a list of comments for a task.
-
#get_tasks(ids: []) ⇒ Insightly2::Resources::Task?
GET /v2.1/Tasks?ids=ids Get a list of tasks.
-
#update_task(task: nil) ⇒ Insightly2::Resources::Comment?
PUT /v2.1/Tasks Update a task.
Instance Method Details
#create_task(task: nil) ⇒ Insightly2::Resources::Task?
POST /v2.1/Tasks Create a task.
39 40 41 42 |
# File 'lib/insightly2/dsl/tasks.rb', line 39 def create_task(task: nil) raise ArgumentError, "Task cannot be blank" if task.blank? Resources::Task.parse(request(:post, "Tasks", task)) end |
#create_task_comment(id: nil, comment: nil) ⇒ Insightly2::Resources::Comment?
POST /v2.1/Tasks/c_id/Comments Create a comment for a task.
50 51 52 53 54 |
# File 'lib/insightly2/dsl/tasks.rb', line 50 def create_task_comment(id: nil, comment: nil) raise ArgumentError, "ID cannot be blank" if id.blank? raise ArgumentError, "Comment cannot be blank" if comment.blank? Resources::Comment.parse(request(:post, "Tasks/#{id}/Comments", comment)) end |
#delete_task(id: nil) ⇒ Faraday::Response
DELETE /v2.1/Tasks/id Delete a task.
71 72 73 74 |
# File 'lib/insightly2/dsl/tasks.rb', line 71 def delete_task(id: nil) raise ArgumentError, "ID cannot be blank" if id.blank? request(:delete, "Tasks/#{id}") end |
#get_task(id: nil) ⇒ Insightly2::Resources::Task?
GET /v2.1/Tasks/id Get a task.
10 11 12 13 |
# File 'lib/insightly2/dsl/tasks.rb', line 10 def get_task(id: nil) raise ArgumentError, "ID cannot be blank" if id.blank? Resources::Task.parse(request(:get, "Tasks/#{id}")) end |
#get_task_comments(id: nil) ⇒ Array?
GET /v2.1/Tasks/c_id/Comments Get a list of comments for a task.
20 21 22 23 |
# File 'lib/insightly2/dsl/tasks.rb', line 20 def get_task_comments(id: nil) raise ArgumentError, "ID cannot be blank" if id.blank? Resources::Comment.parse(request(:get, "Tasks/#{id}/Comments")) end |
#get_tasks(ids: []) ⇒ Insightly2::Resources::Task?
GET /v2.1/Tasks?ids=ids Get a list of tasks.
29 30 31 32 |
# File 'lib/insightly2/dsl/tasks.rb', line 29 def get_tasks(ids: []) url = Utils::UrlHelper.build_url(path: "Tasks", params: {ids: ids.join(',')}) Resources::Task.parse(request(:get, url)) end |
#update_task(task: nil) ⇒ Insightly2::Resources::Comment?
PUT /v2.1/Tasks Update a task.
61 62 63 64 |
# File 'lib/insightly2/dsl/tasks.rb', line 61 def update_task(task: nil) raise ArgumentError, "Task cannot be blank" if task.blank? Resources::Task.parse(request(:put, "Tasks", task)) end |