Sha256: f610151e8ce80cfef2d0cc897e70b1253ec9ef69325339505f4f96eb160ca933
Contents?: true
Size: 707 Bytes
Versions: 36
Compression:
Stored size: 707 Bytes
Contents
class OauthToken < ActiveRecord::Base belongs_to :client_application belongs_to :user validates_uniqueness_of :token validates_presence_of :client_application, :token, :secret before_validation_on_create :generate_keys 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 oauth_token = client_application.oauth_server.generate_credentials self.token = oauth_token[0][0,20] self.secret = oauth_token[1][0,40] end end
Version data entries
36 entries across 36 versions & 5 rubygems