Class: Request::Auth::Authentication
- Inherits:
-
Object
- Object
- Request::Auth::Authentication
- Defined in:
- lib/request/resources/auth.rb
Constant Summary collapse
- AUTH_CLASSES =
{ basic: 'Basic', bearer: 'Bearer', token: 'Token' }.freeze
Class Method Summary collapse
Class Method Details
.apply(headers, *args) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/request/resources/auth.rb', line 12 def self.apply(headers, *args) auth_class = AUTH_CLASSES[args.first.type] raise ArgumentError, "Type of authentication: #{args.first.type} doesn't support" unless auth_class auth_instance = Object.const_get("Request::Auth::#{auth_class}").new(headers, *args) auth_instance.apply end |