Class: Projects::Api::ForumsAPI
- Defined in:
- lib/projects/api/ForumsAPI.rb
Overview
-
ForumsAPI is used to:
-
Get list of forums.
-
Add a forum.
-
Update the details of a forum.
-
Delete an existing forum.
-
Get list of categories.
-
Add a category.
-
Get list of comments.
-
Add a comment.
Instance Method Summary collapse
- #add(projectId, forum) ⇒ Object
-
#addCategory(projectId, category) ⇒ Object
- Add a category for the project.
-
#addComment(projectId, forumId, comment) ⇒ Object
- Add comment for the forum.
-
#delete(projectId, forumId) ⇒ Object
- Delete an existing forum for the project.
-
#getCategories(projectId) ⇒ Object
- Get list of categories for the project.
-
#getComments(projectId, forumId, queryMap) ⇒ Object
- Get list of Comment for the forum.
- #getForums(projectId, queryMap) ⇒ Object
-
#initialize(authToken, portalId) ⇒ ForumsAPI
constructor
- Construct a new FoumsAPI using User's authToken and portalId.
-
#update(projectId, forum) ⇒ Object
- update the details of a forum.
Methods inherited from API
Constructor Details
#initialize(authToken, portalId) ⇒ ForumsAPI
- Construct a new FoumsAPI using User's authToken and portalId.
Parameters
- * authToken
- User's authToken.
- * portalId
- User's prtalId.
42 43 44 |
# File 'lib/projects/api/ForumsAPI.rb', line 42 def initialize(authToken,portalId) super(authToken,portalId) end |
Instance Method Details
#add(projectId, forum) ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/projects/api/ForumsAPI.rb', line 77 def add(projectId, forum) url = getBaseURL+"projects/"+String(projectId)+"/forums/" fileBody = Hash.new fileBody["uploadfile"] = forum.getUploadfile response = ZohoHTTPClient.post(url, getQueryMap, forum.toParamMAP, fileBody) return $forumParser.getForum(response) end |
#addCategory(projectId, category) ⇒ Object
- Add a category for the project.
Parameters
- * projectId
- ID of the project.
- * category
- Category object.
Returns
- Category object.
151 152 153 154 155 |
# File 'lib/projects/api/ForumsAPI.rb', line 151 def addCategory(projectId, category) url = getBaseURL+"projects/"+String(projectId)+"/categories/" response = ZohoHTTPClient.post(url, getQueryMap, category.toParamMAP) return $forumParser.getCategory(response) end |
#addComment(projectId, forumId, comment) ⇒ Object
- Add comment for the forum.
Parameters
- * projectId
- ID of the project.
- * forumId
- ID of the forum.
- * comment
- Comment object.
Returns
- Comment object.
191 192 193 194 195 |
# File 'lib/projects/api/ForumsAPI.rb', line 191 def addComment(projectId, forumId, comment) url = getBaseURL+"projects/"+String(projectId)+"/forums/"+String(forumId)+"/comments/" response = ZohoHTTPClient.post(url, getQueryMap, comment.toParamMAP) return $forumParser.getComment(response) end |
#delete(projectId, forumId) ⇒ Object
- Delete an existing forum for the project.
Parameters
- * projectId
- ID of the project.
- * forumId
- ID of the forum.
Returns
- String object.
117 118 119 120 121 |
# File 'lib/projects/api/ForumsAPI.rb', line 117 def delete(projectId, forumId) url = getBaseURL+"projects/"+String(projectId)+"/forums/"+String(forumId)+"/" response = ZohoHTTPClient.delete(url, getQueryMap) return $forumParser.getResult(response) end |
#getCategories(projectId) ⇒ Object
- Get list of categories for the project.
Parameters
- * projectId
- ID of the project.
Returns
- List of Category object.
133 134 135 136 137 |
# File 'lib/projects/api/ForumsAPI.rb', line 133 def getCategories(projectId) url = getBaseURL+"projects/"+String(projectId)+"/categories/" response = ZohoHTTPClient.get(url, getQueryMap) return $forumParser.getCategories(response) end |
#getComments(projectId, forumId, queryMap) ⇒ Object
- Get list of Comment for the forum.
Parameters
- * projectId
- ID of the project.
- * forumId
- ID of the forum.
- * queryMap
- This queryMap contains the filters in the form of key-value pair.
Returns
- List of Comment object.
171 172 173 174 175 |
# File 'lib/projects/api/ForumsAPI.rb', line 171 def getComments(projectId, forumId, queryMap) url = getBaseURL+"projects/"+String(projectId)+"/forums/"+String(forumId)+"/comments/" response = ZohoHTTPClient.get(url, getQueryMap(queryMap)) return $forumParser.getComments(response) end |
#getForums(projectId, queryMap) ⇒ Object
58 59 60 61 62 |
# File 'lib/projects/api/ForumsAPI.rb', line 58 def getForums(projectId, queryMap) url = getBaseURL+"projects/"+String(projectId)+"/forums/" response = ZohoHTTPClient.get(url, getQueryMap(queryMap)) return $forumParser.getForums(response) end |
#update(projectId, forum) ⇒ Object
- update the details of a forum.
Parameters
- * projectId
- ID of the project.
- * forum
- Forum object.
Returns
- Forum object.
97 98 99 100 101 102 103 |
# File 'lib/projects/api/ForumsAPI.rb', line 97 def update(projectId, forum) url = getBaseURL+"projects/"+String(projectId)+"/forums/"+String(forum.getId)+"/" fileBody = Hash.new fileBody["uploadfile"] = forum.getUploadfile response = ZohoHTTPClient.post(url, getQueryMap, forum.toParamMAP, fileBody) return $forumParser.getForum(response) end |