Class: AzIdentity::Identity::Credentials

Inherits:
Object
  • Object
show all
Defined in:
lib/az_identity/identity/credentials.rb

Constant Summary collapse

EXPIRATION_BUFFER =
600

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token, expires_at) ⇒ Credentials

Returns a new instance of Credentials.



10
11
12
13
# File 'lib/az_identity/identity/credentials.rb', line 10

def initialize(token, expires_at)
  @token = token
  @expires_at = expires_at
end

Instance Attribute Details

#expires_atObject

Returns the value of attribute expires_at.



6
7
8
# File 'lib/az_identity/identity/credentials.rb', line 6

def expires_at
  @expires_at
end

#tokenObject

Returns the value of attribute token.



6
7
8
# File 'lib/az_identity/identity/credentials.rb', line 6

def token
  @token
end

Instance Method Details

#refresh_needed?Boolean

Returns:

  • (Boolean)


15
16
17
18
19
# File 'lib/az_identity/identity/credentials.rb', line 15

def refresh_needed?
  return true unless expires_at

  Time.now >= expires_at - EXPIRATION_BUFFER
end