Module: ActiveCollab::API::Tasks
- Included in:
- Client
- Defined in:
- lib/active_collab/api/tasks.rb
Instance Method Summary collapse
Instance Method Details
#add_task(project_id, task_options = {}) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/active_collab/api/tasks.rb', line 21 def add_task(project_id, = {}) url = "#{@api_url}?path_info=/projects/#{project_id}/tasks/add&auth_api_token=#{@api_key}" = { body: {task: , submitted: 'submitted'} } response = HTTParty.post(url, ) ActiveCollab::Task.from_hash(response["task"]) end |
#tasks(project_id) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/active_collab/api/tasks.rb', line 7 def tasks(project_id) url = "#{@api_url}?path_info=/projects/#{project_id}/tasks&auth_api_token=#{@api_key}" response = HTTParty.get(url) response_tasks = response["tasks"].first[1] if response_tasks.kind_of?(Hash) tasks = [ActiveCollab::Task.from_hash(response_tasks)] else tasks = response_tasks.collect do |t| ActiveCollab::Task.from_hash(t) end end tasks end |