Class: ForgeAuth::Token
- Inherits:
-
Object
- Object
- ForgeAuth::Token
- Defined in:
- lib/forge_auth/token.rb
Constant Summary collapse
- EXPIRATION_BUFFER =
5% buffer
0.05
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#expires_in ⇒ Object
readonly
Returns the value of attribute expires_in.
-
#token_type ⇒ Object
readonly
Returns the value of attribute token_type.
Instance Method Summary collapse
- #full_token ⇒ Object
-
#initialize(access_token:, token_type:, expires_in:) ⇒ Token
constructor
A new instance of Token.
- #short_expiration ⇒ Object
Constructor Details
#initialize(access_token:, token_type:, expires_in:) ⇒ Token
Returns a new instance of Token.
7 8 9 10 11 |
# File 'lib/forge_auth/token.rb', line 7 def initialize(access_token:, token_type:, expires_in:) @access_token = access_token @token_type = token_type @expires_in = expires_in end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
5 6 7 |
# File 'lib/forge_auth/token.rb', line 5 def access_token @access_token end |
#expires_in ⇒ Object (readonly)
Returns the value of attribute expires_in.
5 6 7 |
# File 'lib/forge_auth/token.rb', line 5 def expires_in @expires_in end |
#token_type ⇒ Object (readonly)
Returns the value of attribute token_type.
5 6 7 |
# File 'lib/forge_auth/token.rb', line 5 def token_type @token_type end |
Instance Method Details
#full_token ⇒ Object
13 14 15 |
# File 'lib/forge_auth/token.rb', line 13 def full_token "#{token_type} #{access_token}" end |
#short_expiration ⇒ Object
17 18 19 |
# File 'lib/forge_auth/token.rb', line 17 def short_expiration @short_expiration ||= expires_in * (1 - EXPIRATION_BUFFER) end |