Created
April 1, 2009 14:37
-
-
Save julesfern/88715 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >> access_token | |
| => #<OAuth::Token id=7 user_id=16 consumer_id=10 expires=#<DateTime: 2121368281/864,1/24,2299161> created_at=#<DateTime: 2121053569/864,1/24,2299161> permissions=\"read-user\" token_key=\"hFNfbULwG6dPQS0y1KtizBWpJmEgAw\" activated=true secret=\"MujA1uCYwsUMvXYnyCa9QTs2pKdsex\">, | |
| >> access_token.consumer | |
| => nil | |
| >> OAuth::Consumer.first(:id=>access_token.consumer_id) | |
| =>#<OAuth::Consumer id=10 user_id=nil created_at=#<DateTime: 2121053569/864,1/24,2299161> name=\"hamfatter\" web_url=#<Addressable::URI:0x1a90e42 URI:http://www.gerontogeous.com/client/> consumer_key=\"Ribbonism\" secret=\"tuberculatoradiate\" kind=\"mobile\" permissions=\"write-master\"> | |
| >> OAuth::Token.first('consumer.consumer_key'=>(OAuth::Consumer.first(:id=>access_token.consumer_id)).consumer_key) | |
| => nil | |
| property :id, Serial | |
| property :user_id, Integer, :writer=>:protected | |
| property :consumer_id, Integer, :writer=>:protected | |
| # Expiry date will always be respected. You cannot authenticate using an expired token, and nor can you | |
| # convert an expired request key into an access key. | |
| property :expires, DateTime | |
| property :created_at, DateTime | |
| property :permissions, String | |
| property :token_key, String, :writer=>:private, :index=>true | |
| property :activated, Boolean, :writer=>:private, :index=>true, :default=>false | |
| property :secret, String, :writer=>:private | |
| validates_is_unique :token_key | |
| validates_present :secret | |
| validates_present :consumer | |
| validates_with_method :permissions, :permissions_valid? | |
| belongs_to :consumer, :class_name=>"OAuth::Consumer" | |
| belongs_to :user | |
| before :valid?, :create_token_key_if_not_present | |
| before :valid?, :create_secret_if_not_present |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment