Module: ActiveCollab::API::Tasks

Included in:
Client
Defined in:
lib/active_collab/api/tasks.rb

Instance Method Summary collapse

Instance Method Details

#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