Class: Projects::Api::TasksAPI

Inherits:
API
  • Object
show all
Includes:
Parser, Util
Defined in:
lib/projects/api/TasksAPI.rb

Overview

  • TasksAPI is used to:

* Get list of tasks.

* Get list of task for the tasklist.

* Get the details of a task.

* Create a new task.

* Update the details of a task.

* Delete an existing task.

Instance Method Summary collapse

Methods inherited from API

#getBaseURL, #getQueryMap

Constructor Details

#initialize(authToken, portalId) ⇒ TasksAPI

  • Construct a new TasksAPI using User’s authToken and portalId.

Parameters

  • authToken

    User’s authToken.

  • portalId
    • User’s portalId.



38
39
40
# File 'lib/projects/api/TasksAPI.rb', line 38

def initialize(authToken,portalId)
	super(authToken,portalId)
end

Instance Method Details

#addComment(projectId, taskId, content) ⇒ Object

  • Add the task comment.

Parameters

  • projectId
    • ID of the project.

  • taskId
    • ID of the task.

  • content
    • Comment of the task

Returns

  • Returns the Comment object.



212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/projects/api/TasksAPI.rb', line 212

def addComment(projectId, taskId, content)

	url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(taskId)+"/comments/"
	
	paramMap = Hash.new
	paramMap["content"] = content
	
	response = ZohoHTTPClient.post(url, getQueryMap, paramMap)
	
	return @taskParser.getComment(response)
	
end

#create(projectId, task) ⇒ Object

  • Create a new task for the project.

Parameters

  • projectId
    • ID of the project.

  • task
    • Task object.

Returns

  • Task object.



110
111
112
113
114
# File 'lib/projects/api/TasksAPI.rb', line 110

def create(projectId, task)
	url = getBaseURL+"projects/"+String(projectId)+"/tasks/"		
	response = ZohoHTTPClient.post(url, getQueryMap, task.toParamMAP)		
	return $taskParser.getTask(response)
end

#delete(projectId, taskId) ⇒ Object

  • Delete an existing task.

Parameters

  • projectId
    • ID of the project.

  • taskId
    • ID of the task.

Returns

  • String object.



146
147
148
149
150
# File 'lib/projects/api/TasksAPI.rb', line 146

def delete(projectId, taskId)
	url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(taskId)+"/"		
	response = ZohoHTTPClient.delete(url, getQueryMap)
	return $taskParser.getResult(response)
end

#deleteComment(projectId, taskId, commentId) ⇒ Object

  • Delete an existing task comment.

Parameters

  • projectId
    • ID of the project.

  • taskId
    • ID of the task.

  • commentId
    • ID of the task Comment.

Returns

  • Returns the success message(Comment Deleted Successfully).



240
241
242
243
244
245
246
247
248
# File 'lib/projects/api/TasksAPI.rb', line 240

def deleteComment(projectId, taskId, commentId)

	url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(taskId)+"/comments/"+String(commentId)+"/"
	
	response = ZohoHTTPClient.delete(url, getQueryMap)
	
	return @taskParser.getResult(response)
	
end

#get(projectId, taskId) ⇒ Object

  • Get the details of a task.

Parameters

  • projectId
    • ID of the project.

  • taskId
    • ID of the task.

Returns

  • Task object.



92
93
94
95
96
# File 'lib/projects/api/TasksAPI.rb', line 92

def get(projectId, taskId)
	url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(taskId)+"/"
	response = ZohoHTTPClient.get(url, getQueryMap)		
	return $taskParser.getTask(response)
end

#getComments(projectId, taskId, queryMap) ⇒ Object

  • Get all the task comment.

Parameters

  • projectId
    • ID of the project.

  • taskId
    • ID of the task.

Returns

  • List of Comment object.



188
189
190
191
192
193
194
195
196
# File 'lib/projects/api/TasksAPI.rb', line 188

def getComments(projectId, taskId, queryMap)

	url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(taskId)+"/comments/"
	
	response = ZohoHTTPClient.get(url, getQueryMap(queryMap))
	
	return @taskParser.getComments(response)
	
end

#getSubtasks(projectId, taskId, queryMap) ⇒ Object



166
167
168
169
170
171
172
173
# File 'lib/projects/api/TasksAPI.rb', line 166

def getSubtasks(projectId, taskId, queryMap)

	url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(taskId)+"/subtasks/"
	
	response = ZohoHTTPClient.get(url, getQueryMap(queryMap))
	
	return @taskParser.getTasks(response)
end

#getTasklistTasks(projectId, tasklistId, queryMap) ⇒ Object

  • Get list of tasks for the task list.

Parameters

  • projectId
    • ID of the project.

  • tasklistId
    • ID of the tasklist.

  • queryMap
    • This queryMap contains the filters in the form of key-value pair.

Returns

  • List Task object.



74
75
76
77
78
# File 'lib/projects/api/TasksAPI.rb', line 74

def getTasklistTasks(projectId, tasklistId, queryMap)
	url = getBaseURL+"projects/"+String(projectId)+"/tasklists/"+String(tasklistId)+"/tasks/"
	response = ZohoHTTPClient.get(url, getQueryMap(queryMap))		
	return $taskParser.getTasks(response)
end

#getTasks(projectId, queryMap) ⇒ Object

  • Get list of tasks for the project.

Parameters

  • projectId
    • ID of the project.

  • queryMap
    • This queryMap contains the filters in the form of key-value pair.

Returns

  • List of Task object.



54
55
56
57
58
# File 'lib/projects/api/TasksAPI.rb', line 54

def getTasks(projectId, queryMap)
	url = getBaseURL+"projects/"+String(projectId)+"/tasks/"
	response = ZohoHTTPClient.get(url, getQueryMap(queryMap))
	return $taskParser.getTasks(response)
end

#update(projectId, task) ⇒ Object

  • Update the details of a task.

Parameters

  • projectId
    • ID of the project.

  • task
    • Task object.

Returns

  • Task object.



128
129
130
131
132
# File 'lib/projects/api/TasksAPI.rb', line 128

def update(projectId, task)
	url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(task.getId())+"/"		
	response = ZohoHTTPClient.post(url, getQueryMap, task.toParamMAP)		
	return $taskParser.getTask(response)
end