pelle / oauth-plugin

Rails plugin for OAuth
http://stakeventures.com/articles/2009/07/21/consuming-oauth-intelligently-in-rails
MIT License
716 stars 216 forks source link

Updated twitter_token.rb for latest twitter gem #63

Open simonmorley opened 13 years ago

simonmorley commented 13 years ago

Hi

Your recent commit to incorporate the latest Twitter gem was still not working for me. I've modified twitter.rb controller with the following:

require 'twitter'
class TwitterToken < ConsumerToken
  TWITTER_SETTINGS={:site=>"http://api.twitter.com", :request_endpoint => 'http://api.twitter.com',}
  def self.consumer
    @consumer||=OAuth::Consumer.new credentials[:key],credentials[:secret],TWITTER_SETTINGS
  end

  def client
    Twitter.configure do |config|
      config.consumer_key = TwitterToken.consumer.key
      config.consumer_secret = TwitterToken.consumer.secret
      config.oauth_token = token
      config.oauth_token_secret = secret
    end
    @client ||= Twitter::Client.new
  end
end

I hope this helps someone, I was stuck for hours..