class Projects::Api::DocumentsAPI

Public Class Methods

new(authToken,portalId) click to toggle source
  • Construct a new DocumentsAPI using User's authToken and portalId.

Parameters

  • authToken
    • User's authToken.

  • portalId
    • User's portalId.

Calls superclass method Projects::Api::API::new
# File lib/projects/api/DocumentsAPI.rb, line 38
def initialize(authToken,portalId)
        super(authToken,portalId)
end

Public Instance Methods

add(projectId, document) click to toggle source
  • Add a document for the project.

Parameters

  • projectId
    • Id of the project.

  • document
    • Document object.

Returns

  • Document object.

# File lib/projects/api/DocumentsAPI.rb, line 95
def add(projectId, document)
        url = getBaseURL+"projects/"+String(projectId)+"/documents/"
        fileBody = Hash.new
        fileBody["uploaddoc"] = document.getUploaddoc
        response = ZohoHTTPClient.post(url, getQueryMap, document.toParamMAP, fileBody)             
        return $documentParser.getDocument(response)
end
delete(projectId, documentId) click to toggle source
  • Delete an existing document for the project.

Attributes

  • projectId
    • ID of the project.

  • documentId
    • ID of the document.

Returns

  • return Returns the String object.

# File lib/projects/api/DocumentsAPI.rb, line 138
def delete(projectId, documentId)
        url = getBaseURL+"projects/"+String(projectId)+"/documents/"+String(documentId)+"/"
        response = Projects::Util::ZohoHTTPClient.delete(url, getQueryMap)          
        return $documentParser.getResult(response)
end
get(projectId, documentId, queryMap) click to toggle source
  • Get the details of a document.

Parameters

  • projectId
    • ID of the project.

  • documentId
    • ID of the document.

  • queryMap
    • This queryMap contains the filters in the form of key-value pair.

Returns

  • Document object.

# File lib/projects/api/DocumentsAPI.rb, line 77
def get(projectId, documentId, queryMap)
        url = getBaseURL+"projects/"+String(projectId)+"/documents/"+String(documentId)+"/"
        response = ZohoHTTPClient.get(url, getQueryMap(queryMap))           
        return $documentParser.getDocument(response)
end
getDocuments(projectId, queryMap) click to toggle source
  • Get list of documents for the project.

Parameters

  • projectId
    • ID of the project.

  • queryMap
    • This queryMap contains the filters in the form of key-value pair.

Returns

  • List of Document object.

# File lib/projects/api/DocumentsAPI.rb, line 56
def getDocuments(projectId, queryMap)                
        url = getBaseURL+"projects/"+String(projectId)+"/documents/"                
        response = ZohoHTTPClient.get(url, getQueryMap(queryMap))           
        return $documentParser.getDocuments(response)
end
update(projectId, document) click to toggle source
  • Update the details of a document.

Attributes

  • projectId
    • ID of the project.

  • document
    • Document object.

Returns

  • Document object.

# File lib/projects/api/DocumentsAPI.rb, line 116
def update(projectId, document)
        url = getBaseURL+"projects/"+String(projectId)+"/documents/"+String(document.getId)+"/"
        fileBody = Hash.new 
        fileBody["uploaddoc"] = document.getUploaddoc
        response = ZohoHTTPClient.post(url, getQueryMap, document.toParamMAP, fileBody)             
        return $documentParser.getDocument(response)
end