zohoProjects 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +15 -0
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +17 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +145 -0
  6. data/Rakefile +2 -0
  7. data/lib/projects/api/API.rb +57 -0
  8. data/lib/projects/api/BugsAPI.rb +135 -0
  9. data/lib/projects/api/DocumentsAPI.rb +145 -0
  10. data/lib/projects/api/EventsAPI.rb +115 -0
  11. data/lib/projects/api/FoldersAPI.rb +111 -0
  12. data/lib/projects/api/ForumsAPI.rb +198 -0
  13. data/lib/projects/api/MilestonesAPI.rb +159 -0
  14. data/lib/projects/api/PortalAPI.rb +41 -0
  15. data/lib/projects/api/ProjectsAPI.rb +203 -0
  16. data/lib/projects/api/TasklistsAPI.rb +113 -0
  17. data/lib/projects/api/TasksAPI.rb +153 -0
  18. data/lib/projects/api/TimesheetsAPI.rb +240 -0
  19. data/lib/projects/api/UsersAPI.rb +48 -0
  20. data/lib/projects/exception/ProjectsException.rb +50 -0
  21. data/lib/projects/model/Activity.rb +173 -0
  22. data/lib/projects/model/Bug.rb +701 -0
  23. data/lib/projects/model/Buglog.rb +56 -0
  24. data/lib/projects/model/Category.rb +70 -0
  25. data/lib/projects/model/Comment.rb +289 -0
  26. data/lib/projects/model/Document.rb +260 -0
  27. data/lib/projects/model/Event.rb +391 -0
  28. data/lib/projects/model/Folder.rb +110 -0
  29. data/lib/projects/model/Forum.rb +320 -0
  30. data/lib/projects/model/Generallog.rb +36 -0
  31. data/lib/projects/model/Log.rb +359 -0
  32. data/lib/projects/model/Milestone.rb +322 -0
  33. data/lib/projects/model/Owner.rb +54 -0
  34. data/lib/projects/model/Participant.rb +54 -0
  35. data/lib/projects/model/Portal.rb +273 -0
  36. data/lib/projects/model/Project.rb +593 -0
  37. data/lib/projects/model/Status.rb +168 -0
  38. data/lib/projects/model/Task.rb +497 -0
  39. data/lib/projects/model/Tasklist.rb +300 -0
  40. data/lib/projects/model/Tasklog.rb +56 -0
  41. data/lib/projects/model/Timelog.rb +134 -0
  42. data/lib/projects/model/TimelogList.rb +54 -0
  43. data/lib/projects/model/User.rb +94 -0
  44. data/lib/projects/model/Version.rb +194 -0
  45. data/lib/projects/parser/BugParser.rb +208 -0
  46. data/lib/projects/parser/DocumentParser.rb +197 -0
  47. data/lib/projects/parser/EventParser.rb +156 -0
  48. data/lib/projects/parser/FolderParser.rb +99 -0
  49. data/lib/projects/parser/ForumParser.rb +253 -0
  50. data/lib/projects/parser/MilestonesParser.rb +129 -0
  51. data/lib/projects/parser/PortalParser.rb +103 -0
  52. data/lib/projects/parser/ProjectParser.rb +318 -0
  53. data/lib/projects/parser/TaskParser.rb +293 -0
  54. data/lib/projects/parser/TasklistParser.rb +127 -0
  55. data/lib/projects/parser/TimesheetParser.rb +390 -0
  56. data/lib/projects/parser/UserParser.rb +63 -0
  57. data/lib/projects/service/ZohoProject.rb +174 -0
  58. data/lib/projects/util/ZohoHTTPClient.rb +205 -0
  59. data/lib/test/ProjectsTest.rb +321 -0
  60. data/lib/zohoProjects.rb +35 -0
  61. data/lib/zohoProjects/version.rb +3 -0
  62. data/zohoProjects.gemspec +86 -0
  63. metadata +135 -0
