Class: Tango::Api::Auth::Basic
- Inherits:
-
Object
- Object
- Tango::Api::Auth::Basic
- Defined in:
- lib/tango/api/auth/basic.rb
Overview
Basic authentication helper for Tango API.
Instance Method Summary collapse
- #apply(headers) ⇒ Object
-
#initialize(platform:, key:) ⇒ Basic
constructor
A new instance of Basic.
Constructor Details
#initialize(platform:, key:) ⇒ Basic
Returns a new instance of Basic.
10 11 12 13 |
# File 'lib/tango/api/auth/basic.rb', line 10 def initialize(platform:, key:) @platform = platform @key = key end |
Instance Method Details
#apply(headers) ⇒ Object
15 16 17 18 |
# File 'lib/tango/api/auth/basic.rb', line 15 def apply(headers) token = ::Base64.strict_encode64("#{@platform}:#{@key}") headers["Authorization"] = "Basic #{token}" end |