Class: TrainPlugins::Rest::AuthHandler
- Inherits:
-
Object
- Object
- TrainPlugins::Rest::AuthHandler
- Defined in:
- lib/train-rest/auth_handler.rb
Overview
Class to derive authentication handlers from.
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
-
.descendants ⇒ Array
List authentication handlers.
-
.name ⇒ String
Return name of handler.
Instance Method Summary collapse
-
#auth_headers ⇒ Hash
Headers added to the rest-client call.
-
#auth_parameters ⇒ Hash
These will get added to the rest-client call.
-
#check_options ⇒ Object
Verify transport options.
-
#initialize(connection = nil) ⇒ AuthHandler
constructor
A new instance of AuthHandler.
-
#login ⇒ Object
Handle Login.
-
#logout ⇒ Object
Handle Logout.
Constructor Details
#initialize(connection = nil) ⇒ AuthHandler
Returns a new instance of AuthHandler.
8 9 10 |
# File 'lib/train-rest/auth_handler.rb', line 8 def initialize(connection = nil) @connection = connection end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
5 6 7 |
# File 'lib/train-rest/auth_handler.rb', line 5 def connection @connection end |
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/train-rest/auth_handler.rb', line 6 def end |
Class Method Details
.descendants ⇒ Array
List authentication handlers
56 57 58 |
# File 'lib/train-rest/auth_handler.rb', line 56 def self.descendants ObjectSpace.each_object(Class).select { |klass| klass < self } end |
.name ⇒ String
Return name of handler
15 16 17 |
# File 'lib/train-rest/auth_handler.rb', line 15 def self.name self.to_s.split("::").last.downcase end |
Instance Method Details
#auth_headers ⇒ Hash
Headers added to the rest-client call
41 42 43 |
# File 'lib/train-rest/auth_handler.rb', line 41 def auth_headers {} end |
#auth_parameters ⇒ Hash
These will get added to the rest-client call.
49 50 51 |
# File 'lib/train-rest/auth_handler.rb', line 49 def auth_parameters { headers: auth_headers } end |
#check_options ⇒ Object
Verify transport options
30 |
# File 'lib/train-rest/auth_handler.rb', line 30 def ; end |
#login ⇒ Object
Handle Login
33 |
# File 'lib/train-rest/auth_handler.rb', line 33 def login; end |
#logout ⇒ Object
Handle Logout
36 |
# File 'lib/train-rest/auth_handler.rb', line 36 def logout; end |