Class: IdnSdkRuby::Com::Nbos::Capi::Api::V0::AbstractApiContext
- Inherits:
-
ApiContext
- Object
- ApiContext
- IdnSdkRuby::Com::Nbos::Capi::Api::V0::AbstractApiContext
- Defined in:
- lib/idn_sdk_ruby/com/nbos/capi/api/v0/abstract_api_context.rb
Direct Known Subclasses
Constant Summary collapse
- @@apiContexts =
{}
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name = nil) ⇒ AbstractApiContext
constructor
A new instance of AbstractApiContext.
Methods inherited from ApiContext
#getClientCredentials, #getClientToken, #getHost, #getName, #getUserToken, #init, #setClientCredentials, #setClientToken, #setHost, #setUserToken
Constructor Details
#initialize(name = nil) ⇒ AbstractApiContext
Returns a new instance of AbstractApiContext.
6 7 8 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/abstract_api_context.rb', line 6 def initialize(name = nil) @name = (name != nil && !name.empty?) ? name : "app" end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/abstract_api_context.rb', line 2 def name @name end |
Class Method Details
.get(name) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/abstract_api_context.rb', line 15 def self.get(name) ctx = @@apiContexts[name] if (ctx == nil) ctx = IdnSdkRuby::Com::Nbos::Capi::Api::V0::InMemoryApiContext.new(name) IdnSdkRuby::Com::Nbos::Capi::Api::V0::AbstractApiContext.registerApiContext(ctx) end return ctx end |
.registerApiContext(apiContext) ⇒ Object
10 11 12 13 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/api/v0/abstract_api_context.rb', line 10 def self.registerApiContext(apiContext) @@apiContexts[apiContext.getName()] = apiContext puts "Registered Contexts with API Context = >#{@@apiContexts}" end |