Class: SecureToken
- Inherits:
-
Object
- Object
- SecureToken
- Includes:
- MongoMapper::Document
- Defined in:
- lib/rad/models/secure_token.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.by_token(token) ⇒ Object
end
25 26 27 28 |
# File 'lib/rad/models/secure_token.rb', line 25 def self.by_token token return nil if token.blank? first :token => token, :expires_at.gte => Time.now.utc end |
.by_token!(token) ⇒ Object
30 31 32 |
# File 'lib/rad/models/secure_token.rb', line 30 def self.by_token! token return by_token(token) || raise(MongoMapper::DocumentNotFound) end |
Instance Method Details
#expired? ⇒ Boolean
15 16 17 |
# File 'lib/rad/models/secure_token.rb', line 15 def expired? expires_at >= Time.now.utc end |