module Doorkeeper::Models::Expirable
def expired?
-
(Boolean)
- true if object expired and false in other case
def expired? !!(expires_in && Time.now.utc > expires_at) end
def expires_at
-
(Time, nil)
- expiration time in UTC
def expires_at expires_in && created_at + expires_in.seconds end
def expires_in_seconds
-
(Integer, nil)
- number of seconds if object has expiration time
def expires_in_seconds return nil if expires_in.nil? expires = expires_at - Time.now.utc expires_sec = expires.seconds.round(0) expires_sec > 0 ? expires_sec : 0 end