Class: Occi::Api::Client::Http::AuthnPlugins::Base
- Inherits:
-
Object
- Object
- Occi::Api::Client::Http::AuthnPlugins::Base
- Defined in:
- lib/occi/api/client/http/authn_plugins/base.rb
Instance Attribute Summary collapse
-
#env_ref ⇒ Object
readonly
Returns the value of attribute env_ref.
-
#fallbacks ⇒ Object
readonly
Returns the value of attribute fallbacks.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #authenticate(options = {}) ⇒ Object
-
#initialize(env_ref, options = {}) ⇒ Base
constructor
A new instance of Base.
- #setup(options = {}) ⇒ Object
Constructor Details
#initialize(env_ref, options = {}) ⇒ Base
Returns a new instance of Base.
10 11 12 13 14 |
# File 'lib/occi/api/client/http/authn_plugins/base.rb', line 10 def initialize(env_ref, = {}) = @env_ref = env_ref @fallbacks = [] end |
Instance Attribute Details
#env_ref ⇒ Object (readonly)
Returns the value of attribute env_ref.
6 7 8 |
# File 'lib/occi/api/client/http/authn_plugins/base.rb', line 6 def env_ref @env_ref end |
#fallbacks ⇒ Object (readonly)
Returns the value of attribute fallbacks.
8 9 10 |
# File 'lib/occi/api/client/http/authn_plugins/base.rb', line 8 def fallbacks @fallbacks end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/occi/api/client/http/authn_plugins/base.rb', line 7 def end |
Instance Method Details
#authenticate(options = {}) ⇒ Object
18 19 20 21 |
# File 'lib/occi/api/client/http/authn_plugins/base.rb', line 18 def authenticate( = {}) response = @env_ref.class.get("#{@env_ref.endpoint.to_s}/-/") raise ::Occi::Api::Client::Errors::AuthnError, "Authentication failed with code #{response.code.to_s}!" unless response.success? end |
#setup(options = {}) ⇒ Object
16 |
# File 'lib/occi/api/client/http/authn_plugins/base.rb', line 16 def setup( = {}); end |