Class: AuthKeyHeader
- Inherits:
-
Object
- Object
- AuthKeyHeader
- Includes:
- AuthProvider
- Defined in:
- lib/sideko_hacker_news.rb
Instance Attribute Summary collapse
-
#header_name ⇒ Object
Returns the value of attribute header_name.
-
#val ⇒ Object
Returns the value of attribute val.
Instance Method Summary collapse
- #add_auth(http_client, req_kwargs) ⇒ Object
-
#initialize(header_name: nil, val: nil) ⇒ AuthKeyHeader
constructor
A new instance of AuthKeyHeader.
Constructor Details
#initialize(header_name: nil, val: nil) ⇒ AuthKeyHeader
Returns a new instance of AuthKeyHeader.
94 95 96 97 |
# File 'lib/sideko_hacker_news.rb', line 94 def initialize(header_name: nil, val: nil) @header_name = header_name @val = val end |
Instance Attribute Details
#header_name ⇒ Object
Returns the value of attribute header_name.
92 93 94 |
# File 'lib/sideko_hacker_news.rb', line 92 def header_name @header_name end |
#val ⇒ Object
Returns the value of attribute val.
92 93 94 |
# File 'lib/sideko_hacker_news.rb', line 92 def val @val end |
Instance Method Details
#add_auth(http_client, req_kwargs) ⇒ Object
99 100 101 102 103 104 105 106 107 |
# File 'lib/sideko_hacker_news.rb', line 99 def add_auth(http_client, req_kwargs) if !@val.nil? headers = req_kwargs.fetch(:headers, {}) headers[@header_name] = @val req_kwargs[:headers] = headers end return http_client, req_kwargs end |