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
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OWU1ZWNhYWY5OGQ3ODU1YTk3N2FhMThjNjk2YzU4Mzg5YjMzYmEyYg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YmVhOTk3MGY5YjIyMmVjMTdjMzU2NDdkNjAyZWQ4MWY3NmI2NGNiYQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MWZkNGRmZWQzMzRlNWY4OWE3NmQxMzkwOWQ0YmRlYzA4ZTJkZWRiYWI2ZmRh
|
10
|
+
ZmVmOTdkOGI1MjA0ZDE3MDg1ZDVjMzQzOWM4MjgyMDllYTlhZTM2MGU5MDA4
|
11
|
+
ZjVkM2EyNDRjYjE2YmFlODE5YzQ0NDc0YmFlMDg2MmE2NWRmNGE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MzgwMTc3ZjU5YzNmMGRlMDIxYjA5MmZkYzk2NjU1ZDg4ZmM0ODE5NGM5MDMz
|
14
|
+
ZTcwMDZmOTg2MzE2YWFlODQ4MjczZTBhZDE4Nzc3ZGFiODFkN2IxM2NjNDk5
|
15
|
+
ZTJiNTE4MjY0YzAwZGFkOTk0OGE5YzUyMTRhOTU5NmM2YjM0ZWE=
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 TODO: Write your name
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
# ZohoProjects
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'zohoProjects'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install zohoProjects
|
18
|
+
|
19
|
+
## Documentation
|
20
|
+
|
21
|
+
[API Documentation](http://cms.zohocorp.com/export/zoho/projects/help/rest-api/portals-api.html)
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
If you want to use all our zoho projects services API you should have a valid Zoho username, password and a valid authtoken.
|
26
|
+
|
27
|
+
How to generate your authtoken? [Refer Here](http://cms.zohocorp.com/export/zoho/projects/help/rest-api/get-tickets-api.html)
|
28
|
+
|
29
|
+
If you have a valid authtoken, you are able to access our Zoho projects API wrappers.
|
30
|
+
|
31
|
+
How to access our wrapper classes? Here is a sample example code for accessing Zoho Projects.
|
32
|
+
|
33
|
+
You have to add our gem file:
|
34
|
+
|
35
|
+
require "zohoProjects"
|
36
|
+
|
37
|
+
Pass your authToken to create an instance for PortalsAPI.
|
38
|
+
|
39
|
+
You have two ways to create an instance for PortalsAPI. Here is the example code,
|
40
|
+
|
41
|
+
1) Pass your authToken and create a PortalsAPI instance:
|
42
|
+
|
43
|
+
portalsAPI = PortalsAPI.new("{auth_token}")
|
44
|
+
|
45
|
+
2) Pass your authToken and portalId to create an instance for ZohoProjects and then get the instance for PortalsAPI:
|
46
|
+
|
47
|
+
zohoProject = ZohoProject.new("{auth_token}", "{portal_id}")
|
48
|
+
|
49
|
+
portalsAPI = zohoProject.getPortalsAPI
|
50
|
+
|
51
|
+
|
52
|
+
queryMap = Hash.new
|
53
|
+
|
54
|
+
queryMap["status"] = "open"
|
55
|
+
|
56
|
+
begin
|
57
|
+
|
58
|
+
## Get the list of portals:
|
59
|
+
|
60
|
+
- - -
|
61
|
+
|
62
|
+
If you want to get all your portals, you need to call the 'getPortals' method. It returns the List of Portal object.
|
63
|
+
|
64
|
+
portals = portalsAPI.getPortals
|
65
|
+
|
66
|
+
If you want to parse the portal id from the List of Portal object then you need to write your code as mentioned below:
|
67
|
+
|
68
|
+
portalId = portals[0].getId
|
69
|
+
|
70
|
+
## Get the list of projects:
|
71
|
+
|
72
|
+
- - -
|
73
|
+
|
74
|
+
If you want to get all the projects from the portal, you need to call the 'getProjects' method by passing query string parameters.
|
75
|
+
|
76
|
+
projects = projectsAPI.getProjects(queryMap)
|
77
|
+
|
78
|
+
If you want to parse the project id from the List of Project object then you need to write your code as mentioned below:
|
79
|
+
|
80
|
+
projectId = String(projects[0].getId)
|
81
|
+
|
82
|
+
## Get the details of a project:
|
83
|
+
|
84
|
+
- - -
|
85
|
+
|
86
|
+
If you want to get the details of project, you need to call the 'get' method by passing projectId.
|
87
|
+
|
88
|
+
get = projectsAPI.get(projectId)
|
89
|
+
|
90
|
+
## Create a new project:
|
91
|
+
|
92
|
+
- - -
|
93
|
+
|
94
|
+
If you want to create a new project for the portal, you need to call the 'create' method by passing the Project object.
|
95
|
+
|
96
|
+
project = Project.new
|
97
|
+
|
98
|
+
project.setName("Test")
|
99
|
+
project.setDescription("Test project")
|
100
|
+
|
101
|
+
create = projectsAPI.create(project)
|
102
|
+
|
103
|
+
## Update the details of a project:
|
104
|
+
|
105
|
+
- - -
|
106
|
+
|
107
|
+
If you want to update the project details of a portal, you need to fetch the project details by calling the 'get' method.
|
108
|
+
|
109
|
+
If you want update the name of the project then you need to write your code as mentioned below:
|
110
|
+
|
111
|
+
get = projectsAPI.get(projectId)
|
112
|
+
|
113
|
+
get.setName("API")
|
114
|
+
|
115
|
+
update = projectsAPI.update(get)
|
116
|
+
|
117
|
+
|
118
|
+
## Delete an existing project:
|
119
|
+
|
120
|
+
- - -
|
121
|
+
|
122
|
+
If you want to delete an existing project for the portal, you need to call the `delete()` method by passing projectId.
|
123
|
+
|
124
|
+
delete = projectsAPI.delete(projectId)
|
125
|
+
|
126
|
+
|
127
|
+
## Catch the exception:
|
128
|
+
|
129
|
+
- - -
|
130
|
+
|
131
|
+
When calling Zoho Projects API wrappers if there is any error then the respective class throws the ProjectsException. You need to catch the ProjectsException as mentioned below:
|
132
|
+
|
133
|
+
rescue ProjectsException => pe
|
134
|
+
puts "Code: " + String(pe.getCode)
|
135
|
+
puts "Message: " + pe.getMessage
|
136
|
+
end
|
137
|
+
|
138
|
+
See [Here](../../tree/master/lib/test) for full examples.
|
139
|
+
## Contributing
|
140
|
+
|
141
|
+
1. Fork it ( https://github.com/[my-github-username]/zohoProjects/fork )
|
142
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
143
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
144
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
145
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# $Id$
|
2
|
+
module Projects
|
3
|
+
module Api
|
4
|
+
# * API is used to maintain the base URL and makes a query map using User's authToken and filters.
|
5
|
+
|
6
|
+
class API
|
7
|
+
|
8
|
+
public
|
9
|
+
@@baseURL = "https://projectsapi.zoho.com/restapi/";
|
10
|
+
protected
|
11
|
+
attr_accessor :authToken, :portalId
|
12
|
+
|
13
|
+
public
|
14
|
+
|
15
|
+
# * Construct a new API using User's authToken and portalId.
|
16
|
+
#
|
17
|
+
# ==== Parameters
|
18
|
+
#
|
19
|
+
# * authToken:: - User's authToken.
|
20
|
+
#
|
21
|
+
# * portalId:: - User's portalId.
|
22
|
+
|
23
|
+
def initialize(authToken, portalId)
|
24
|
+
@authToken = authToken
|
25
|
+
@portalId = portalId
|
26
|
+
end
|
27
|
+
|
28
|
+
public
|
29
|
+
|
30
|
+
# * Get the base URL of the service.
|
31
|
+
#
|
32
|
+
# ==== Returns
|
33
|
+
#
|
34
|
+
# * Base URL.
|
35
|
+
|
36
|
+
def getBaseURL
|
37
|
+
return @@baseURL+"portal/"+String(portalId)+"/";
|
38
|
+
end
|
39
|
+
|
40
|
+
# * Creates a query map using User's authToken and filters.
|
41
|
+
# ==== Returns
|
42
|
+
#
|
43
|
+
# * HashMap.
|
44
|
+
|
45
|
+
def getQueryMap(queryMap=nil)
|
46
|
+
if queryMap != nil
|
47
|
+
queryMap1 = queryMap
|
48
|
+
queryMap1["authtoken"] = authToken
|
49
|
+
else
|
50
|
+
queryMap1 = Hash.new
|
51
|
+
queryMap1["authtoken"] = authToken
|
52
|
+
end
|
53
|
+
return queryMap1
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,135 @@
|
|
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/BugParser'
|
8
|
+
|
9
|
+
# * BugsAPI is used to:
|
10
|
+
#
|
11
|
+
# * Get list of bugs.
|
12
|
+
#
|
13
|
+
# * Get the details of a bug.
|
14
|
+
#
|
15
|
+
# * Creates a bug.
|
16
|
+
#
|
17
|
+
# * Update the details of a bug.
|
18
|
+
#
|
19
|
+
# * Delete an existing bug.
|
20
|
+
|
21
|
+
class BugsAPI < API
|
22
|
+
include Projects::Parser
|
23
|
+
include Projects::Util
|
24
|
+
# * BugParser is used to parse the JSON response into respective objects.
|
25
|
+
|
26
|
+
$bugParser = BugParser.new
|
27
|
+
|
28
|
+
# * Construct a BugsAPI using User's authToken and portalId.
|
29
|
+
#
|
30
|
+
# ==== Parameters
|
31
|
+
#
|
32
|
+
# * authToken:: - User's authToken.
|
33
|
+
#
|
34
|
+
# * portalId:: - User's portalId.
|
35
|
+
|
36
|
+
|
37
|
+
def initialize(authToken,portalId)
|
38
|
+
super(authToken,portalId)
|
39
|
+
end
|
40
|
+
|
41
|
+
# * Get list of bugs for the project.
|
42
|
+
#
|
43
|
+
# ==== Parameters
|
44
|
+
#
|
45
|
+
# * projectId:: - ID of the project.
|
46
|
+
#
|
47
|
+
# * queryMap:: - This queryMap contains the filters in the form of key-value pair.
|
48
|
+
#
|
49
|
+
# ==== Returns
|
50
|
+
#
|
51
|
+
# * List of Bug object.
|
52
|
+
|
53
|
+
|
54
|
+
def getBugs(projectId, queryMap)
|
55
|
+
url = getBaseURL+"projects/"+String(projectId)+"/bugs/"
|
56
|
+
response = ZohoHTTPClient.get(url, getQueryMap(queryMap))
|
57
|
+
return $bugParser.getBugs(response)
|
58
|
+
end
|
59
|
+
|
60
|
+
# * Get the details of a bug.
|
61
|
+
#
|
62
|
+
# ==== Parameters
|
63
|
+
#
|
64
|
+
# * projectId:: - ID of the project.
|
65
|
+
#
|
66
|
+
# * bugId:: - ID of the bug.
|
67
|
+
#
|
68
|
+
# ==== Return
|
69
|
+
#
|
70
|
+
# * Bug object.
|
71
|
+
|
72
|
+
|
73
|
+
def get(projectId, bugId)
|
74
|
+
url = getBaseURL+"projects/"+String(projectId)+"/bugs/"+String(bugId)+"/"
|
75
|
+
response = ZohoHTTPClient.get(url, getQueryMap)
|
76
|
+
return $bugParser.getBug(response)
|
77
|
+
end
|
78
|
+
|
79
|
+
# * Create a Bug for the project.
|
80
|
+
#
|
81
|
+
# ==== Parameters
|
82
|
+
#
|
83
|
+
# * projectId:: - ID of the project.
|
84
|
+
#
|
85
|
+
# * bug:: - Bug object.
|
86
|
+
#
|
87
|
+
# ==== Returns
|
88
|
+
#
|
89
|
+
# * Bug object.
|
90
|
+
|
91
|
+
|
92
|
+
def create(projectId, bug)
|
93
|
+
url = getBaseURL+"projects/"+String(projectId)+"/bugs/"
|
94
|
+
response = ZohoHTTPClient.post(url, getQueryMap, bug.toParamMAP)
|
95
|
+
return $bugParser.getBug(response)
|
96
|
+
end
|
97
|
+
|
98
|
+
# * Update the details of a bug.
|
99
|
+
#
|
100
|
+
# ==== Parameters
|
101
|
+
#
|
102
|
+
# * projectId:: - ID of the project.
|
103
|
+
#
|
104
|
+
# * bug:: - Bug object.
|
105
|
+
#
|
106
|
+
# ==== Returns
|
107
|
+
#
|
108
|
+
# * Bug object.
|
109
|
+
|
110
|
+
def update(projectId, bug)
|
111
|
+
url = getBaseURL+"projects/"+String(projectId)+"/bugs/"+String(bug.getId)+"/"
|
112
|
+
response = ZohoHTTPClient.post(url, getQueryMap, bug.toParamMAP)
|
113
|
+
return $bugParser.getBug(response)
|
114
|
+
end
|
115
|
+
|
116
|
+
# * Delete an existing bug for the project.
|
117
|
+
#
|
118
|
+
# ==== Parameters
|
119
|
+
#
|
120
|
+
# * projectId:: - ID of the project.
|
121
|
+
#
|
122
|
+
# * bugId:: - ID of the bug.
|
123
|
+
#
|
124
|
+
# ==== Returns
|
125
|
+
#
|
126
|
+
# * String containg result of delete.
|
127
|
+
|
128
|
+
def delete(projectId, bugId)
|
129
|
+
url = getBaseURL+"projects/"+String(projectId)+"/bugs/"+String(bugId)+"/"
|
130
|
+
response = ZohoHTTPClient.delete(url, getQueryMap)
|
131
|
+
return $bugParser.getResult(response)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,145 @@
|
|
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/DocumentParser'
|
8
|
+
|
9
|
+
# * DocumentsAPI is used to:
|
10
|
+
#
|
11
|
+
# * Get list of documents.
|
12
|
+
#
|
13
|
+
# * Get the details of a document.
|
14
|
+
#
|
15
|
+
# * Add a document.
|
16
|
+
#
|
17
|
+
# * Update the details of a document.
|
18
|
+
#
|
19
|
+
# * Delete an existing document.
|
20
|
+
|
21
|
+
|
22
|
+
class DocumentsAPI < API
|
23
|
+
include Projects::Parser
|
24
|
+
include Projects::Util
|
25
|
+
# * DocumentParser is used to parse the JSON response into respective objects.
|
26
|
+
|
27
|
+
$documentParser = DocumentParser.new
|
28
|
+
|
29
|
+
# * Construct a new DocumentsAPI using User's authToken and portalId.
|
30
|
+
#
|
31
|
+
# ==== Parameters
|
32
|
+
#
|
33
|
+
# * authToken:: - User's authToken.
|
34
|
+
#
|
35
|
+
# * portalId:: - User's portalId.
|
36
|
+
|
37
|
+
|
38
|
+
def initialize(authToken,portalId)
|
39
|
+
super(authToken,portalId)
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
# * Get list of documents for the project.
|
44
|
+
#
|
45
|
+
# ==== Parameters
|
46
|
+
#
|
47
|
+
# * projectId:: - ID of the project.
|
48
|
+
#
|
49
|
+
# * queryMap:: - This queryMap contains the filters in the form of key-value pair.
|
50
|
+
#
|
51
|
+
# ==== Returns
|
52
|
+
#
|
53
|
+
# * List of Document object.
|
54
|
+
|
55
|
+
|
56
|
+
def getDocuments(projectId, queryMap)
|
57
|
+
url = getBaseURL+"projects/"+String(projectId)+"/documents/"
|
58
|
+
response = ZohoHTTPClient.get(url, getQueryMap(queryMap))
|
59
|
+
return $documentParser.getDocuments(response)
|
60
|
+
end
|
61
|
+
|
62
|
+
# * Get the details of a document.
|
63
|
+
#
|
64
|
+
# ==== Parameters
|
65
|
+
#
|
66
|
+
# * projectId:: - ID of the project.
|
67
|
+
#
|
68
|
+
# * documentId:: - ID of the document.
|
69
|
+
#
|
70
|
+
# * queryMap:: - This queryMap contains the filters in the form of key-value pair.
|
71
|
+
#
|
72
|
+
# ==== Returns
|
73
|
+
#
|
74
|
+
# * Document object.
|
75
|
+
|
76
|
+
|
77
|
+
def get(projectId, documentId, queryMap)
|
78
|
+
url = getBaseURL+"projects/"+String(projectId)+"/documents/"+String(documentId)+"/"
|
79
|
+
response = ZohoHTTPClient.get(url, getQueryMap(queryMap))
|
80
|
+
return $documentParser.getDocument(response)
|
81
|
+
end
|
82
|
+
|
83
|
+
# * Add a document for the project.
|
84
|
+
#
|
85
|
+
# ==== Parameters
|
86
|
+
#
|
87
|
+
# * projectId:: - Id of the project.
|
88
|
+
#
|
89
|
+
# * document:: - Document object.
|
90
|
+
#
|
91
|
+
# ==== Returns
|
92
|
+
#
|
93
|
+
# * Document object.
|
94
|
+
|
95
|
+
def add(projectId, document)
|
96
|
+
url = getBaseURL+"projects/"+String(projectId)+"/documents/"
|
97
|
+
fileBody = Hash.new
|
98
|
+
fileBody["uploaddoc"] = document.getUploaddoc
|
99
|
+
response = ZohoHTTPClient.post(url, getQueryMap, document.toParamMAP, fileBody)
|
100
|
+
return $documentParser.getDocument(response)
|
101
|
+
end
|
102
|
+
|
103
|
+
# * Update the details of a document.
|
104
|
+
#
|
105
|
+
# ==== Attributes
|
106
|
+
#
|
107
|
+
# * projectId:: - ID of the project.
|
108
|
+
#
|
109
|
+
# * document:: - Document object.
|
110
|
+
#
|
111
|
+
# ==== Returns
|
112
|
+
#
|
113
|
+
# * Document object.
|
114
|
+
|
115
|
+
|
116
|
+
def update(projectId, document)
|
117
|
+
url = getBaseURL+"projects/"+String(projectId)+"/documents/"+String(document.getId)+"/"
|
118
|
+
fileBody = Hash.new
|
119
|
+
fileBody["uploaddoc"] = document.getUploaddoc
|
120
|
+
response = ZohoHTTPClient.post(url, getQueryMap, document.toParamMAP, fileBody)
|
121
|
+
return $documentParser.getDocument(response)
|
122
|
+
end
|
123
|
+
|
124
|
+
|
125
|
+
# * Delete an existing document for the project.
|
126
|
+
#
|
127
|
+
# ==== Attributes
|
128
|
+
#
|
129
|
+
# * projectId:: - ID of the project.
|
130
|
+
#
|
131
|
+
# * documentId:: - ID of the document.
|
132
|
+
#
|
133
|
+
# ==== Returns
|
134
|
+
#
|
135
|
+
# * return Returns the String object.
|
136
|
+
|
137
|
+
|
138
|
+
def delete(projectId, documentId)
|
139
|
+
url = getBaseURL+"projects/"+String(projectId)+"/documents/"+String(documentId)+"/"
|
140
|
+
response = Projects::Util::ZohoHTTPClient.delete(url, getQueryMap)
|
141
|
+
return $documentParser.getResult(response)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|