Class: TwitterConnectsController

Inherits:
ActionController::Base show all
Includes:
TwitterOauth
Defined in:
lib/app/controllers/twitter_connects_controller.rb

Instance Attribute Summary

Attributes inherited from ActionController::Base

#twitter_client

Instance Method Summary collapse

Methods included from TwitterOauth

#get_oauth

Methods inherited from ActionController::Base

#set_twitter_client

Instance Method Details

#callbackObject



16
17
18
19
20
21
22
23
24
# File 'lib/app/controllers/twitter_connects_controller.rb', line 16

def callback
  oauth = get_oauth
  oauth.authorize_from_request(session[:rtoken], session[:rsecret], params[:oauth_verifier])
  session[:rtoken] = nil
  session[:rsecret] = nil
  session[:atoken] = oauth.access_token.token
  session[:asecret] = oauth.access_token.secret
  render :file => File.dirname(__FILE__) + '/../views/twitter_connects/callback.html.erb'
end

#logoutObject



26
27
28
29
30
31
# File 'lib/app/controllers/twitter_connects_controller.rb', line 26

def logout
  session[:atoken] = nil
  session[:asecret] = nil
  
  redirect_to TwitterConnect.configuration['logout_url'] || root_url
end

#oauthObject



7
8
9
10
11
12
13
14
# File 'lib/app/controllers/twitter_connects_controller.rb', line 7

def oauth
  oauth = get_oauth
  request_token = oauth.set_callback_url twitter_callback_url
  session[:rtoken] = request_token.token
  session[:rsecret] = request_token.secret
  
  redirect_to request_token.authorize_url
end