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,54 @@
1
+ # $Id$
2
+ module Projects
3
+ module Model
4
+ # * This class is used to make an object for TimelogList.
5
+
6
+ class TimelogList < Array
7
+
8
+ private
9
+ attr_accessor :grandtotal, :role
10
+
11
+ public
12
+
13
+ # * Set the grand total of the time log.
14
+ #
15
+ # ==== Parameters
16
+ #
17
+ # * grandtotal:: - Grand total of the time log.
18
+
19
+ def setGrandtotal(grandtotal)
20
+ @grandtotal = grandtotal
21
+ end
22
+
23
+ # * Get the grand total of the time log.
24
+ #
25
+ # ==== Returns
26
+ #
27
+ # * The grand total of the timelog.
28
+
29
+ def getGrandtotal
30
+ return grandtotal
31
+ end
32
+
33
+ # * Set the time log role.
34
+ #
35
+ # ==== Parameters
36
+ #
37
+ # * role:: - Role for the time log.
38
+
39
+ def setRole(role)
40
+ @role = role
41
+ end
42
+
43
+ # * Get the time log role.
44
+ #
45
+ # ==== Returns
46
+ #
47
+ # * The time log role.
48
+
49
+ def getRole
50
+ return @role
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,94 @@
1
+ # $Id$
2
+ module Projects
3
+ module Model
4
+ # * This class is used to make an object for User.
5
+
6
+ class User
7
+
8
+ private
9
+ attr_accessor :id, :name, :email, :role
10
+
11
+ public
12
+
13
+ # * Set the user id.
14
+ #
15
+ # ==== Parameters
16
+ #
17
+ # * id:: - ID of the user.
18
+
19
+ def setId(id)
20
+ @id = id
21
+ end
22
+
23
+ # * Get the user id.
24
+ #
25
+ # ==== Returns
26
+ #
27
+ # * User id.
28
+
29
+ def getId
30
+ return @id
31
+ end
32
+
33
+ # * Set the user name.
34
+ #
35
+ # ==== Parameters
36
+ #
37
+ # * name:: - Name of the user.
38
+
39
+ def setName(name)
40
+ @name = name
41
+ end
42
+
43
+ # * Get the user name.
44
+ #
45
+ # ==== Returns
46
+ #
47
+ # * User name.
48
+
49
+ def getName
50
+ return @name
51
+ end
52
+
53
+ # * Set the user email.
54
+ #
55
+ # ==== Parameters
56
+ #
57
+ # * email:: - Email for the user.
58
+
59
+ def setEmail(email)
60
+ @email = email
61
+ end
62
+
63
+ # * Get the user email.
64
+ #
65
+ # ==== Returns
66
+ #
67
+ # * User email.
68
+
69
+ def getEmail
70
+ return @email
71
+ end
72
+
73
+ # * Set the user role.
74
+ #
75
+ # ==== Parameters
76
+ #
77
+ # * role:: - Role for the user.
78
+
79
+ def setRole(role)
80
+ @role = role
81
+ end
82
+
83
+ # * Get the user role.
84
+ #
85
+ # ==== Returns
86
+ #
87
+ # * user role.
88
+
89
+ def getRole
90
+ return @role
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,194 @@
1
+ # $Id$
2
+ module Projects
3
+ module Model
4
+ # * This class is used to make an object for Version.
5
+
6
+ class Version
7
+
8
+ private
9
+ attr_accessor :id, :uploadedBy, :description, :version, :uploadedOn, :fileSize, :uploadedDate, :uploadedDateFormat, :uploadedDateLong
10
+
11
+ public
12
+
13
+ # * Set the version id.
14
+ #
15
+ # ==== Parameters
16
+ #
17
+ # * id:: - ID of the version.
18
+
19
+ def setId(id)
20
+ @id = id
21
+ end
22
+
23
+ # * Get the version id.
24
+ #
25
+ # ==== Returns
26
+ #
27
+ # * Version id.
28
+
29
+ def getId
30
+ return @id
31
+ end
32
+
33
+ # * Set the id of the person who has uploaded.
34
+ #
35
+ # ==== Parameters
36
+ #
37
+ # * uploadedBy:: - Id of the person who has uploaded.
38
+
39
+ def setUploadedBy(uploadedBy)
40
+ @uploadedBy = uploadedBy
41
+ end
42
+
43
+ # * Get the id of the person who has uploaded.
44
+ #
45
+ # ==== Returns
46
+ #
47
+ # * Id of the user who has uploaded.
48
+
49
+ def getUploadedBy
50
+ return @uploadedBy
51
+ end
52
+
53
+ # * Set the version description.
54
+ #
55
+ # ==== Parameters
56
+ #
57
+ # * description:: - Description for the version.
58
+
59
+ def setDescription(description)
60
+ @description = description
61
+ end
62
+
63
+ # * Get the version description.
64
+ #
65
+ # ==== Returns
66
+ #
67
+ # * Version description.
68
+
69
+ def getDescription
70
+ return @description
71
+ end
72
+
73
+ # * Set the version.
74
+ #
75
+ # ==== Parameters
76
+ #
77
+ # * version:: - Version of the document.
78
+
79
+ def setVersion(version)
80
+ @version = version
81
+ end
82
+
83
+ # * Get the version.
84
+ #
85
+ # ==== Returns
86
+ #
87
+ # * Document version.
88
+
89
+ def getVersion
90
+ return @version
91
+ end
92
+
93
+ # * Set when was the document uploaded on.
94
+ #
95
+ # ==== Parameters
96
+ #
97
+ # * uploadedOn:: - When was the document uploaded on.
98
+
99
+ def setUploadedOn(uploadedOn)
100
+ @uploadedOn = uploadedOn
101
+ end
102
+
103
+ # * Get when the document was uploaded on.
104
+ #
105
+ # ==== Returns
106
+ #
107
+ # * Time of uploading the document.
108
+
109
+ def getUploadedOn
110
+ return @uploadedOn
111
+ end
112
+
113
+ # * Set the file size.
114
+ #
115
+ # ==== Parameters
116
+ #
117
+ # * fileSize:: - Size of the file.
118
+
119
+ def setFileSize(fileSize)
120
+ @fileSize = fileSize
121
+ end
122
+
123
+ # * Get the file size.
124
+ #
125
+ # ==== Returns
126
+ #
127
+ # * File size.
128
+
129
+ def getFileSize
130
+ return @fileSize
131
+ end
132
+
133
+ # * Set the uploaded date.
134
+ #
135
+ # ==== Parameters
136
+ #
137
+ # * uploadedDate:: - Document uploaded date.
138
+
139
+ def setUploadedDate(uploadedDate)
140
+ @uploadedDate = uploadedDate
141
+ end
142
+
143
+ # * Get the uploaded date.
144
+ #
145
+ # ==== Returns
146
+ #
147
+ # * Uploaded date.
148
+
149
+ def getUploadedDate
150
+ return @uploadedDate
151
+ end
152
+
153
+ # * Set the uploaded date format.
154
+ #
155
+ # ==== Parameters
156
+ #
157
+ # * uploadedDate:: - Document uploaded date format.
158
+
159
+ def setUploadedDateFormat(uploadedDateFormat)
160
+ @uploadedDateFormat = uploadedDateFormat
161
+ end
162
+
163
+ # * Get the uploaded date format.
164
+ #
165
+ # ==== Returns
166
+ #
167
+ # * Uploaded date format.
168
+
169
+ def getUploadedDateFormat
170
+ return @uploadedDateFormat
171
+ end
172
+
173
+ # * Set the uploaded date long.
174
+ #
175
+ # ==== Parameters
176
+ #
177
+ # * uploadedDateLong:: - Document uploaded date long.
178
+
179
+ def setUploadedDateLong(uploadedDateLong)
180
+ @uploadedDateLong = uploadedDateLong
181
+ end
182
+
183
+ # * Get the document uploaded date long.
184
+ #
185
+ # ==== Returns
186
+ #
187
+ # * document uploaded date long.
188
+
189
+ def getUploadedDateLong
190
+ return @uploadedDateLong
191
+ end
192
+ end
193
+ end
194
+ end
@@ -0,0 +1,208 @@
1
+ # $Id$
2
+ module Projects
3
+ module Parser
4
+
5
+ require 'json'
6
+ require File.dirname(__FILE__).chomp("/projects/parser") + '/projects/model/Bug'
7
+
8
+
9
+ # * Parse the JSON response into respective objects.
10
+
11
+ class BugParser
12
+ include Projects::Model
13
+ # * Parse the JSON response and make it into List of Bug object.
14
+ #
15
+ # ==== Parameters
16
+ #
17
+ # * response:: - This JSON response contains the details of bugs.
18
+ #
19
+ # ==== Returns
20
+ #
21
+ # * List of Bug object.
22
+
23
+
24
+ def getBugs(response)
25
+ bugs_all_json = JSON.parse response
26
+ bugs_all_array = bugs_all_json["bugs"]
27
+ bugs_class_array = Array.new
28
+ for i in 0...bugs_all_array.length
29
+ bugs_class_array.push(jsonToBug(bugs_all_array[i]))
30
+ end
31
+ return bugs_class_array
32
+ end
33
+
34
+ # * Parse the JSON response and make it into Bug object.
35
+ #
36
+ # ==== Parameters
37
+ #
38
+ # * response:: - This JSON response contains the details of a bug.
39
+ #
40
+ # ==== Returns
41
+ #
42
+ # * Bug object.
43
+
44
+
45
+
46
+ def getBug(response)
47
+ bug_json = JSON.parse response
48
+ bug_array = bug_json["bugs"]
49
+ return jsonToBug(bug_array[0])
50
+ end
51
+
52
+ # * Parse the JSONObject into Bug object.
53
+ #
54
+ # ==== Parameters
55
+ #
56
+ # * jsonObject:: - JSONObject contains the details of a bug.
57
+ #
58
+ # ==== Returns
59
+ #
60
+ # * Bug object.
61
+
62
+
63
+ def jsonToBug(jsonObject)
64
+ bug = Bug.new
65
+
66
+ if jsonObject.has_key?("id")
67
+ bug.setId(jsonObject["id"])
68
+ end
69
+ if jsonObject.has_key?("key")
70
+ bug.setKey(jsonObject["key"])
71
+ end
72
+
73
+ if jsonObject.has_key?("project")
74
+ bug.setProjectId(jsonObject["project"]["id"])
75
+ end
76
+
77
+ if jsonObject.has_key?("flag")
78
+ bug.setFlag(jsonObject["flag"])
79
+ end
80
+ if jsonObject.has_key?("title")
81
+ bug.setTitle(jsonObject["title"])
82
+ end
83
+ if jsonObject.has_key?("description")
84
+ bug.setDescription(jsonObject["description"])
85
+ end
86
+ if jsonObject.has_key?("reporter_id")
87
+ bug.setReporterId(jsonObject["reporter_id"])
88
+ end
89
+ if jsonObject.has_key?("reported_person")
90
+ bug.setReportedPerson(jsonObject["reported_person"])
91
+ end
92
+ if jsonObject.has_key?("created_time")
93
+ bug.setCreatedTime(jsonObject["created_time"])
94
+ end
95
+ if jsonObject.has_key?("created_time_format")
96
+ bug.setCreatedTimeFormat(jsonObject["created_time_format"])
97
+ end
98
+ if jsonObject.has_key?("created_time_long")
99
+ bug.setCreatedTimeLong(jsonObject["created_time_long"])
100
+ end
101
+ if jsonObject.has_key?("assignee_id")
102
+ bug.setAssigneeId(jsonObject["assignee_id"])
103
+ end
104
+ if jsonObject.has_key?("assignee_name")
105
+ bug.setAssigneeName(jsonObject["assignee_name"])
106
+ end
107
+ if jsonObject.has_key?("closed")
108
+ bug.setClosed(jsonObject["closed"])
109
+ end
110
+ if jsonObject.has_key?("due_date")
111
+ bug.setDueDate(jsonObject["due_date"])
112
+ end
113
+ if jsonObject.has_key?("due_date_format")
114
+ bug.setDueDateFormat(jsonObject["due_date_format"])
115
+ end
116
+ if jsonObject.has_key?("due_date_long")
117
+ bug.setDueDateLong(jsonObject["due_date_long"])
118
+ end
119
+
120
+
121
+ if jsonObject.has_key?("classification")
122
+ classification = jsonObject["classification"]
123
+
124
+ if classification.has_key?("id")
125
+ bug.setClassificationId(classification["id"])
126
+ end
127
+ if classification.has_key?("type")
128
+ bug.setClassificationType(classification["type"])
129
+ end
130
+ end
131
+
132
+ if jsonObject.has_key?("severity")
133
+ severity = jsonObject["severity"]
134
+
135
+ if severity.has_key?("id")
136
+ bug.setSeverityId(severity["id"])
137
+ end
138
+ if severity.has_key?("type")
139
+ bug.setSeverityType(severity["type"])
140
+ end
141
+ end
142
+
143
+ if jsonObject.has_key?("status")
144
+ status = jsonObject["status"]
145
+
146
+ if status.has_key?("id")
147
+ bug.setStatusId(status["id"])
148
+ end
149
+ if status.has_key?("type")
150
+ bug.setStatusType(status["type"])
151
+ end
152
+ end
153
+
154
+ if jsonObject.has_key?("reproducible")
155
+ reproducible = jsonObject["reproducible"]
156
+
157
+ if reproducible.has_key?("id")
158
+ bug.setReproducibleId(reproducible["id"])
159
+ end
160
+ if reproducible.has_key?("type")
161
+ bug.setReproducibleType(reproducible["type"])
162
+ end
163
+ end
164
+
165
+ if jsonObject.has_key?("module")
166
+ mod = jsonObject["module"]
167
+
168
+ if mod.has_key?("id")
169
+ bug.setModuleId(mod["id"])
170
+ end
171
+ if mod.has_key?("name")
172
+ bug.setModuleName(mod["name"])
173
+ end
174
+ end
175
+
176
+ if jsonObject.has_key?("link")
177
+ link = jsonObject["link"]
178
+
179
+ if link.has_key?("self")
180
+ bug.setURL(link["self"]["url"])
181
+ end
182
+
183
+ if link.has_key?("timesheet")
184
+ bug.setTimesheetURL(link["timesheet"]["url"])
185
+ end
186
+ end
187
+
188
+ return bug
189
+ end
190
+
191
+ # * Parse the JSON response and get the success message.
192
+ #
193
+ # ==== Parameters
194
+ #
195
+ # * response:: - This JSON response contains the success message.
196
+ #
197
+ # ==== Returns
198
+ #
199
+ # * String object.
200
+
201
+ def getResult(response)
202
+ jsonObject = JSON.parse response
203
+ result = jsonObject["response"]
204
+ return result
205
+ end
206
+ end
207
+ end
208
+ end