Class: SuggestGrid::BasicAuth
- Inherits:
-
Object
- Object
- SuggestGrid::BasicAuth
- Defined in:
- lib/suggest_grid/http/auth/basic_auth.rb
Class Method Summary collapse
-
.apply(http_request) ⇒ Object
Add basic authentication to the request.
Class Method Details
.apply(http_request) ⇒ Object
Add basic authentication to the request.
9 10 11 12 13 14 15 |
# File 'lib/suggest_grid/http/auth/basic_auth.rb', line 9 def self.apply(http_request) username = Configuration.basic_auth_user_name password = Configuration.basic_auth_password value = Base64.encode64("#{username}:#{password}") header_value = "Basic #{value}" http_request.headers["Authorization"] = header_value end |