Class: IdnSdkRuby::Com::Nbos::Capi::Api::V0::InMemoryApiContext

Inherits:
AbstractApiContext show all
Defined in:
lib/idn_sdk_ruby/com/nbos/capi/api/v0/in_memory_api_context.rb

Constant Summary collapse

@@store =
Hash.new
@@hosts =
Hash.new
@@tokens =
Hash.new

Instance Attribute Summary

Attributes inherited from AbstractApiContext

#name

Instance Method Summary collapse

Methods inherited from AbstractApiContext

get, registerApiContext

Methods inherited from ApiContext

#init

Constructor Details

#initialize(name) ⇒ InMemoryApiContext

Returns a new instance of InMemoryApiContext.



7
8
9
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/in_memory_api_context.rb', line 7

def initialize(name)
	super(name)
end

Instance Method Details

#getClientCredentialsObject



16
17
18
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/in_memory_api_context.rb', line 16

def getClientCredentials
	return @@store["client.credentials"]
end

#getClientToken(scope = nil) ⇒ Object



28
29
30
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/in_memory_api_context.rb', line 28

def getClientToken(scope = nil)
		return @@store["token.client"]
end

#getHost(moduleName) ⇒ Object



53
54
55
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/in_memory_api_context.rb', line 53

def getHost(moduleName)
		return @@hosts[moduleName]
end

#getNameObject



11
12
13
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/in_memory_api_context.rb', line 11

def getName
	return name
end

#getUserToken(moduleName) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/in_memory_api_context.rb', line 39

def getUserToken(moduleName)
		 tokenApiModel = @@tokens[moduleName]
		if (tokenApiModel == nil)
				tokenApiModel = @@tokens["."]
		end
		return tokenApiModel
end

#setClientCredentials(map) ⇒ Object



20
21
22
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/in_memory_api_context.rb', line 20

def setClientCredentials(map)
	@@store["client.credentials"] = map
end

#setClientToken(tokenApiModel) ⇒ Object



24
25
26
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/in_memory_api_context.rb', line 24

def setClientToken(tokenApiModel)
	@@store["token.client"]=tokenApiModel
end

#setHost(moduleName, host) ⇒ Object



48
49
50
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/in_memory_api_context.rb', line 48

def setHost(moduleName, host)
		@@hosts[moduleName] = host
end

#setUserToken(moduleName, tokenApiModel) ⇒ Object



32
33
34
35
36
37
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/in_memory_api_context.rb', line 32

def setUserToken(moduleName, tokenApiModel)
		@@tokens[moduleName] = tokenApiModel
		if (@@tokens.size == 0) 
				@@tokens["."]=tokenApiModel
		end
end