Class: Ask::MCP::Auth::Token
- Inherits:
-
Object
- Object
- Ask::MCP::Auth::Token
- Defined in:
- lib/ask/mcp/auth/token.rb
Instance Attribute Summary collapse
-
#scheme ⇒ Object
readonly
Returns the value of attribute scheme.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #apply(headers = {}) ⇒ Object
-
#initialize(token, scheme: "Bearer") ⇒ Token
constructor
A new instance of Token.
- #to_s ⇒ Object
Constructor Details
#initialize(token, scheme: "Bearer") ⇒ Token
Returns a new instance of Token.
9 10 11 12 |
# File 'lib/ask/mcp/auth/token.rb', line 9 def initialize(token, scheme: "Bearer") @token = token @scheme = scheme end |
Instance Attribute Details
#scheme ⇒ Object (readonly)
Returns the value of attribute scheme.
7 8 9 |
# File 'lib/ask/mcp/auth/token.rb', line 7 def scheme @scheme end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
7 8 9 |
# File 'lib/ask/mcp/auth/token.rb', line 7 def token @token end |
Instance Method Details
#apply(headers = {}) ⇒ Object
14 15 16 |
# File 'lib/ask/mcp/auth/token.rb', line 14 def apply(headers = {}) headers.merge("Authorization" => "#{@scheme} #{@token}") end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/ask/mcp/auth/token.rb', line 18 def to_s "#{@scheme} #{@token[0..7]}..." end |