zohoProjects 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- 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,253 @@
|
|
1
|
+
# $Id$
|
2
|
+
module Projects
|
3
|
+
module Parser
|
4
|
+
|
5
|
+
require 'json'
|
6
|
+
require File.dirname(__FILE__).chomp("/projects/parser") + '/projects/model/Forum'
|
7
|
+
require File.dirname(__FILE__).chomp("/projects/parser") + '/projects/model/Category'
|
8
|
+
require File.dirname(__FILE__).chomp("/projects/parser") + '/projects/model/Comment'
|
9
|
+
|
10
|
+
#* Parse the JSON response into respective objects.
|
11
|
+
|
12
|
+
class ForumParser
|
13
|
+
include Projects::Model
|
14
|
+
# * Parse the JSON response and make it into List of Forum object.
|
15
|
+
#
|
16
|
+
# ==== Parameters
|
17
|
+
#
|
18
|
+
# * response:: - This JSON response contains the details fo forums.
|
19
|
+
#
|
20
|
+
# ==== Returns
|
21
|
+
#
|
22
|
+
# * List of Forum object.
|
23
|
+
|
24
|
+
def getForums(response)
|
25
|
+
forums_all_json = JSON.parse response
|
26
|
+
forums_all_array = forums_all_json["forums"]
|
27
|
+
forums_class_array = Array.new
|
28
|
+
for i in 0...forums_all_array.length
|
29
|
+
forums_class_array.push(jsonToForum(forums_all_array[i]))
|
30
|
+
end
|
31
|
+
return forums_class_array
|
32
|
+
end
|
33
|
+
|
34
|
+
# * Parse the JSON response and make it into Forum object.
|
35
|
+
#
|
36
|
+
# ==== Parameters
|
37
|
+
#
|
38
|
+
# * response:: - This JSON response contains the details of a forum.
|
39
|
+
#
|
40
|
+
# ==== Returns
|
41
|
+
#
|
42
|
+
# * Forum object.
|
43
|
+
|
44
|
+
def getForum(response)
|
45
|
+
forum_json = JSON.parse response
|
46
|
+
forum_array = forum_json["forums"]
|
47
|
+
return jsonToForum(forum_array[0])
|
48
|
+
end
|
49
|
+
|
50
|
+
# * Parse the JSONObject into Forum object.
|
51
|
+
#
|
52
|
+
# ==== Parameters
|
53
|
+
#
|
54
|
+
# * jsonObject:: - JSONObject contains the details of a forum.
|
55
|
+
#
|
56
|
+
# ==== Returns
|
57
|
+
#
|
58
|
+
# * Forum object.
|
59
|
+
|
60
|
+
def jsonToForum(jsonObject)
|
61
|
+
forum = Forum.new
|
62
|
+
|
63
|
+
if jsonObject.has_key?("id")
|
64
|
+
forum.setId(jsonObject["id"])
|
65
|
+
end
|
66
|
+
if jsonObject.has_key?("name")
|
67
|
+
forum.setName(jsonObject["name"])
|
68
|
+
end
|
69
|
+
if jsonObject.has_key?("content")
|
70
|
+
forum.setContent(jsonObject["content"])
|
71
|
+
end
|
72
|
+
if jsonObject.has_key?("is_sticky_post")
|
73
|
+
forum.setIsStickyPost(jsonObject["is_sticky_post"])
|
74
|
+
end
|
75
|
+
if jsonObject.has_key?("is_announcement_post")
|
76
|
+
forum.setIsAnnouncementPost(jsonObject["is_announcement_post"])
|
77
|
+
end
|
78
|
+
if jsonObject.has_key?("posted_by")
|
79
|
+
forum.setPostedBy(jsonObject["posted_by"])
|
80
|
+
end
|
81
|
+
if jsonObject.has_key?("posted_person")
|
82
|
+
forum.setPostedPerson(jsonObject["posted_person"])
|
83
|
+
end
|
84
|
+
if jsonObject.has_key?("post_date")
|
85
|
+
forum.setPostDate(jsonObject["post_date"])
|
86
|
+
end
|
87
|
+
if jsonObject.has_key?("post_date_format")
|
88
|
+
forum.setPostDateFormat(jsonObject["post_date_format"])
|
89
|
+
end
|
90
|
+
if jsonObject.has_key?("post_date_long")
|
91
|
+
forum.setPostDateLong(jsonObject["post_date_long"])
|
92
|
+
end
|
93
|
+
|
94
|
+
if jsonObject.has_key?("link")
|
95
|
+
link = jsonObject["link"]
|
96
|
+
|
97
|
+
if link.has_key?("self")
|
98
|
+
forum.setURL(link["self"]["url"])
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
return forum
|
103
|
+
end
|
104
|
+
|
105
|
+
# * Parse the JSON response and get the success message.
|
106
|
+
#
|
107
|
+
# ==== Parameters
|
108
|
+
#
|
109
|
+
# * response:: - This JSON response contains the success message.
|
110
|
+
#
|
111
|
+
# ==== Returns
|
112
|
+
#
|
113
|
+
# * String object.
|
114
|
+
|
115
|
+
def getResult(response)
|
116
|
+
jsonObject = JSON.parse response
|
117
|
+
result = jsonObject["response"]
|
118
|
+
return result
|
119
|
+
end
|
120
|
+
|
121
|
+
# * Parse the JSON response and make it into List of Category object.
|
122
|
+
#
|
123
|
+
# ==== Parameters
|
124
|
+
#
|
125
|
+
# * response:: - This JSON response contains the details of categories.
|
126
|
+
#
|
127
|
+
# ==== Returns
|
128
|
+
#
|
129
|
+
# * List of Category object.
|
130
|
+
|
131
|
+
def getCategories(response)
|
132
|
+
categories_all_json = JSON.parse response
|
133
|
+
categories_all_array = categories_all_json["categories"]
|
134
|
+
categories_class_array = Array.new
|
135
|
+
for i in 0...categories_all_array.length
|
136
|
+
categories_class_array.push(jsonToCategory(categories_all_array[i]))
|
137
|
+
end
|
138
|
+
return categories_class_array
|
139
|
+
end
|
140
|
+
|
141
|
+
# * Parse the JSON response and make it into Category object.
|
142
|
+
#
|
143
|
+
# ==== Parameters
|
144
|
+
#
|
145
|
+
# * response:: - This JSON response contains the details of a category.
|
146
|
+
#
|
147
|
+
# ==== Returns
|
148
|
+
#
|
149
|
+
# * Category object.
|
150
|
+
|
151
|
+
def getCategory(response)
|
152
|
+
category_json = JSON.parse response
|
153
|
+
category_array = category_json["categories"]
|
154
|
+
return jsonToCategory(category_array[0])
|
155
|
+
end
|
156
|
+
|
157
|
+
# * Parse the JSONObject into Category object.
|
158
|
+
#
|
159
|
+
# * jsonObject:: - JSONObject contains the details of a category.
|
160
|
+
#
|
161
|
+
# ==== Returns
|
162
|
+
#
|
163
|
+
# * Category object.
|
164
|
+
|
165
|
+
def jsonToCategory(jsonObject)
|
166
|
+
category = Category.new
|
167
|
+
|
168
|
+
if jsonObject.has_key?("id")
|
169
|
+
category.setId(jsonObject["id"])
|
170
|
+
end
|
171
|
+
if jsonObject.has_key?("name")
|
172
|
+
category.setName(jsonObject["name"])
|
173
|
+
end
|
174
|
+
|
175
|
+
return category
|
176
|
+
end
|
177
|
+
|
178
|
+
# * Parse the JSON response and make it into List of Comment object.
|
179
|
+
#
|
180
|
+
# ==== Parameters
|
181
|
+
#
|
182
|
+
# * response:: - This JSON response contains the details of comments.
|
183
|
+
#
|
184
|
+
# ==== Returns
|
185
|
+
#
|
186
|
+
# * List of Comment object.
|
187
|
+
|
188
|
+
def getComments(response)
|
189
|
+
comments_all_json = JSON.parse response
|
190
|
+
comments_all_array = comments_all_json["comments"]
|
191
|
+
comments_class_array = Array.new
|
192
|
+
for i in 0...comments_all_array.length
|
193
|
+
comments_class_array.push(jsonToComment(comments_all_array[i]))
|
194
|
+
end
|
195
|
+
return comments_class_array
|
196
|
+
end
|
197
|
+
|
198
|
+
# * Parse the JSON response and make it into Comment object.
|
199
|
+
#
|
200
|
+
# ==== Parameters
|
201
|
+
#
|
202
|
+
# * response:: - This JSON response contains the details of a comment.
|
203
|
+
#
|
204
|
+
# ==== Returns
|
205
|
+
#
|
206
|
+
# * Comment object.
|
207
|
+
|
208
|
+
def getComment(response)
|
209
|
+
comment_json = JSON.parse response
|
210
|
+
comment_array = comment_json["comments"]
|
211
|
+
return jsonToComment(comment_array[0])
|
212
|
+
end
|
213
|
+
|
214
|
+
# * Parse the JSONObject into Comment object.
|
215
|
+
#
|
216
|
+
# ==== Parameters
|
217
|
+
#
|
218
|
+
# * jsonObject:: - JSONObject contains the details of a comment.
|
219
|
+
#
|
220
|
+
# ==== Returns
|
221
|
+
#
|
222
|
+
# * Comment object.
|
223
|
+
|
224
|
+
def jsonToComment(jsonObject)
|
225
|
+
comment = Comment.new
|
226
|
+
|
227
|
+
if jsonObject.has_key?("id")
|
228
|
+
comment.setId(jsonObject["id"])
|
229
|
+
end
|
230
|
+
if jsonObject.has_key?("content")
|
231
|
+
comment.setContent(jsonObject["content"])
|
232
|
+
end
|
233
|
+
if jsonObject.has_key?("posted_by")
|
234
|
+
comment.setPostedBy(jsonObject["posted_by"])
|
235
|
+
end
|
236
|
+
if jsonObject.has_key?("posted_person")
|
237
|
+
comment.setPostedPerson(jsonObject["posted_person"])
|
238
|
+
end
|
239
|
+
if jsonObject.has_key?("post_date")
|
240
|
+
comment.setPostDate(jsonObject["post_date"])
|
241
|
+
end
|
242
|
+
if jsonObject.has_key?("post_date_format")
|
243
|
+
comment.setPostDateFormat(jsonObject["post_date_format"])
|
244
|
+
end
|
245
|
+
if jsonObject.has_key?("post_date_long")
|
246
|
+
comment.setPostDateLong(jsonObject["post_date_long"])
|
247
|
+
end
|
248
|
+
|
249
|
+
return comment
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# $Id$
|
2
|
+
module Projects
|
3
|
+
module Parser
|
4
|
+
|
5
|
+
require 'json'
|
6
|
+
require File.dirname(__FILE__).chomp("/projects/parser") + '/projects/model/Milestone'
|
7
|
+
|
8
|
+
# * Parse the JSON response into respective objects.
|
9
|
+
|
10
|
+
class MilestonesParser
|
11
|
+
include Projects::Model
|
12
|
+
# * Parse the JSON response and make it into List of Milestone object.
|
13
|
+
#
|
14
|
+
# ==== Parameters
|
15
|
+
#
|
16
|
+
# * response:: - This JSON response contains the details of milestones.
|
17
|
+
#
|
18
|
+
# ==== Returns
|
19
|
+
#
|
20
|
+
# * List of Milestone object.
|
21
|
+
|
22
|
+
def getMilestones(response)
|
23
|
+
milestones_all_json = JSON.parse response
|
24
|
+
milestones_all_array = milestones_all_json["milestones"]
|
25
|
+
milestones_class_array = Array.new
|
26
|
+
for i in 0...milestones_all_array.length
|
27
|
+
milestones_class_array.push(jsonToMilestone(milestones_all_array[i]))
|
28
|
+
end
|
29
|
+
return milestones_class_array
|
30
|
+
end
|
31
|
+
|
32
|
+
# * Parse the JSON response and make it into Milestone object.
|
33
|
+
#
|
34
|
+
# ==== Parameters
|
35
|
+
#
|
36
|
+
# * response:: - This JSON response contains the details of a milestone.
|
37
|
+
#
|
38
|
+
# ==== Returns
|
39
|
+
#
|
40
|
+
# * Milestone object.
|
41
|
+
|
42
|
+
def getMilestone(response)
|
43
|
+
milestones_json = JSON.parse response
|
44
|
+
milestones_array = milestones_json["milestones"]
|
45
|
+
return jsonToMilestone(milestones_array[0])
|
46
|
+
end
|
47
|
+
|
48
|
+
# * Parse the JSONObject into Milestone object.
|
49
|
+
#
|
50
|
+
# ==== Parameters
|
51
|
+
#
|
52
|
+
# * jsonObject:: - JSONObject contains the details of a milestone.
|
53
|
+
#
|
54
|
+
# ==== Returns
|
55
|
+
#
|
56
|
+
# * Milestone object.
|
57
|
+
|
58
|
+
def jsonToMilestone(jsonObject)
|
59
|
+
milestone = Milestone.new
|
60
|
+
|
61
|
+
if jsonObject.has_key?("id")
|
62
|
+
milestone.setId(jsonObject["id"])
|
63
|
+
end
|
64
|
+
if jsonObject.has_key?("name")
|
65
|
+
milestone.setName(jsonObject["name"])
|
66
|
+
end
|
67
|
+
if jsonObject.has_key?("start_date")
|
68
|
+
milestone.setStartDate(jsonObject["start_date"])
|
69
|
+
end
|
70
|
+
if jsonObject.has_key?("start_date_format")
|
71
|
+
milestone.setStartDateFormat(jsonObject["start_date_format"])
|
72
|
+
end
|
73
|
+
if jsonObject.has_key?("start_date_long")
|
74
|
+
milestone.setStartDateLong(jsonObject["start_date_long"])
|
75
|
+
end
|
76
|
+
if jsonObject.has_key?("end_date")
|
77
|
+
milestone.setEndDate(jsonObject["end_date"])
|
78
|
+
end
|
79
|
+
if jsonObject.has_key?("end_date_format")
|
80
|
+
milestone.setEndDateFormat(jsonObject["end_date_format"])
|
81
|
+
end
|
82
|
+
if jsonObject.has_key?("end_date_long")
|
83
|
+
milestone.setEndDateLong(jsonObject["end_date_long"])
|
84
|
+
end
|
85
|
+
if jsonObject.has_key?("status")
|
86
|
+
milestone.setStatus(jsonObject["status"])
|
87
|
+
end
|
88
|
+
if jsonObject.has_key?("flag")
|
89
|
+
milestone.setFlag(jsonObject["flag"])
|
90
|
+
end
|
91
|
+
if jsonObject.has_key?("owner_id")
|
92
|
+
milestone.setOwnerId(jsonObject["owner_id"])
|
93
|
+
end
|
94
|
+
if jsonObject.has_key?("owner_name")
|
95
|
+
milestone.setOwnerName(jsonObject["owner_name"])
|
96
|
+
end
|
97
|
+
|
98
|
+
if jsonObject.has_key?("link")
|
99
|
+
link = jsonObject["link"]
|
100
|
+
|
101
|
+
if link.has_key?("self")
|
102
|
+
milestone.setURL(link["self"]["url"])
|
103
|
+
end
|
104
|
+
if link.has_key?("status")
|
105
|
+
milestone.setStatusURL(link["status"]["url"])
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
return milestone
|
110
|
+
end
|
111
|
+
|
112
|
+
# * Parse the JSON response and get the success message.
|
113
|
+
#
|
114
|
+
# ==== Parameters
|
115
|
+
#
|
116
|
+
# * response:: - This JSON response contains the success message.
|
117
|
+
#
|
118
|
+
# ==== Returns
|
119
|
+
#
|
120
|
+
# * String object.
|
121
|
+
|
122
|
+
def getResult(response)
|
123
|
+
jsonObject = JSON.parse response
|
124
|
+
result = jsonObject["response"]
|
125
|
+
return result
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# $Id$
|
2
|
+
module Projects
|
3
|
+
module Parser
|
4
|
+
|
5
|
+
require 'json'
|
6
|
+
require File.dirname(__FILE__).chomp("/projects/parser") + '/projects/model/Portal'
|
7
|
+
|
8
|
+
# * Parse the JSON response into respective objects.
|
9
|
+
|
10
|
+
class PortalParser
|
11
|
+
include Projects::Model
|
12
|
+
# * Parse the JSON response and make it into List of Portal object.
|
13
|
+
#
|
14
|
+
# ==== Parameters
|
15
|
+
#
|
16
|
+
# * response:: - This JSON response contains the details of portals.
|
17
|
+
#
|
18
|
+
# ==== Returns
|
19
|
+
#
|
20
|
+
# * List of Portal object.
|
21
|
+
|
22
|
+
def getPortals(response)
|
23
|
+
portals_all_json = JSON.parse response
|
24
|
+
portals_all_array = portals_all_json["portals"]
|
25
|
+
portal_class_array = Array.new
|
26
|
+
for i in 0...portals_all_array.length
|
27
|
+
portal_class_array.push(getPortal(portals_all_array[i]))
|
28
|
+
end
|
29
|
+
return portal_class_array
|
30
|
+
end
|
31
|
+
|
32
|
+
# * Parse the JSONObject into Portal object.
|
33
|
+
#
|
34
|
+
# ==== Parameters
|
35
|
+
#
|
36
|
+
# * jsonObject:: - JSONObject contains the details of a Portal.
|
37
|
+
#
|
38
|
+
# ==== Returns
|
39
|
+
#
|
40
|
+
# * Portal object.
|
41
|
+
|
42
|
+
def getPortal(jsonObject)
|
43
|
+
portal = Projects::Model::Portal.new
|
44
|
+
if jsonObject.has_key?("id")
|
45
|
+
portal.setId(jsonObject["id"])
|
46
|
+
end
|
47
|
+
if jsonObject.has_key?("name")
|
48
|
+
portal.setName(jsonObject["name"])
|
49
|
+
end
|
50
|
+
if jsonObject.has_key?("default")
|
51
|
+
portal.setDefault(jsonObject["default"])
|
52
|
+
end
|
53
|
+
if jsonObject.has_key?("gmt_time_zone")
|
54
|
+
portal.setGmtTimeZone(jsonObject["gmt_time_zone"])
|
55
|
+
end
|
56
|
+
if jsonObject.has_key?("role")
|
57
|
+
portal.setRole(jsonObject["role"])
|
58
|
+
end
|
59
|
+
|
60
|
+
if jsonObject.has_key?("settings")
|
61
|
+
settings = jsonObject["settings"]
|
62
|
+
if settings.has_key?("company_name")
|
63
|
+
portal.setCompanyName(settings["company_name"])
|
64
|
+
end
|
65
|
+
if settings.has_key?("website_url")
|
66
|
+
portal.setWebsiteURL(settings["website_url"])
|
67
|
+
end
|
68
|
+
if settings.has_key?("time_zone")
|
69
|
+
portal.setTimeZone(settings["time_zone"])
|
70
|
+
end
|
71
|
+
if settings.has_key?("date_format")
|
72
|
+
portal.setDateFormat(settings["date_format"])
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
if jsonObject.has_key?("locale")
|
78
|
+
locale = jsonObject["locale"]
|
79
|
+
if locale.has_key?("code")
|
80
|
+
portal.setCode(locale["code"])
|
81
|
+
end
|
82
|
+
if locale.has_key?("language")
|
83
|
+
portal.setLanguage(locale["language"])
|
84
|
+
end
|
85
|
+
if locale.has_key?("country")
|
86
|
+
portal.setCountry(locale["country"])
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
if jsonObject.has_key?("link")
|
91
|
+
link = jsonObject["link"]
|
92
|
+
if link.has_key?("projects")
|
93
|
+
project = link["project"]
|
94
|
+
if project.has_key?("url")
|
95
|
+
portal.setProjectURL(project["url"])
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
return portal
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|