Class: Procore::Auth::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/procore/auth/token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_token:, refresh_token:, expires_at:) ⇒ Token

Returns a new instance of Token.



5
6
7
8
9
# File 'lib/procore/auth/token.rb', line 5

def initialize(access_token:, refresh_token:, expires_at:)
  @access_token = access_token
  @refresh_token = refresh_token
  @expires_at = expires_at
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



4
5
6
# File 'lib/procore/auth/token.rb', line 4

def access_token
  @access_token
end

#expires_atObject (readonly)

Returns the value of attribute expires_at.



4
5
6
# File 'lib/procore/auth/token.rb', line 4

def expires_at
  @expires_at
end

#refresh_tokenObject (readonly)

Returns the value of attribute refresh_token.



4
5
6
# File 'lib/procore/auth/token.rb', line 4

def refresh_token
  @refresh_token
end

Instance Method Details

#expired?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/procore/auth/token.rb', line 15

def expired?
  expires_at.to_i < Time.now.to_i
end

#invalid?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/procore/auth/token.rb', line 11

def invalid?
  access_token.nil?
end