Module: HTTP::AuthorizationHeader
- Defined in:
- lib/http/authorization_header.rb,
lib/http/authorization_header/basic_auth.rb,
lib/http/authorization_header/bearer_token.rb
Overview
Authorization header value builders
Defined Under Namespace
Classes: BasicAuth, BearerToken
Class Method Summary collapse
-
.build(type, opts) ⇒ String
Builds Authorization header value with associated builder.
-
.register(type, klass) ⇒ void
Associate type with given builder.
Class Method Details
.build(type, opts) ⇒ String
Builds Authorization header value with associated builder.
17 18 19 20 21 22 23 |
# File 'lib/http/authorization_header.rb', line 17 def build(type, opts) klass = builders[type.to_sym] fail Error, "Unknown authorization type #{type}" unless klass klass.new opts end |
.register(type, klass) ⇒ void
This method returns an undefined value.
Associate type with given builder.
9 10 11 |
# File 'lib/http/authorization_header.rb', line 9 def register(type, klass) builders[type.to_sym] = klass end |