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,115 @@
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/EventParser'
8
+
9
+
10
+ # * EventsAPI is used to:
11
+ #
12
+ # * Get list of events.
13
+ #
14
+ # * Add an event.
15
+ #
16
+ # * Update the details of an event.
17
+ #
18
+ # * Delete an existing event.
19
+
20
+
21
+ class EventsAPI < API
22
+ include Projects::Parser
23
+ include Projects::Util
24
+ # * EventParser is used to parse the JSON response into respective objects.
25
+
26
+ $eventParser = EventParser.new
27
+
28
+ # * Construct a new EventsAPI using User's authToken and portalId.
29
+ #
30
+ # ==== Parameters
31
+ #
32
+ # * authToken:: - User's authToken.
33
+ #
34
+ # * portalId:: - User's portalId.
35
+
36
+ def initialize(authToken,portalId)
37
+ super(authToken,portalId)
38
+ end
39
+
40
+ # * Get list of events 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 Event object.
51
+
52
+
53
+ def getEvents(projectId, queryMap)
54
+ url = getBaseURL+"projects/"+String(projectId)+"/events/"
55
+ response = ZohoHTTPClient.get(url, getQueryMap(queryMap))
56
+ return $eventParser.getEvents(response)
57
+ end
58
+
59
+ # * Add an event for the project.
60
+ #
61
+ # ==== Parameters
62
+ #
63
+ # * projectId:: - ID of the project.
64
+ #
65
+ # * event:: - Event object.
66
+ #
67
+ # ==== Returns
68
+ #
69
+ # * Event object.
70
+
71
+
72
+ def add(projectId, event)
73
+ url = getBaseURL+"projects/"+String(projectId)+"/events/"
74
+ response = ZohoHTTPClient.post(url, getQueryMap, event.toParamMAP)
75
+ return $eventParser.getEvent(response)
76
+ end
77
+
78
+ # * Update the details of an event.
79
+ #
80
+ # ==== Parameters
81
+ #
82
+ # * projectId:: - ID of the project.
83
+ #
84
+ # * event:: - Event object.
85
+ #
86
+ # ==== Returns
87
+ #
88
+ # * Event object.
89
+
90
+ def update(projectId, event)
91
+ url = getBaseURL+"projects/"+String(projectId)+"/events/"+String(event.getId)+"/"
92
+ response = ZohoHTTPClient.post(url, getQueryMap, event.toParamMAP)
93
+ return $eventParser.getEvent(response)
94
+ end
95
+
96
+ # * Delete an existing event for the project.
97
+ #
98
+ # ==== Parameters
99
+ #
100
+ # * projectId:: - ID of the project.
101
+ #
102
+ # * eventId:: - ID of the event.
103
+ #
104
+ # ==== Returns
105
+ #
106
+ # * String object.
107
+
108
+ def delete(projectId, eventId)
109
+ url = getBaseURL+"projects/"+String(projectId)+"/events/"+String(eventId)+"/"
110
+ response = ZohoHTTPClient.delete(url, getQueryMap)
111
+ return $eventParser.getResult(response)
112
+ end
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,111 @@
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/FolderParser'
8
+
9
+
10
+ # * FoldersAPI is used to:
11
+ #
12
+ # * Get list of folder.
13
+ #
14
+ # * Add a folder.
15
+ #
16
+ # * Update the details of a folder.
17
+ #
18
+ # * Delete an existing folder.
19
+
20
+
21
+ class FoldersAPI < API
22
+ include Projects::Parser
23
+ include Projects::Util
24
+ # * FolderParser is used to parse the JSON response into respective objects.
25
+
26
+ $folderParser = FolderParser.new
27
+
28
+ # * Construct a new FoldersAPI using User's authToken and portalId.
29
+ #
30
+ # ==== Parameters
31
+ #
32
+ # * authToken:: - User's authToken.
33
+ #
34
+ # * portalId:: - User's portalId.
35
+
36
+ def initialize(authToken,portalId)
37
+ super(authToken,portalId)
38
+ end
39
+
40
+ # * Get list of folders for the project.
41
+ #
42
+ # ==== Parameters
43
+ #
44
+ # * projectId:: - ID of the project.
45
+ #
46
+ # ===== Returns
47
+ #
48
+ # * List of Folder object.
49
+
50
+ def getFolders(projectId)
51
+ url = getBaseURL+"projects/"+String(projectId)+"/folders/"
52
+ response = ZohoHTTPClient.get(url, getQueryMap)
53
+ return $folderParser.getFolders(response)
54
+ end
55
+
56
+ # * Add a folder for the project.
57
+ #
58
+ # ==== Parameters
59
+ #
60
+ # * projectId:: - ID of the project.
61
+ #
62
+ # * folder:: - Folder object.
63
+ #
64
+ # ===== Returns
65
+ #
66
+ # * Folder object.
67
+
68
+ def addFolder(projectId, folder)
69
+ url = getBaseURL+"projects/"+String(projectId)+"/folders/"
70
+ response = ZohoHTTPClient.post(url, getQueryMap, folder.toParamMAP)
71
+ return $folderParser.getFolder(response)
72
+ end
73
+
74
+ # * Update the details of a folder.
75
+ #
76
+ # ==== Parameters
77
+ #
78
+ # * projectId:: - ID of the project.
79
+ #
80
+ # * folder:: - Folder object.
81
+ #
82
+ # ===== Returns
83
+ #
84
+ # * Folder object.
85
+
86
+ def updateFolder(projectId, folder)
87
+ url = getBaseURL+"projects/"+String(projectId)+"/folders/"+String(folder.getId)+"/"
88
+ response = ZohoHTTPClient.post(url, getQueryMap, folder.toParamMAP)
89
+ return $folderParser.getFolder(response)
90
+ end
91
+
92
+ # * Delete an existing folder for the project.
93
+ #
94
+ # ==== Parameters
95
+ #
96
+ # * projectId:: - ID of the project.
97
+ #
98
+ # * folderId:: - ID of the folder.
99
+ #
100
+ # ==== Returns
101
+ #
102
+ # * String object.
103
+
104
+ def deleteFolder(projectId, folderId)
105
+ url = getBaseURL+"projects/"+String(projectId)+"/folders/"+String(folderId)+"/"
106
+ response = ZohoHTTPClient.delete(url, getQueryMap)
107
+ return $folderParser.getResult(response)
108
+ end
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,198 @@
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/ForumParser'
8
+
9
+ # * ForumsAPI is used to:
10
+ #
11
+ # * Get list of forums.
12
+ #
13
+ # * Add a forum.
14
+ #
15
+ # * Update the details of a forum.
16
+ #
17
+ # * Delete an existing forum.
18
+ #
19
+ # * Get list of categories.
20
+ #
21
+ # * Add a category.
22
+ #
23
+ # * Get list of comments.
24
+ #
25
+ # * Add a comment.
26
+
27
+ class ForumsAPI < API
28
+ include Projects::Parser
29
+ include Projects::Util
30
+ # * ForumParser is used to parse the JSON response into respective objects.
31
+
32
+ $forumParser = ForumParser.new
33
+
34
+ # * Construct a new FoumsAPI using User's authToken and portalId.
35
+ #
36
+ # ==== Parameters
37
+ #
38
+ # * authToken:: - User's authToken.
39
+ #
40
+ # * portalId:: - User's prtalId.
41
+
42
+ def initialize(authToken,portalId)
43
+ super(authToken,portalId)
44
+ end
45
+
46
+ # * Get list of forum for the project.
47
+ #
48
+ # ==== Parameters
49
+ # * projectId:: - ID of the project.
50
+ #
51
+ # * queryMap:: - This queryMap contains the filters in the form of key-value pair.
52
+ #
53
+ # ==== Returns
54
+ #
55
+ # * List of Forum object.
56
+
57
+
58
+ def getForums(projectId, queryMap)
59
+ url = getBaseURL+"projects/"+String(projectId)+"/forums/"
60
+ response = ZohoHTTPClient.get(url, getQueryMap(queryMap))
61
+ return $forumParser.getForums(response)
62
+ end
63
+
64
+ # * Add a forum for the project.
65
+ #
66
+ # ==== Parameters
67
+ #
68
+ # * projectId:: - ID of the project.
69
+ #
70
+ # * forum:: - Forum object.
71
+ #
72
+ # ==== Returns
73
+ #
74
+ # * Forum object.
75
+
76
+
77
+ def add(projectId, forum)
78
+ url = getBaseURL+"projects/"+String(projectId)+"/forums/"
79
+ fileBody = Hash.new
80
+ fileBody["uploadfile"] = forum.getUploadfile
81
+ response = ZohoHTTPClient.post(url, getQueryMap, forum.toParamMAP, fileBody)
82
+ return $forumParser.getForum(response)
83
+ end
84
+
85
+ # * update the details of a forum.
86
+ #
87
+ # ==== Parameters
88
+ #
89
+ # * projectId:: - ID of the project.
90
+ #
91
+ # * forum:: - Forum object.
92
+ #
93
+ # ==== Returns
94
+ #
95
+ # * Forum object.
96
+
97
+ def update(projectId, forum)
98
+ url = getBaseURL+"projects/"+String(projectId)+"/forums/"+String(forum.getId)+"/"
99
+ fileBody = Hash.new
100
+ fileBody["uploadfile"] = forum.getUploadfile
101
+ response = ZohoHTTPClient.post(url, getQueryMap, forum.toParamMAP, fileBody)
102
+ return $forumParser.getForum(response)
103
+ end
104
+
105
+ # * Delete an existing forum for the project.
106
+ #
107
+ # ==== Parameters
108
+ #
109
+ # * projectId:: - ID of the project.
110
+ #
111
+ # * forumId:: - ID of the forum.
112
+ #
113
+ # ==== Returns
114
+ #
115
+ # * String object.
116
+
117
+ def delete(projectId, forumId)
118
+ url = getBaseURL+"projects/"+String(projectId)+"/forums/"+String(forumId)+"/"
119
+ response = ZohoHTTPClient.delete(url, getQueryMap)
120
+ return $forumParser.getResult(response)
121
+ end
122
+
123
+ # * Get list of categories for the project.
124
+ #
125
+ # ==== Parameters
126
+ #
127
+ # * projectId:: - ID of the project.
128
+ #
129
+ # ==== Returns
130
+ #
131
+ # * List of Category object.
132
+
133
+ def getCategories(projectId)
134
+ url = getBaseURL+"projects/"+String(projectId)+"/categories/"
135
+ response = ZohoHTTPClient.get(url, getQueryMap)
136
+ return $forumParser.getCategories(response)
137
+ end
138
+
139
+ # * Add a category for the project.
140
+ #
141
+ # ==== Parameters
142
+ #
143
+ # * projectId:: - ID of the project.
144
+ #
145
+ # * category:: - Category object.
146
+ #
147
+ # ==== Returns
148
+ #
149
+ # * Category object.
150
+
151
+ def addCategory(projectId, category)
152
+ url = getBaseURL+"projects/"+String(projectId)+"/categories/"
153
+ response = ZohoHTTPClient.post(url, getQueryMap, category.toParamMAP)
154
+ return $forumParser.getCategory(response)
155
+ end
156
+
157
+ # * Get list of Comment for the forum.
158
+ #
159
+ # ==== Parameters
160
+ #
161
+ # * projectId:: - ID of the project.
162
+ #
163
+ # * forumId:: - ID of the forum.
164
+ #
165
+ # * queryMap:: - This queryMap contains the filters in the form of key-value pair.
166
+ #
167
+ # ==== Returns
168
+ #
169
+ # * List of Comment object.
170
+
171
+ def getComments(projectId, forumId, queryMap)
172
+ url = getBaseURL+"projects/"+String(projectId)+"/forums/"+String(forumId)+"/comments/"
173
+ response = ZohoHTTPClient.get(url, getQueryMap(queryMap))
174
+ return $forumParser.getComments(response)
175
+ end
176
+
177
+ # * Add comment for the forum.
178
+ #
179
+ # ==== Parameters
180
+ #
181
+ # * projectId:: - ID of the project.
182
+ #
183
+ # * forumId:: - ID of the forum.
184
+ #
185
+ # * comment:: - Comment object.
186
+ #
187
+ # ==== Returns
188
+ #
189
+ # * Comment object.
190
+
191
+ def addComment(projectId, forumId, comment)
192
+ url = getBaseURL+"projects/"+String(projectId)+"/forums/"+String(forumId)+"/comments/"
193
+ response = ZohoHTTPClient.post(url, getQueryMap, comment.toParamMAP)
194
+ return $forumParser.getComment(response)
195
+ end
196
+ end
197
+ end
198
+ end
@@ -0,0 +1,159 @@
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/MilestonesParser'
8
+
9
+
10
+ # * MilestonesAPI is used to:
11
+ #
12
+ # * Get list of milestones.
13
+ #
14
+ # * Get the details of a milestone.
15
+ #
16
+ # * Create a new milestone.
17
+ #
18
+ # * Update the details of a milestone.
19
+ #
20
+ # * Update the status of a milestone.
21
+ #
22
+ # * Delete an existing milestone.
23
+
24
+
25
+ class MilestonesAPI < API
26
+ include Projects::Parser
27
+ include Projects::Util
28
+ # MilestoneParser is used to parse the JSON response into respective objects.
29
+
30
+ $milestonesParser = MilestonesParser.new
31
+
32
+ # * Construct a new MilestonesAPI using User's authToken and portalId.
33
+ #
34
+ # ==== Parameters
35
+ #
36
+ # * authToken:: - User's authToken.
37
+ #
38
+ # * portalId:: - User's portalId.
39
+
40
+ def initialize(authToken,portalId)
41
+ super(authToken,portalId)
42
+ end
43
+
44
+ # * Get list of milestones for the project.
45
+ #
46
+ # ==== Parameters
47
+ #
48
+ # * projectId:: - ID of the project.
49
+ #
50
+ # * queryMap:: - This queryMap contains the filters in the form of key-value pair.
51
+ #
52
+ # ==== Returns
53
+ #
54
+ # * List of Milestone object.
55
+
56
+ def getMilestones(projectId, * queryMap)
57
+ url = getBaseURL+"projects/"+String(projectId)+"/milestones/"
58
+ if queryMap.length == 0
59
+ response = ZohoHTTPClient.get(url, getQueryMap)
60
+ else
61
+ response = ZohoHTTPClient.get(url, getQueryMap(queryMap))
62
+ end
63
+ return $milestonesParser.getMilestones(response)
64
+ end
65
+
66
+ # * Get the details of a milestone.
67
+ #
68
+ # ==== Parameters
69
+ #
70
+ # * projectId:: - ID of the project.
71
+ #
72
+ # * milestoneId:: - ID of the milestone.
73
+ #
74
+ # ==== Returns
75
+ #
76
+ # * Milestone object.
77
+
78
+ def get(projectId,milestoneId)
79
+ url = getBaseURL+"projects/"+String(projectId)+"/milestones/"+String(milestoneId)+"/"
80
+ response = ZohoHTTPClient.get(url, getQueryMap)
81
+ return $milestonesParser.getMilestone(response)
82
+ end
83
+
84
+ # * Create a milestone for the project.
85
+ #
86
+ # ==== Parameters
87
+ #
88
+ # * projectId:: - ID of the project.
89
+ #
90
+ # * milestone:: - Milestone object.
91
+ #
92
+ # ==== Returns
93
+ # * Milestone object.
94
+
95
+ def create(projectId,milestone)
96
+ url = getBaseURL+"projects/"+String(projectId)+"/milestones/"
97
+ response = ZohoHTTPClient.post(url, getQueryMap, milestone.toParamMAP())
98
+ return $milestonesParser.getMilestone(response)
99
+ end
100
+
101
+ # * Update the details of a milestone.
102
+ #
103
+ # ==== Parameters
104
+ #
105
+ # * projectId:: - ID of the project.
106
+ #
107
+ # * milestone:: - Milestone object.
108
+ #
109
+ # ==== Returns
110
+ # * Milestone object.
111
+
112
+ def update(projectId,milestone)
113
+ url = getBaseURL+"projects/"+String(projectId)+"/milestones/"+String(milestone.getId)+"/"
114
+ response = ZohoHTTPClient.post(url, getQueryMap, milestone.toParamMAP())
115
+ return $milestonesParser.getMilestone(response)
116
+ end
117
+
118
+ # * Update the status of a milestone.
119
+ #
120
+ # ==== Parameters
121
+ #
122
+ # * projectId:: - ID of the project.
123
+ #
124
+ # * milestoneId:: - ID of the milestone.
125
+ #
126
+ # * status:: - Status of the milestone.
127
+ #
128
+ # ==== Returns
129
+ #
130
+ # * Milestone object.
131
+
132
+ def updateStatus(projectId,milestoneId,status)
133
+ url = getBaseURL+"projects/"+String(projectId)+"/milestones/"+String(milestoneId)+"/status/"
134
+ requestBody = Hash.new()
135
+ requestBody["status"] = status
136
+ response = ZohoHTTPClient.post(url, getQueryMap, requestBody)
137
+ return $milestonesParser.getMilestone(response)
138
+ end
139
+
140
+ # * Delete an existing milestone for the project.
141
+ #
142
+ # ==== Parameters
143
+ #
144
+ # * projectId:: - ID of the project.
145
+ #
146
+ # * milestoneId:: - ID of the milestone.
147
+ #
148
+ # ==== Returns
149
+ #
150
+ # * String object.
151
+
152
+ def delete(projectId,milestoneId)
153
+ url = getBaseURL+"projects/"+String(projectId)+"/milestones/"+String(milestoneId)+"/"
154
+ response = ZohoHTTPClient.delete(url, getQueryMap)
155
+ return $milestonesParser.getResult(response)
156
+ end
157
+ end
158
+ end
159
+ end