Class: CoreLibrary::HeaderAuth
- Inherits:
-
Authentication
- Object
- Authentication
- CoreLibrary::HeaderAuth
- Defined in:
- lib/apimatic-core/authentication/header_auth.rb
Overview
This class is responsible for adding authentication in request header parameter.
Instance Method Summary collapse
-
#apply(_http_request) ⇒ Object
Applies the authentication scheme on the given HTTP request.
-
#initialize(auth_params) ⇒ HeaderAuth
constructor
Initializes a new instance of HeaderAuth.
-
#valid ⇒ Boolean
Checks whether this authentication scheme is valid or not.
Constructor Details
#initialize(auth_params) ⇒ HeaderAuth
Initializes a new instance of HeaderAuth.
6 7 8 9 |
# File 'lib/apimatic-core/authentication/header_auth.rb', line 6 def initialize(auth_params) @auth_params = auth_params @error_message = nil end |
Instance Method Details
#apply(_http_request) ⇒ Object
Applies the authentication scheme on the given HTTP request.
19 20 21 |
# File 'lib/apimatic-core/authentication/header_auth.rb', line 19 def apply(_http_request) AuthHelper.apply(@auth_params, _http_request.method(:add_header)) end |
#valid ⇒ Boolean
Checks whether this authentication scheme is valid or not.
13 14 15 |
# File 'lib/apimatic-core/authentication/header_auth.rb', line 13 def valid AuthHelper.valid_auth?(@auth_params) end |