Sha256: 53c2315b5f2df8e46e7a5806f8e999f455339bfefdd05e0fa2170f2fd74ed83d
Contents?: true
Size: 649 Bytes
Versions: 19
Compression:
Stored size: 649 Bytes
Contents
class OauthToken < ActiveRecord::Base belongs_to :client_application belongs_to :user validates_uniqueness_of :token validates_presence_of :client_application, :token before_validation :generate_keys, :on => :create def invalidated? invalidated_at != nil end def invalidate! update_attribute(:invalidated_at, Time.now) end def authorized? authorized_at != nil && !invalidated? end def to_query "oauth_token=#{token}&oauth_token_secret=#{secret}" end protected def generate_keys self.token = OAuth::Helper.generate_key(40)[0,40] self.secret = OAuth::Helper.generate_key(40)[0,40] end end
Version data entries
19 entries across 19 versions & 6 rubygems