@@ -0,0 +1,41 @@
1
+ # $Id$
2
+ module Projects
3
+ module Api
4
+
5
+ require File.dirname(__FILE__).chomp("/projects/api") + '/projects/api/API'
6
+ require File.dirname(__FILE__).chomp("/projects/api") +'/projects/util/ZohoHTTPClient'
7
+ require File.dirname(__FILE__).chomp("/projects/api") +'/projects/parser/PortalParser'
8
+ require File.dirname(__FILE__).chomp("/projects/api") +'/projects/exception/ProjectsException'
9
+
10
+
11
+ # * PortalsAPI is used to get list of portals.
12
+
13
+ class PortalAPI < API
14
+ include Projects::Parser
15
+ include Projects::Util
16
+ # * Construct a new PortalsAPI using User's authTken.
17
+ #
18
+ # ==== Parameters
19
+ #
20
+ # * authToken:: - User's authToken.
21
+
22
+ def initialize(authToken)
23
+ super(authToken,"")
24
+ end
25
+
26
+ # * Parse the JSON response into respective objects.
27
+ #
28
+ # * Get list of portals.
29
+ #
30
+ # ==== Returns
31
+ #
32
+ # * List of Portal object.
33
+
34
+ def getPortals
35
+ portalParser = PortalParser.new
36
+ url = @@baseURL+'portals/'
37
+ return portalParser.getPortals(ZohoHTTPClient.get(url,getQueryMap))
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,203 @@
1
+ # $Id$
2
+ module Projects
3
+ module Api
4
+
5
+
6
+ require File.dirname(__FILE__).chomp("/projects/api") + '/projects/api/API'
7
+ require File.dirname(__FILE__).chomp("/projects/api") + '/projects/util/ZohoHTTPClient'
8
+ require File.dirname(__FILE__).chomp("/projects/api") + '/projects/parser/ProjectParser'
9
+ #require_relative 'API'
10
+
11
+ # * ProjectsAPI is used to:
12
+ #
13
+ # * Get list of projects.
14
+ #
15
+ # * Get the details of a project.
16
+ #
17
+ # * Create a new project.
18
+ #
19
+ # * Update the details of a project.
20
+ #
21
+ # * Delete an existing project.
22
+
23
+ class ProjectsAPI < API
24
+ include Projects::Parser
25
+ include Projects::Util
26
+
27
+ # Parse the JSON response into respective objects.
28
+
29
+ $projectParser = ProjectParser.new
30
+
31
+ # * Construct a new ProjectsAPI using User's authToken and portalId.
32
+ #
33
+ # ==== Parameters
34
+ #
35
+ # * authToken:: - User's authToken.
36
+ #
37
+ # * portalId:: - User's portalId.
38
+
39
+ def initialize(authToken,portalId)
40
+ super(authToken,portalId)
41
+ end
42
+
43
+ # * Get the genearal url for getting all Projects.
44
+ #
45
+ # ==== Returns
46
+ #
47
+ # String Object
48
+
49
+ def getProjectsUrl
50
+ return getBaseURL+'projects/'
51
+ end
52
+
53
+ # * Get specific Project url by specifying the projectId.
54
+ #
55
+ # ==== Returns
56
+ #
57
+ # String Object
58
+
59
+ def getProjectUrl(projectId)
60
+ return getBaseURL+'projects/'+String(projectId)+'/'
61
+ end
62
+
63
+ # * Get list of projects.
64
+ #
65
+ # ==== Parameters
66
+ #
67
+ # * queryMap:: - This queryMap contains the filters in the form of key-value pair.
68
+ #
69
+ # ==== Returns
70
+ #
71
+ # * List of Project object.
72
+
73
+
74
+ def getProjects(queryMap=nil)
75
+ if queryMap == nil
76
+ return $projectParser.getProjects(ZohoHTTPClient.get(getProjectsUrl,getQueryMap))
77
+ else
78
+ return $projectParser.getProjects(ZohoHTTPClient.get(getProjectsUrl,getQueryMap(queryMap)))
79
+ end
80
+ end
81
+
82
+ # * Create a new project.
83
+ #
84
+ # ==== Parameters
85
+ #
86
+ # * project:: - Project object.
87
+ #
88
+ # ==== Returns
89
+ #
90
+ # * Project object.
91
+
92
+ def createProject(project)
93
+ createProject = ZohoHTTPClient.post(getProjectsUrl,getQueryMap, project.toParamMAP)
94
+ return $projectParser.getProject(createProject)
95
+ end
96
+
97
+ # * Get the details of a project.
98
+ #
99
+ # ==== Parameters
100
+ #
101
+ # * projectId:: - ID of the project.
102
+ #
103
+ # ==== Returns
104
+ #
105
+ # * Project object.
106
+
107
+ def get(projectId)
108
+ response = ZohoHTTPClient.get(getProjectUrl(projectId),getQueryMap)
109
+ return $projectParser.getProject(response)
110
+ end
111
+
112
+ # * Update the details of a project.
113
+ #
114
+ # ==== Parameters
115
+ #
116
+ # * project:: - Project object.
117
+ #
118
+ # ==== Returns
119
+ #
120
+ # * Project object.
121
+
122
+ def updateProject(project)
123
+ updateProject = ZohoHTTPClient.post(getProjectUrl(project.getId),getQueryMap, project.toParamMAP)
124
+ return $projectParser.getProject(updateProject)
125
+ end
126
+
127
+ # * Delete an existing project.
128
+ #
129
+ # ==== Parameters
130
+ #
131
+ # * projectId:: - ID of the project.
132
+ #
133
+ # ==== Returns
134
+ #
135
+ # * String object.
136
+
137
+ def deleteProject(projectId)
138
+ response = ZohoHTTPClient.delete(getProjectUrl(projectId),getQueryMap)
139
+ return $projectParser.getResult(response)
140
+ end
141
+
142
+ # * Get list of project activities.
143
+ #
144
+ # ==== Parameters
145
+ #
146
+ # * projectId:: - ID of the project.
147
+ #
148
+ # * queryMap:: - This queryMap contains the filters in the form of key-value pair.
149
+ #
150
+ # ==== Returns
151
+ #
152
+ # * List of Activity object.
153
+
154
+ def getProjectActivities(projectId, queryMap=nil)
155
+ url = getProjectUrl(projectId)+"activities/"
156
+ if queryMap == nil
157
+ return $projectParser.getActivities(ZohoHTTPClient.get(url, getQueryMap))
158
+ else
159
+ return $projectParser.getActivities(ZohoHTTPClient.get(url, getQueryMap(queryMap)))
160
+ end
161
+ end
162
+
163
+ # * Get list of project statuses.
164
+ #
165
+ # ==== Parameters
166
+ #
167
+ # * projectId:: - ID of the project.
168
+ #
169
+ # * queryMap:: - This queryMap contains the filters in the form of key-value pair.
170
+ #
171
+ # ==== Returns
172
+ #
173
+ # * List of Status object.
174
+
175
+ def getProjectStatuses(projectId,queryMap=nil)
176
+ url = getProjectUrl(projectId)+"statuses/"
177
+ if queryMap == nil
178
+ return $projectParser.getStatuses(ZohoHTTPClient.get(url, getQueryMap))
179
+ else
180
+ return $projectParser.getStatuses(ZohoHTTPClient.get(url, getQueryMap(queryMap)))
181
+ end
182
+ end
183
+
184
+ # * Add the status for the project.
185
+ #
186
+ # ==== Parameters
187
+ #
188
+ # * projectId:: - ID of the project.
189
+ #
190
+ # * status:: - Status object.
191
+ #
192
+ # ==== Returns
193
+ #
194
+ # * Status object.
195
+
196
+ def addProjectStatus(projectId,status)
197
+ url = getProjectUrl(projectId)+"statuses/"
198
+ return $projectParser.getStatus(ZohoHTTPClient.post(url, getQueryMap, status.toParamMAP));
199
+ end
200
+
201
+ end
202
+ end
203
+ end
@@ -0,0 +1,113 @@
1
+ # $Id$
2
+ module Projects
3
+ module Api
4
+
5
+ require File.dirname(__FILE__).chomp("/projects/api") + '/projects/api/API'
6
+ require File.dirname(__FILE__).chomp("/projects/api") + '/projects/util/ZohoHTTPClient'
7
+ require File.dirname(__FILE__).chomp("/projects/api") + '/projects/parser/TasklistParser'
8
+
9
+ # * TasklistsAPI is used to:
10
+ #
11
+ # * Get list of tasklists.
12
+ #
13
+ # * Create a new tasklist.
14
+ #
15
+ # * Update the details of a tasklist.
16
+ #
17
+ # * Delete an existing tasklist.
18
+
19
+
20
+ class TasklistsAPI < API
21
+ include Projects::Parser
22
+ include Projects::Util
23
+ # TasklistParser is used to parse the JSON response into respective objects.
24
+
25
+ $tasklistParser = TasklistParser.new
26
+
27
+ # * Construct a new TasklistsAPI using User's authToken and portalId.
28
+ #
29
+ # ==== Parameters
30
+ #
31
+ # * authToken:: - User's authToken.
32
+ #
33
+ # * portalId:: - User's portalId.
34
+
35
+
36
+ def initialize(authToken,portalId)
37
+ super(authToken,portalId)
38
+ end
39
+
40
+ # * Get list of tasklists for the project.
41
+ #
42
+ # ==== Parameters
43
+ #
44
+ # * projectId:: - ID of the project.
45
+ #
46
+ # * queryMap:: - This queryMap contains the filters in the form of key-value pair.
47
+ #
48
+ # ==== Returns
49
+ #
50
+ # * List of Tasklist object.
51
+
52
+ def getTasklists(projectId,queryMap)
53
+ url = getBaseURL+"projects/"+String(projectId)+"/tasklists/"
54
+ response = ZohoHTTPClient.get(url, getQueryMap(queryMap))
55
+ return $tasklistParser.getTasklists(response)
56
+ end
57
+
58
+ # * Create a new tasklist for the project.
59
+ #
60
+ # ==== Parameters
61
+ #
62
+ # * projectId:: - ID of the project.
63
+ #
64
+ # * tasklist:: - tasklist object.
65
+ #
66
+ # ==== Returns
67
+ #
68
+ # * Tasklist object.
69
+
70
+ def create(projectId,tasklist)
71
+ url = getBaseURL+"projects/"+String(projectId)+"/tasklists/"
72
+ response = ZohoHTTPClient.post(url, getQueryMap, tasklist.toParamMAP)
73
+ return $tasklistParser.getTasklist(response)
74
+ end
75
+
76
+ # * Update the details of a tasklist.
77
+ #
78
+ # ==== Parameters
79
+ #
80
+ # * projectId:: - ID of the project.
81
+ #
82
+ # * tasklist:: - Tasklist object.
83
+ #
84
+ # ==== Returns
85
+ #
86
+ # * Tasklist object.
87
+
88
+ def update(projectId,tasklist)
89
+ url = getBaseURL+"projects/"+String(projectId)+"/tasklists/"+String(tasklist.getId)+"/"
90
+ response = ZohoHTTPClient.post(url, getQueryMap, tasklist.toParamMAP)
91
+ return $tasklistParser.getTasklist(response)
92
+ end
93
+
94
+ # * Delete an existing tasklist for the project.
95
+ #
96
+ # ==== Parameters
97
+ #
98
+ # * projectId:: - ID of the project.
99
+ #
100
+ # * tasklistId:: - ID of the tasklist.
101
+ #
102
+ # ==== Returns
103
+ #
104
+ # * String object.
105
+
106
+ def delete(projectId, tasklistId)
107
+ url = getBaseURL+"projects/"+String(projectId)+"/tasklists/"+String(tasklistId)+"/"
108
+ response = ZohoHTTPClient.delete(url, getQueryMap)
109
+ return $tasklistParser.getResult(response)
110
+ end
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,153 @@
1
+ # $Id$
2
+ module Projects
3
+ module Api
4
+
5
+ require File.dirname(__FILE__).chomp("/projects/api") + '/projects/api/API'
6
+ require File.dirname(__FILE__).chomp("/projects/api") + '/projects/util/ZohoHTTPClient'
7
+ require File.dirname(__FILE__).chomp("/projects/api") + '/projects/parser/TaskParser'
8
+
9
+ # * TasksAPI is used to:
10
+ #
11
+ # * Get list of tasks.
12
+ #
13
+ # * Get list of task for the tasklist.
14
+ #
15
+ # * Get the details of a task.
16
+ #
17
+ # * Create a new task.
18
+ #
19
+ # * Update the details of a task.
20
+ #
21
+ # * Delete an existing task.
22
+
23
+ class TasksAPI < API
24
+ include Projects::Parser
25
+ include Projects::Util
26
+ # TaskParser is used to parse the JSON response into respective objects.
27
+
28
+ $taskParser = Projects::Parser::TaskParser.new
29
+
30
+ # * Construct a new TasksAPI using User's authToken and portalId.
31
+ #
32
+ # ==== Parameters
33
+ #
34
+ # * authToken:: User's authToken.
35
+ #
36
+ # * portalId:: - User's portalId.
37
+
38
+ def initialize(authToken,portalId)
39
+ super(authToken,portalId)
40
+ end
41
+
42
+ # * Get list of tasks for the project.
43
+ #
44
+ # ==== Parameters
45
+ #
46
+ # * projectId:: - ID of the project.
47
+ #
48
+ # * queryMap:: - This queryMap contains the filters in the form of key-value pair.
49
+ #
50
+ # ==== Returns
51
+ #
52
+ # * List of Task object.
53
+
54
+ def getTasks(projectId, queryMap)
55
+ url = getBaseURL+"projects/"+String(projectId)+"/tasks/"
56
+ response = ZohoHTTPClient.get(url, getQueryMap(queryMap))
57
+ return $taskParser.getTasks(response)
58
+ end
59
+
60
+ # * Get list of tasks for the task list.
61
+ #
62
+ # ==== Parameters
63
+ #
64
+ # * projectId:: - ID of the project.
65
+ #
66
+ # * tasklistId:: - ID of the tasklist.
67
+ #
68
+ # * queryMap:: - This queryMap contains the filters in the form of key-value pair.
69
+ #
70
+ # ==== Returns
71
+ #
72
+ # * List Task object.
73
+
74
+ def getTasklistTasks(projectId, tasklistId, queryMap)
75
+ url = getBaseURL+"projects/"+String(projectId)+"/tasklists/"+String(tasklistId)+"/tasks/"
76
+ response = ZohoHTTPClient.get(url, getQueryMap(queryMap))
77
+ return $taskParser.getTasks(response)
78
+ end
79
+
80
+ # * Get the details of a task.
81
+ #
82
+ # ==== Parameters
83
+ #
84
+ # * projectId:: - ID of the project.
85
+ #
86
+ # * taskId:: - ID of the task.
87
+ #
88
+ # ==== Returns
89
+ #
90
+ # * Task object.
91
+
92
+ def get(projectId, taskId)
93
+ url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(taskId)+"/"
94
+ response = ZohoHTTPClient.get(url, getQueryMap)
95
+ return $taskParser.getTask(response)
96
+ end
97
+
98
+ # * Create a new task for the project.
99
+ #
100
+ # ==== Parameters
101
+ #
102
+ # * projectId:: - ID of the project.
103
+ #
104
+ # * task:: - Task object.
105
+ #
106
+ # ==== Returns
107
+ #
108
+ # * Task object.
109
+
110
+ def create(projectId, task)
111
+ url = getBaseURL+"projects/"+String(projectId)+"/tasks/"
112
+ response = ZohoHTTPClient.post(url, getQueryMap, task.toParamMAP)
113
+ return $taskParser.getTask(response)
114
+ end
115
+
116
+ # * Update the details of a task.
117
+ #
118
+ # ==== Parameters
119
+ #
120
+ # * projectId:: - ID of the project.
121
+ #
122
+ # * task:: - Task object.
123
+ #
124
+ # ==== Returns
125
+ #
126
+ # * Task object.
127
+
128
+ def update(projectId, task)
129
+ url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(task.getId())+"/"
130
+ response = ZohoHTTPClient.post(url, getQueryMap, task.toParamMAP)
131
+ return $taskParser.getTask(response)
132
+ end
133
+
134
+ # * Delete an existing task.
135
+ #
136
+ # ==== Parameters
137
+ #
138
+ # * projectId:: - ID of the project.
139
+ #
140
+ # * taskId:: - ID of the task.
141
+ #
142
+ # ==== Returns
143
+ #
144
+ # * String object.
145
+
146
+ def delete(projectId, taskId)
147
+ url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(taskId)+"/"
148
+ response = ZohoHTTPClient.delete(url, getQueryMap)
149
+ return $taskParser.getResult(response)
150
+ end
151
+ end
152
+ end
153
+ end