Class: Projects::Api::BugsAPI

Inherits:
API
  • Object
show all
Includes:
Parser, Util
Defined in:
lib/projects/api/BugsAPI.rb

Overview

  • BugsAPI is used to:

  • Get list of bugs.

  • Get the details of a bug.

  • Creates a bug.

  • Update the details of a bug.

  • Delete an existing bug.

Instance Method Summary collapse

Methods inherited from API

#getBaseURL, #getQueryMap

Constructor Details

#initialize(authToken, portalId) ⇒ BugsAPI

Returns a new instance of BugsAPI.



37
38
39
# File 'lib/projects/api/BugsAPI.rb', line 37

def initialize(authToken,portalId)
	super(authToken,portalId)
end

Instance Method Details

#create(projectId, bug) ⇒ Object



92
93
94
95
96
# File 'lib/projects/api/BugsAPI.rb', line 92

def create(projectId, bug)
	url = getBaseURL+"projects/"+String(projectId)+"/bugs/"		
	response = ZohoHTTPClient.post(url, getQueryMap, bug.toParamMAP)		
	return $bugParser.getBug(response)
end

#delete(projectId, bugId) ⇒ Object

  • Delete an existing bug for the project.

Parameters

  • projectId
    • ID of the project.

  • bugId
    • ID of the bug.

Returns

  • String containg result of delete.



128
129
130
131
132
# File 'lib/projects/api/BugsAPI.rb', line 128

def delete(projectId, bugId)
	url = getBaseURL+"projects/"+String(projectId)+"/bugs/"+String(bugId)+"/"		
	response = ZohoHTTPClient.delete(url, getQueryMap)		
	return $bugParser.getResult(response)
end

#get(projectId, bugId) ⇒ Object



73
74
75
76
77
# File 'lib/projects/api/BugsAPI.rb', line 73

def get(projectId, bugId)
	url = getBaseURL+"projects/"+String(projectId)+"/bugs/"+String(bugId)+"/"		
	response = ZohoHTTPClient.get(url, getQueryMap)		
	return $bugParser.getBug(response)
end

#getBugs(projectId, queryMap) ⇒ Object



54
55
56
57
58
# File 'lib/projects/api/BugsAPI.rb', line 54

def getBugs(projectId, queryMap)
	url = getBaseURL+"projects/"+String(projectId)+"/bugs/"		
	response = ZohoHTTPClient.get(url, getQueryMap(queryMap))	
	return $bugParser.getBugs(response)
end

#getCustomfields(projectId) ⇒ Object

  • Get all the custom fields in the given project.

Parameters

  • projectId
    • ID of the project.

Returns

  • Returns list of Customfield object.



168
169
170
171
172
173
174
175
176
# File 'lib/projects/api/BugsAPI.rb', line 168

def getCustomfields(projectId)

	url = getBaseURL+"projects/"+String(projectId)+"/customfields/"
	
	response = ZohoHTTPClient.get(url, getQueryMap)
	
	return @bugParser.getCustomfields(response)
	
end

#getDefaultfields(projectId) ⇒ Object



146
147
148
149
150
151
152
153
154
# File 'lib/projects/api/BugsAPI.rb', line 146

def getDefaultfields(projectId)

	url = getBaseURL+"projects/"+String(projectId)+"/defaultfields/"
	
	response = ZohoHTTPClient.get(url, getQueryMap)
	
	return @bugParser.getDefaultfields(response)
	
end

#update(projectId, bug) ⇒ Object

  • Update the details of a bug.

Parameters

  • projectId
    • ID of the project.

  • bug
    • Bug object.

Returns

  • Bug object.



110
111
112
113
114
# File 'lib/projects/api/BugsAPI.rb', line 110

def update(projectId, bug)
	url = getBaseURL+"projects/"+String(projectId)+"/bugs/"+String(bug.getId)+"/"		
	response = ZohoHTTPClient.post(url, getQueryMap, bug.toParamMAP)		
	return $bugParser.getBug(response)
end