class TrainPlugins::Rest::AuthHandler
Class to derive authentication handlers from.
Attributes
connection[RW]
options[R]
Public Class Methods
descendants()
click to toggle source
List authentication handlers
@return [Array] Classes derived from `AuthHandler`
# File lib/train-rest/auth_handler.rb, line 56 def self.descendants ObjectSpace.each_object(Class).select { |klass| klass < self } end
name()
click to toggle source
Return name of handler
@return [String]
# File lib/train-rest/auth_handler.rb, line 15 def self.name self.to_s.split("::").last.downcase end
new(connection = nil)
click to toggle source
# File lib/train-rest/auth_handler.rb, line 8 def initialize(connection = nil) @connection = connection end
Public Instance Methods
auth_headers()
click to toggle source
Headers added to the rest-client call
@return [Hash]
# File lib/train-rest/auth_handler.rb, line 41 def auth_headers {} end
auth_parameters()
click to toggle source
These will get added to the rest-client call.
@return [Hash] @see www.rubydoc.info/gems/rest-client/RestClient/Request
# File lib/train-rest/auth_handler.rb, line 49 def auth_parameters { headers: auth_headers } end
check_options()
click to toggle source
Verify transport options @raise [ArgumentError] if options are not as needed
# File lib/train-rest/auth_handler.rb, line 30 def check_options; end
login()
click to toggle source
Handle Login
# File lib/train-rest/auth_handler.rb, line 33 def login; end
logout()
click to toggle source
Handle Logout
# File lib/train-rest/auth_handler.rb, line 36 def logout; end
options=(options)
click to toggle source
Store authenticator options and trigger validation
@param [Hash] All transport options
# File lib/train-rest/auth_handler.rb, line 22 def options=(options) @options = options check_options end