Class: ActionController::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter_connect.rb

Direct Known Subclasses

TwitterConnectsController

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#twitter_clientObject (readonly)

Returns the value of attribute twitter_client.



43
44
45
# File 'lib/twitter_connect.rb', line 43

def twitter_client
  @twitter_client
end

Instance Method Details

#set_twitter_clientObject



33
34
35
36
37
38
39
40
41
# File 'lib/twitter_connect.rb', line 33

def set_twitter_client
  begin
    oauth = Twitter::OAuth.new(TwitterConnect.configuration['consumer_token'], TwitterConnect.configuration['consumer_secret'])
    oauth.authorize_from_access(session[:atoken], session[:asecret])
    @twitter_client = Twitter::Base.new(oauth)
  rescue Twitter::Unauthorized
    redirect_to TwitterConnect.configuration['logout_url'] || root_url
  end
end