Class: PinAuthenticator
- Inherits:
-
Object
- Object
- PinAuthenticator
- Defined in:
- lib/robin/pin_authenticator.rb
Class Method Summary collapse
Class Method Details
.authenticate(pin) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/robin/pin_authenticator.rb', line 21 def self.authenticate(pin) begin access_token = @request_token.get_access_token(:oauth_verifier => pin) Robin::User.register_new(access_token.token, access_token.secret) true rescue OAuth:: => e false end end |
.authorize_url ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/robin/pin_authenticator.rb', line 6 def self. consumer = OAuth::Consumer.new(Robin::Config.key, Robin::Config.secret, { :site => 'http://twitter.com/', :request_token_path => '/oauth/request_token', :access_token_path => '/oauth/access_token', :authorize_path => '/oauth/authorize' }) begin @request_token = consumer.get_request_token rescue Net::HTTPRetriableError => e @request_token = consumer.get_request_token end @request_token.() end |