Class: HttpResource::Auth::Bearer
- Inherits:
-
Object
- Object
- HttpResource::Auth::Bearer
- Defined in:
- lib/http_resource/auth/bearer.rb
Overview
Bearer-token auth: sets ‘Authorization: Bearer <token>`.
Instance Method Summary collapse
- #apply(request) ⇒ Object
-
#initialize(token) ⇒ Bearer
constructor
A new instance of Bearer.
Constructor Details
#initialize(token) ⇒ Bearer
Returns a new instance of Bearer.
7 8 9 |
# File 'lib/http_resource/auth/bearer.rb', line 7 def initialize(token) @token = token.to_s end |
Instance Method Details
#apply(request) ⇒ Object
11 12 13 |
# File 'lib/http_resource/auth/bearer.rb', line 11 def apply(request) request["Authorization"] = "Bearer #{@token}" end |