Module: Oauth::Models::Consumers::Token::ClassMethods
- Defined in:
- lib/oauth/models/consumers/token.rb
Instance Method Summary collapse
- #consumer ⇒ Object
- #create_from_request_token(user, token, secret, oauth_verifier) ⇒ Object
- #get_request_token(callback_url) ⇒ Object
- #service_name ⇒ Object
Instance Method Details
#consumer ⇒ Object
25 26 27 |
# File 'lib/oauth/models/consumers/token.rb', line 25 def consumer @consumer||=OAuth::Consumer.new credentials[:key],credentials[:secret],credentials[:options] end |
#create_from_request_token(user, token, secret, oauth_verifier) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/oauth/models/consumers/token.rb', line 33 def create_from_request_token(user,token,secret,oauth_verifier) request_token=OAuth::RequestToken.new consumer,token,secret ={} [:oauth_verifier]=oauth_verifier if oauth_verifier access_token=request_token.get_access_token create :user_id=>user.id,:token=>access_token.token,:secret=>access_token.secret end |
#get_request_token(callback_url) ⇒ Object
29 30 31 |
# File 'lib/oauth/models/consumers/token.rb', line 29 def get_request_token(callback_url) consumer.get_request_token(:oauth_callback=>callback_url) end |
#service_name ⇒ Object
21 22 23 |
# File 'lib/oauth/models/consumers/token.rb', line 21 def service_name @service_name||=self.to_s.underscore.scan(/^(.*?)(_token)?$/)[0][0].to_sym end |