Class: AuthBearer
- Inherits:
-
Object
- Object
- AuthBearer
- Includes:
- AuthProvider
- Defined in:
- lib/sideko_hacker_news.rb
Instance Attribute Summary collapse
-
#val ⇒ Object
Returns the value of attribute val.
Instance Method Summary collapse
- #add_auth(http_client, req_kwargs) ⇒ Object
-
#initialize(val: nil) ⇒ AuthBearer
constructor
A new instance of AuthBearer.
Constructor Details
#initialize(val: nil) ⇒ AuthBearer
Returns a new instance of AuthBearer.
53 54 55 |
# File 'lib/sideko_hacker_news.rb', line 53 def initialize(val: nil) @val = val end |
Instance Attribute Details
#val ⇒ Object
Returns the value of attribute val.
51 52 53 |
# File 'lib/sideko_hacker_news.rb', line 51 def val @val end |
Instance Method Details
#add_auth(http_client, req_kwargs) ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/sideko_hacker_news.rb', line 57 def add_auth(http_client, req_kwargs) if !@val.nil? headers = req_kwargs.fetch(:headers, {}) headers["Authorization"] = "Bearer " + @val req_kwargs[:headers] = headers end return http_client, req_kwargs end |