Module: Doorkeeper::Models::Expirable

Defined in:
lib/doorkeeper/models/expirable.rb

Instance Method Summary collapse

Instance Method Details

#expired?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/doorkeeper/models/expirable.rb', line 4

def expired?
  expires_in && Time.now > expired_time
end

#expires_in_secondsObject



12
13
14
15
16
17
# File 'lib/doorkeeper/models/expirable.rb', line 12

def expires_in_seconds
  return nil if expires_in.nil?
  expires = (created_at + expires_in.seconds) - Time.now
  expires_sec = expires.seconds.round(0)
  expires_sec > 0 ? expires_sec : 0  
end