Class: EML::BasicAuth::Generate
- Inherits:
-
Object
- Object
- EML::BasicAuth::Generate
- Extended by:
- T::Sig
- Defined in:
- lib/eml/lib/basic_auth/generate.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(username, password, prefix: "") ⇒ Generate
constructor
A new instance of Generate.
Constructor Details
#initialize(username, password, prefix: "") ⇒ Generate
Returns a new instance of Generate.
29 30 31 32 33 |
# File 'lib/eml/lib/basic_auth/generate.rb', line 29 def initialize(username, password, prefix: "") @username = T.let(username, String) @password = T.let(password, String) @prefix = T.let(prefix, String) end |
Class Method Details
.call(username, password, prefix: "") ⇒ Object
18 19 20 |
# File 'lib/eml/lib/basic_auth/generate.rb', line 18 def self.call(username, password, prefix: "") new(username, password, prefix: prefix).call end |
Instance Method Details
#call ⇒ Object
36 37 38 39 |
# File 'lib/eml/lib/basic_auth/generate.rb', line 36 def call token = Base64.encode64("#{@username}:#{@password}").tr("\n", "") "#{@prefix}#{token}" end |