1 class OauthToken < ActiveRecord::Base
2 belongs_to :client_application
4 validates_uniqueness_of :token
5 validates_presence_of :client_application, :token, :secret
6 before_validation_on_create :generate_keys
13 update_attribute(:invalidated_at, Time.now)
17 authorized_at != nil && !invalidated?
21 "oauth_token=#{token}&oauth_token_secret=#{secret}"
27 @oauth_token = client_application.oauth_server.generate_credentials
28 self.token = @oauth_token[0]
29 self.secret = @oauth_token[1]