Class: LeanMicrosoftGraph::Authentication::TokenRetriever
- Inherits:
-
Object
- Object
- LeanMicrosoftGraph::Authentication::TokenRetriever
- Defined in:
- lib/lean_microsoft_graph/authentication/token_retriever.rb
Instance Method Summary collapse
-
#initialize(token_resource) ⇒ TokenRetriever
constructor
A new instance of TokenRetriever.
- #retrieve ⇒ Object
- #to_proc ⇒ Object
Constructor Details
#initialize(token_resource) ⇒ TokenRetriever
Returns a new instance of TokenRetriever.
6 7 8 9 |
# File 'lib/lean_microsoft_graph/authentication/token_retriever.rb', line 6 def initialize(token_resource) @token_resource = token_resource @token = nil end |
Instance Method Details
#retrieve ⇒ Object
15 16 17 18 19 |
# File 'lib/lean_microsoft_graph/authentication/token_retriever.rb', line 15 def retrieve return @token if @token && !@token.expired? @token = @token_resource.renew end |
#to_proc ⇒ Object
11 12 13 |
# File 'lib/lean_microsoft_graph/authentication/token_retriever.rb', line 11 def to_proc -> { retrieve } end |