Class: TwitterToken

Inherits:
ConsumerToken show all
Defined in:
lib/oauth/models/consumers/services/twitter_token.rb

Constant Summary collapse

TWITTER_SETTINGS =
{
  :site => "https://api.twitter.com",
  :request_token_path => "/oauth/request_token",
  :authorize_path => "/oauth/authorize",
  :access_token_path => "/oauth/access_token",
}

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ConsumerToken

find_or_create_from_access_token

Methods included from Oauth::Models::Consumers::Token

included

Class Method Details

.consumer(options = {}) ⇒ Object



9
10
11
# File 'lib/oauth/models/consumers/services/twitter_token.rb', line 9

def self.consumer(options={})
  @consumer ||= OAuth::Consumer.new(credentials[:key], credentials[:secret], TWITTER_SETTINGS.merge(options))
end

Instance Method Details

#clientObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/oauth/models/consumers/services/twitter_token.rb', line 13

def client
  @client ||= begin 
    if self.class.credentials[:client].to_sym == :oauth_gem
      super
    else
      require 'twitter'
      Twitter::Client.new(:consumer_key => self.class.consumer.key, :consumer_secret => self.class.consumer.secret)
    end
  end
end