Class: OauthProviderEngine::RequestToken
- Defined in:
- app/models/oauth_provider_engine/request_token.rb
Instance Method Summary collapse
- #authorize!(user_id) ⇒ Object
- #to_query ⇒ Object
-
#upgrade! ⇒ Object
this method with upgrade the RequestToken to an AccessToken note that this will destroy the current RequestToken.
Instance Method Details
#authorize!(user_id) ⇒ Object
12 13 14 |
# File 'app/models/oauth_provider_engine/request_token.rb', line 12 def (user_id) update_attribute(:user_id, user_id) end |
#to_query ⇒ Object
30 31 32 33 34 35 |
# File 'app/models/oauth_provider_engine/request_token.rb', line 30 def to_query { :oauth_token => token, :oauth_token_secret => secret }.to_query end |
#upgrade! ⇒ Object
this method with upgrade the RequestToken to an AccessToken
note that this will destroy the current RequestToken
18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/models/oauth_provider_engine/request_token.rb', line 18 def upgrade! access_token = nil transaction do access_token = OauthProviderEngine::AccessToken.create!({ :application_id => self.application_id, :user_id => self.user_id, }) self.destroy || raise(ActiveRecord::Rollback) end return access_token end |