Class: IdnSdkRuby::Com::Nbos::Capi::Api::V0::InMemoryApiContext
- Inherits:
-
AbstractApiContext
- Object
- ApiContext
- AbstractApiContext
- IdnSdkRuby::Com::Nbos::Capi::Api::V0::InMemoryApiContext
- 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
Instance Method Summary collapse
- #getClientCredentials ⇒ Object
- #getClientToken(scope = nil) ⇒ Object
- #getHost(moduleName) ⇒ Object
- #getName ⇒ Object
- #getUserToken(moduleName) ⇒ Object
-
#initialize(name) ⇒ InMemoryApiContext
constructor
A new instance of InMemoryApiContext.
- #setClientCredentials(map) ⇒ Object
- #setClientToken(tokenApiModel) ⇒ Object
- #setHost(moduleName, host) ⇒ Object
- #setUserToken(moduleName, tokenApiModel) ⇒ Object
Methods inherited from AbstractApiContext
Methods inherited from ApiContext
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
#getClientCredentials ⇒ Object
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 |
#getName ⇒ Object
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 |