Class: Projects::Api::API

Inherits:
Object
  • Object
show all
Defined in:
lib/projects/api/API.rb

Overview

  • API is used to maintain the base URL and makes a query map using User’s authToken and filters.

Constant Summary collapse

@@baseURL =
"https://projectsapi.zoho.com/restapi/"

Instance Method Summary collapse

Constructor Details

#initialize(authToken, portalId) ⇒ API

  • Construct a new API using User’s authToken and portalId.

Parameters

  • authToken
    • User’s authToken.

  • portalId
    • User’s portalId.



23
24
25
26
# File 'lib/projects/api/API.rb', line 23

def initialize(authToken, portalId)
 	@authToken = authToken
 	@portalId = portalId
end

Instance Method Details

#getBaseURLObject

  • Get the base URL of the service.

Returns

  • Base URL.



36
37
38
# File 'lib/projects/api/API.rb', line 36

def getBaseURL
	return @@baseURL+"portal/"+String(portalId)+"/";
end

#getQueryMap(queryMap = nil) ⇒ Object

  • Creates a query map using User’s authToken and filters.

Returns

  • HashMap.



45
46
47
48
49
50
51
52
53
54
# File 'lib/projects/api/API.rb', line 45

def getQueryMap(queryMap=nil)
	if queryMap != nil
		queryMap1 = queryMap
		queryMap1["authtoken"] = authToken
	else
		queryMap1 = Hash.new
		queryMap1["authtoken"] = authToken
	end
return queryMap1
end