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.
- checksums.yaml +15 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +17 -0
- data/LICENSE.txt +22 -0
- data/README.md +145 -0
- data/Rakefile +2 -0
- data/lib/projects/api/API.rb +57 -0
- data/lib/projects/api/BugsAPI.rb +135 -0
- data/lib/projects/api/DocumentsAPI.rb +145 -0
- data/lib/projects/api/EventsAPI.rb +115 -0
- data/lib/projects/api/FoldersAPI.rb +111 -0
- data/lib/projects/api/ForumsAPI.rb +198 -0
- data/lib/projects/api/MilestonesAPI.rb +159 -0
- data/lib/projects/api/PortalAPI.rb +41 -0
- data/lib/projects/api/ProjectsAPI.rb +203 -0
- data/lib/projects/api/TasklistsAPI.rb +113 -0
- data/lib/projects/api/TasksAPI.rb +153 -0
- data/lib/projects/api/TimesheetsAPI.rb +240 -0
- data/lib/projects/api/UsersAPI.rb +48 -0
- data/lib/projects/exception/ProjectsException.rb +50 -0
- data/lib/projects/model/Activity.rb +173 -0
- data/lib/projects/model/Bug.rb +701 -0
- data/lib/projects/model/Buglog.rb +56 -0
- data/lib/projects/model/Category.rb +70 -0
- data/lib/projects/model/Comment.rb +289 -0
- data/lib/projects/model/Document.rb +260 -0
- data/lib/projects/model/Event.rb +391 -0
- data/lib/projects/model/Folder.rb +110 -0
- data/lib/projects/model/Forum.rb +320 -0
- data/lib/projects/model/Generallog.rb +36 -0
- data/lib/projects/model/Log.rb +359 -0
- data/lib/projects/model/Milestone.rb +322 -0
- data/lib/projects/model/Owner.rb +54 -0
- data/lib/projects/model/Participant.rb +54 -0
- data/lib/projects/model/Portal.rb +273 -0
- data/lib/projects/model/Project.rb +593 -0
- data/lib/projects/model/Status.rb +168 -0
- data/lib/projects/model/Task.rb +497 -0
- data/lib/projects/model/Tasklist.rb +300 -0
- data/lib/projects/model/Tasklog.rb +56 -0
- data/lib/projects/model/Timelog.rb +134 -0
- data/lib/projects/model/TimelogList.rb +54 -0
- data/lib/projects/model/User.rb +94 -0
- data/lib/projects/model/Version.rb +194 -0
- data/lib/projects/parser/BugParser.rb +208 -0
- data/lib/projects/parser/DocumentParser.rb +197 -0
- data/lib/projects/parser/EventParser.rb +156 -0
- data/lib/projects/parser/FolderParser.rb +99 -0
- data/lib/projects/parser/ForumParser.rb +253 -0
- data/lib/projects/parser/MilestonesParser.rb +129 -0
- data/lib/projects/parser/PortalParser.rb +103 -0
- data/lib/projects/parser/ProjectParser.rb +318 -0
- data/lib/projects/parser/TaskParser.rb +293 -0
- data/lib/projects/parser/TasklistParser.rb +127 -0
- data/lib/projects/parser/TimesheetParser.rb +390 -0
- data/lib/projects/parser/UserParser.rb +63 -0
- data/lib/projects/service/ZohoProject.rb +174 -0
- data/lib/projects/util/ZohoHTTPClient.rb +205 -0
- data/lib/test/ProjectsTest.rb +321 -0
- data/lib/zohoProjects.rb +35 -0
- data/lib/zohoProjects/version.rb +3 -0
- data/zohoProjects.gemspec +86 -0
- metadata +135 -0
@@ -0,0 +1,240 @@
|
|
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/TimesheetParser'
|
8
|
+
|
9
|
+
|
10
|
+
# * TimesheetAPI is used to:
|
11
|
+
#
|
12
|
+
# * Get list of time logs.
|
13
|
+
#
|
14
|
+
# * Add new task log.
|
15
|
+
#
|
16
|
+
# * update the details of a task log.
|
17
|
+
#
|
18
|
+
# * Delete an existing task log.
|
19
|
+
#
|
20
|
+
# * Add new bug log.
|
21
|
+
#
|
22
|
+
# * Update the details of a bug log.
|
23
|
+
#
|
24
|
+
# * Delete an existing bug log.
|
25
|
+
#
|
26
|
+
# * Add new general log.
|
27
|
+
#
|
28
|
+
# * Update the details of a general log.
|
29
|
+
#
|
30
|
+
# * Delete an existing general log.
|
31
|
+
|
32
|
+
class TimesheetsAPI < API
|
33
|
+
include Projects::Parser
|
34
|
+
include Projects::Util
|
35
|
+
# TimesheetParser is used to parse the JSON response into respective objects.
|
36
|
+
|
37
|
+
$timesheetParser = TimesheetParser.new
|
38
|
+
|
39
|
+
# * Construct a new TimesheetsAPI using User's authToken and portalId.
|
40
|
+
#
|
41
|
+
# ==== Parameters
|
42
|
+
#
|
43
|
+
# * authToken:: - User's authToken.
|
44
|
+
#
|
45
|
+
# * portalId:: - User's portalId.
|
46
|
+
|
47
|
+
def initialize(authToken,portalId)
|
48
|
+
super(authToken,portalId)
|
49
|
+
end
|
50
|
+
|
51
|
+
# * Get list of time logs for the project.
|
52
|
+
#
|
53
|
+
# ==== Parameters
|
54
|
+
#
|
55
|
+
# * projectId:: - ID 0f the project.
|
56
|
+
#
|
57
|
+
# * queryMap:: - This queryMap contains the filters in the form of key-value pair.
|
58
|
+
#
|
59
|
+
# ==== Returns
|
60
|
+
#
|
61
|
+
# * TimelogList object.
|
62
|
+
|
63
|
+
def getTimeLogs(projectId, queryMap)
|
64
|
+
url = getBaseURL+"projects/"+String(projectId)+"/logs/"
|
65
|
+
response = ZohoHTTPClient.get(url, getQueryMap(queryMap))
|
66
|
+
return $timesheetParser.getTimeLogs(response)
|
67
|
+
end
|
68
|
+
|
69
|
+
# * Add a new task log for the project.
|
70
|
+
#
|
71
|
+
# ==== Parameters
|
72
|
+
#
|
73
|
+
# * projectId:: - ID of the project.
|
74
|
+
#
|
75
|
+
# * tasklog:: - Tasklog object.
|
76
|
+
#
|
77
|
+
# ==== Returns
|
78
|
+
#
|
79
|
+
# * Tasklog object.
|
80
|
+
|
81
|
+
def addTasklog(projectId, tasklog)
|
82
|
+
url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(tasklog.getTaskId)+"/logs/"
|
83
|
+
response = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP)
|
84
|
+
return $timesheetParser.getTasklog(response)
|
85
|
+
end
|
86
|
+
|
87
|
+
# * Update the details of a task log.
|
88
|
+
#
|
89
|
+
# ==== Parameters
|
90
|
+
#
|
91
|
+
# * projectId ID of the project.
|
92
|
+
#
|
93
|
+
# * tasklog:: - Tasklog object.
|
94
|
+
#
|
95
|
+
# ==== Returns
|
96
|
+
#
|
97
|
+
# * Tasklog object.
|
98
|
+
|
99
|
+
def updateTasklog(projectId, tasklog)
|
100
|
+
url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(tasklog.getTaskId)+"/logs/"+String(tasklog.getId)+"/"
|
101
|
+
response = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP)
|
102
|
+
return $timesheetParser.getTasklog(response)
|
103
|
+
end
|
104
|
+
|
105
|
+
# * Delete an existing task log for the project.
|
106
|
+
#
|
107
|
+
# ==== Parameters
|
108
|
+
#
|
109
|
+
# * projectId:: - ID of the project.
|
110
|
+
#
|
111
|
+
# * taskId:: - ID of the task.
|
112
|
+
#
|
113
|
+
# * logId:: - ID of the log.
|
114
|
+
#
|
115
|
+
# ==== Returns
|
116
|
+
#
|
117
|
+
# * String object.
|
118
|
+
|
119
|
+
def deleteTasklog(projectId, taskId, logId)
|
120
|
+
url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(taskId)+"/logs/"+String(logId)+"/"
|
121
|
+
response = ZohoHTTPClient.delete(url, getQueryMap)
|
122
|
+
return $timesheetParser.getResult(response)
|
123
|
+
end
|
124
|
+
|
125
|
+
# * Add a new bug log for the project.
|
126
|
+
#
|
127
|
+
# ==== Parameters
|
128
|
+
#
|
129
|
+
# * projectId:: - ID of the project.
|
130
|
+
#
|
131
|
+
# * buglog:: - Buglog object.
|
132
|
+
#
|
133
|
+
# ==== Returns
|
134
|
+
#
|
135
|
+
# * Buglog object.
|
136
|
+
|
137
|
+
def addBuglog(projectId, buglog)
|
138
|
+
url = getBaseURL+"projects/"+String(projectId)+"/bugs/"+String(buglog.getBugId)+"/logs/"
|
139
|
+
response = ZohoHTTPClient.post(url, getQueryMap, buglog.toParamMAP)
|
140
|
+
return $timesheetParser.getBuglog(response)
|
141
|
+
end
|
142
|
+
|
143
|
+
# * Update the details of a bug log.
|
144
|
+
#
|
145
|
+
# ==== Parameters
|
146
|
+
#
|
147
|
+
# * projectId:: - ID of the project.
|
148
|
+
#
|
149
|
+
# * buglog:: - Buglog object.
|
150
|
+
#
|
151
|
+
# ==== Returns
|
152
|
+
#
|
153
|
+
# * Buglog object.
|
154
|
+
|
155
|
+
def updateBuglog(projectId, buglog)
|
156
|
+
url = getBaseURL+"projects/"+String(projectId)+"/bugs/"+String(buglog.getBugId)+"/logs/"+String(buglog.getId)+"/"
|
157
|
+
response = ZohoHTTPClient.post(url, getQueryMap, buglog.toParamMAP)
|
158
|
+
return $timesheetParser.getBuglog(response)
|
159
|
+
end
|
160
|
+
|
161
|
+
# * Delete an existing bug log for the project.
|
162
|
+
#
|
163
|
+
# ==== Parameters
|
164
|
+
#
|
165
|
+
# * projectId:: - ID of the project.
|
166
|
+
#
|
167
|
+
# * bugId:: - ID of the bug.
|
168
|
+
#
|
169
|
+
# * logId:: - ID of the log.
|
170
|
+
#
|
171
|
+
# ==== Returns
|
172
|
+
#
|
173
|
+
# * String object.
|
174
|
+
|
175
|
+
def deleteBuglog(projectId, bugId, logId)
|
176
|
+
url = getBaseURL+"projects/"+String(projectId)+"/bugs/"+String(bugId)+"/logs/"+String(logId)+"/"
|
177
|
+
response = ZohoHTTPClient.delete(url, getQueryMap)
|
178
|
+
return $timesheetParser.getResult(response)
|
179
|
+
end
|
180
|
+
|
181
|
+
# * Add a new general log for the project.
|
182
|
+
#
|
183
|
+
# ==== Parameters
|
184
|
+
#
|
185
|
+
# * projectId:: - ID of the project.
|
186
|
+
#
|
187
|
+
# * generallog:: - Generallog object.
|
188
|
+
#
|
189
|
+
# ==== Returns
|
190
|
+
#
|
191
|
+
# * Generallog object.
|
192
|
+
|
193
|
+
def addGenerallog(projectId, generallog)
|
194
|
+
url = getBaseURL+"projects/"+String(projectId)+"/logs/"
|
195
|
+
requestBody = generallog.toParamMAP
|
196
|
+
requestBody["name"] = generallog.getName
|
197
|
+
response = ZohoHTTPClient.post(url, getQueryMap, requestBody)
|
198
|
+
return $timesheetParser.getGenerallog(response)
|
199
|
+
end
|
200
|
+
|
201
|
+
# * Update the details of a general log.
|
202
|
+
#
|
203
|
+
# ==== Parameters
|
204
|
+
#
|
205
|
+
# * projectId:: - ID of the project.
|
206
|
+
#
|
207
|
+
# * generallog:: - Generallog object.
|
208
|
+
#
|
209
|
+
# ==== Returns
|
210
|
+
#
|
211
|
+
# * Generallog object.
|
212
|
+
|
213
|
+
def updateGenerallog(projectId, generallog)
|
214
|
+
url = getBaseURL+"projects/"+String(projectId)+"/logs/"+String(generallog.getId)+"/"
|
215
|
+
requestBody = generallog.toParamMAP
|
216
|
+
requestBody["name"] = generallog.getName
|
217
|
+
response = ZohoHTTPClient.post(url, getQueryMap, requestBody)
|
218
|
+
return $timesheetParser.getGenerallog(response)
|
219
|
+
end
|
220
|
+
|
221
|
+
# * Delete an existing general log for the project.
|
222
|
+
#
|
223
|
+
# ==== Parameters
|
224
|
+
#
|
225
|
+
# * projectId:: - ID of the project.
|
226
|
+
#
|
227
|
+
# * logId:: - ID of the log.
|
228
|
+
#
|
229
|
+
# ==== Returns
|
230
|
+
#
|
231
|
+
# * String object.
|
232
|
+
|
233
|
+
def deleteGenerallog(projectId, logId)
|
234
|
+
url = getBaseURL+"projects/"+String(projectId)+"/logs/"+String(logId)+"/"
|
235
|
+
response = ZohoHTTPClient.delete(url, getQueryMap)
|
236
|
+
return $timesheetParser.getResult(response)
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
@@ -0,0 +1,48 @@
|
|
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/UserParser'
|
8
|
+
|
9
|
+
|
10
|
+
# * UsersAPI is used to get list of users for the project.
|
11
|
+
|
12
|
+
class UsersAPI < API
|
13
|
+
include Projects::Parser
|
14
|
+
include Projects::Util
|
15
|
+
# UserParser is used to parse the JSON response into respective objects.
|
16
|
+
|
17
|
+
$userParser =UserParser.new
|
18
|
+
|
19
|
+
# * Construct a new UsersAPI using User's authToken and portalId.
|
20
|
+
#
|
21
|
+
# ==== Parameters
|
22
|
+
#
|
23
|
+
# * authToken:: - User's authToken.
|
24
|
+
#
|
25
|
+
# * portalId:: - User's portalId.
|
26
|
+
|
27
|
+
def initialize(authToken,portalId)
|
28
|
+
super(authToken,portalId)
|
29
|
+
end
|
30
|
+
|
31
|
+
# * Get list of users for the project.
|
32
|
+
#
|
33
|
+
# ==== Parameters
|
34
|
+
#
|
35
|
+
# * projectId:: - ID of the project.
|
36
|
+
#
|
37
|
+
# ==== Returns
|
38
|
+
#
|
39
|
+
# * List of User object.
|
40
|
+
|
41
|
+
def getUsers(projectId)
|
42
|
+
url = getBaseURL+"projects/"+String(projectId)+"/users/"
|
43
|
+
response = ZohoHTTPClient.get(url, getQueryMap)
|
44
|
+
return $userParser.getUsers(response)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# $Id$
|
2
|
+
module Projects
|
3
|
+
module Pexception
|
4
|
+
|
5
|
+
# * ProjectsException is used to throw a new projects exception with code and message.
|
6
|
+
|
7
|
+
class ProjectsException < Exception
|
8
|
+
|
9
|
+
private
|
10
|
+
attr_accessor :code, :message
|
11
|
+
|
12
|
+
public
|
13
|
+
|
14
|
+
# * Construct a new ProjectsException by passing an error code and error message.
|
15
|
+
#
|
16
|
+
# ==== Parameters
|
17
|
+
#
|
18
|
+
# * code:: - Error code.
|
19
|
+
#
|
20
|
+
# * message:: - Error message.
|
21
|
+
|
22
|
+
def initialize(code, message)
|
23
|
+
super(message)
|
24
|
+
@code = code
|
25
|
+
@message = message
|
26
|
+
end
|
27
|
+
|
28
|
+
# * get the error code.
|
29
|
+
#
|
30
|
+
# ==== Returns
|
31
|
+
#
|
32
|
+
# * Error code.
|
33
|
+
|
34
|
+
def getCode
|
35
|
+
return @code
|
36
|
+
end
|
37
|
+
|
38
|
+
# * get the error message.
|
39
|
+
#
|
40
|
+
# ==== Returns
|
41
|
+
#
|
42
|
+
# * Error message.
|
43
|
+
|
44
|
+
def getMessage
|
45
|
+
return @message
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,173 @@
|
|
1
|
+
# $Id$
|
2
|
+
module Projects
|
3
|
+
module Model
|
4
|
+
# * This class is used to make an object for Activity.
|
5
|
+
|
6
|
+
class Activity
|
7
|
+
private
|
8
|
+
attr_accessor :id, :name, :state, :activityBy, :timeLong, :displayTime, :time, :activityFor
|
9
|
+
|
10
|
+
public
|
11
|
+
|
12
|
+
# * Set the id of the activity.
|
13
|
+
#
|
14
|
+
# ==== Parameters
|
15
|
+
#
|
16
|
+
# * id:: - ID of the activity.
|
17
|
+
|
18
|
+
def setId(id)
|
19
|
+
@id = id
|
20
|
+
end
|
21
|
+
|
22
|
+
# * Get the activity id.
|
23
|
+
#
|
24
|
+
# ==== Returns
|
25
|
+
#
|
26
|
+
# * Activity id.
|
27
|
+
|
28
|
+
def getId
|
29
|
+
return @id
|
30
|
+
end
|
31
|
+
|
32
|
+
# * Set the name of the activity.
|
33
|
+
#
|
34
|
+
# ==== Parameters
|
35
|
+
#
|
36
|
+
# * name:: - Name of the activity.
|
37
|
+
|
38
|
+
def setName(name)
|
39
|
+
@name = name
|
40
|
+
end
|
41
|
+
|
42
|
+
# * Get the activity name.
|
43
|
+
#
|
44
|
+
# ==== Returns
|
45
|
+
#
|
46
|
+
# * Activity name.
|
47
|
+
|
48
|
+
def getName
|
49
|
+
return @name
|
50
|
+
end
|
51
|
+
|
52
|
+
# * Set the state of the activity.
|
53
|
+
#
|
54
|
+
# ==== Parameters
|
55
|
+
#
|
56
|
+
# * state:: - State of the activity.
|
57
|
+
|
58
|
+
def setState(state)
|
59
|
+
@state = state
|
60
|
+
end
|
61
|
+
|
62
|
+
# * Get the activity state.
|
63
|
+
#
|
64
|
+
# ==== Returns
|
65
|
+
#
|
66
|
+
# * Activity state.
|
67
|
+
|
68
|
+
def getState
|
69
|
+
return @state
|
70
|
+
end
|
71
|
+
|
72
|
+
# * Set who posted the activity.
|
73
|
+
#
|
74
|
+
# ==== Parameters
|
75
|
+
#
|
76
|
+
# * activityBy:: - User who posted the activity.
|
77
|
+
|
78
|
+
def setActivityBy(activityBy)
|
79
|
+
@activityBy = activityBy
|
80
|
+
end
|
81
|
+
|
82
|
+
# * Get who posted the activity.
|
83
|
+
#
|
84
|
+
# ==== Returns
|
85
|
+
#
|
86
|
+
# * User who posted the activity.
|
87
|
+
|
88
|
+
def getActivityBy
|
89
|
+
return @activityBy
|
90
|
+
end
|
91
|
+
|
92
|
+
# * Set the time long.
|
93
|
+
#
|
94
|
+
# ==== Parameters
|
95
|
+
#
|
96
|
+
# * timeLong:: - Time for the activity.
|
97
|
+
|
98
|
+
def setTimeLong(timeLong)
|
99
|
+
@timeLong = timeLong
|
100
|
+
end
|
101
|
+
|
102
|
+
# * Get the time long.
|
103
|
+
#
|
104
|
+
# ==== Returns
|
105
|
+
#
|
106
|
+
# * Time for the activity.
|
107
|
+
|
108
|
+
def getTimeLong
|
109
|
+
return timeLong
|
110
|
+
end
|
111
|
+
|
112
|
+
# * Set the display time for the activity.
|
113
|
+
#
|
114
|
+
# ==== Parameters
|
115
|
+
#
|
116
|
+
# * displayTime:: - Display time for the activity.
|
117
|
+
|
118
|
+
def setDisplayTime(displayTime)
|
119
|
+
@displayTime = displayTime
|
120
|
+
end
|
121
|
+
|
122
|
+
# * Get the display time for the activity.
|
123
|
+
#
|
124
|
+
# ==== Returns
|
125
|
+
#
|
126
|
+
# * Display time for the activity.
|
127
|
+
|
128
|
+
def getDisplayTime
|
129
|
+
return @displayTime
|
130
|
+
end
|
131
|
+
|
132
|
+
# * Set the time for the activity done.
|
133
|
+
#
|
134
|
+
# ==== Parameters
|
135
|
+
#
|
136
|
+
# * time:: - Time for the activity done.
|
137
|
+
|
138
|
+
def setTime(time)
|
139
|
+
@time = time
|
140
|
+
end
|
141
|
+
|
142
|
+
# * Get the time for the activity done.
|
143
|
+
#
|
144
|
+
# ==== Returns
|
145
|
+
#
|
146
|
+
# * Time for the activity done.
|
147
|
+
|
148
|
+
def getTime
|
149
|
+
return @time
|
150
|
+
end
|
151
|
+
|
152
|
+
# * Set the activity for which topic.
|
153
|
+
#
|
154
|
+
# ==== Parameters
|
155
|
+
#
|
156
|
+
# * activityFor:: - Topic fo the Activity.
|
157
|
+
|
158
|
+
def setActivityFor(activityFor)
|
159
|
+
@activityFor = activityFor
|
160
|
+
end
|
161
|
+
|
162
|
+
# * Get the activity for which topic.
|
163
|
+
#
|
164
|
+
# ==== Returns
|
165
|
+
#
|
166
|
+
# * Th topic of the activity.
|
167
|
+
|
168
|
+
def getActivityFor
|
169
|
+
return @activityFor
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|