Module: Doorkeeper::Models::Revocable

Included in:
AccessGrantMixin, AccessTokenMixin
Defined in:
lib/doorkeeper/models/concerns/revocable.rb

Instance Method Summary collapse

Instance Method Details

#revoke(clock = Time) ⇒ Object

Revokes the object (updates `:revoked_at` attribute setting its value to the specific time).

Parameters:

  • clock (Time) (defaults to: Time)

    time object


11
12
13
# File 'lib/doorkeeper/models/concerns/revocable.rb', line 11

def revoke(clock = Time)
  update_attribute(:revoked_at, clock.now.utc)
end

#revoked?Boolean

Indicates whether the object has been revoked.

Returns:

  • (Boolean)

    true if revoked, false in other case


19
20
21
# File 'lib/doorkeeper/models/concerns/revocable.rb', line 19

def revoked?
  !!(revoked_at && revoked_at <= Time.now.utc)
end