Class: LeanMicrosoftGraph::Resources::TokenResource::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/lean_microsoft_graph/resources/token_resource/token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, expires_in) ⇒ Token

Returns a new instance of Token.



9
10
11
12
13
# File 'lib/lean_microsoft_graph/resources/token_resource/token.rb', line 9

def initialize(value, expires_in)
  @value = value
  @expires_in = expires_in
  @created_at = Time.now
end

Instance Attribute Details

#expires_inObject (readonly)

Returns the value of attribute expires_in.



7
8
9
# File 'lib/lean_microsoft_graph/resources/token_resource/token.rb', line 7

def expires_in
  @expires_in
end

#valueObject (readonly)

Returns the value of attribute value.



7
8
9
# File 'lib/lean_microsoft_graph/resources/token_resource/token.rb', line 7

def value
  @value
end

Instance Method Details

#expired?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/lean_microsoft_graph/resources/token_resource/token.rb', line 19

def expired?
  Time.now > expires_at
end

#expires_atObject



15
16
17
# File 'lib/lean_microsoft_graph/resources/token_resource/token.rb', line 15

def expires_at
  @created_at + @expires_in
end

#to_sObject



23
24
25
# File 'lib/lean_microsoft_graph/resources/token_resource/token.rb', line 23

def to_s
  @value
end