Class: Rubytter::OAuth
- Inherits:
-
Object
- Object
- Rubytter::OAuth
- Defined in:
- lib/rubytter/oauth.rb
Instance Method Summary collapse
- #create_consumer ⇒ Object
- #get_access_token_with_xauth(login, password) ⇒ Object
- #get_request_token ⇒ Object
-
#initialize(key, secret, ca_file = nil) ⇒ OAuth
constructor
A new instance of OAuth.
Constructor Details
#initialize(key, secret, ca_file = nil) ⇒ OAuth
Returns a new instance of OAuth.
3 4 5 6 7 |
# File 'lib/rubytter/oauth.rb', line 3 def initialize(key, secret, ca_file = nil) @key = key @secret = secret @ca_file = ca_file end |
Instance Method Details
#create_consumer ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rubytter/oauth.rb', line 22 def create_consumer if @ca_file consumer = ::OAuth::Consumer.new(@key, @secret, :site => 'https://api.twitter.com', :ca_file => @ca_file) else consumer = ::OAuth::Consumer.new(@key, @secret, :site => 'https://api.twitter.com') consumer.http.verify_mode = OpenSSL::SSL::VERIFY_NONE end consumer end |
#get_access_token_with_xauth(login, password) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/rubytter/oauth.rb', line 9 def get_access_token_with_xauth(login, password) consumer = create_consumer consumer.get_access_token(nil, {}, { :x_auth_mode => "client_auth", :x_auth_username => login, :x_auth_password => password }) end |
#get_request_token ⇒ Object
18 19 20 |
# File 'lib/rubytter/oauth.rb', line 18 def get_request_token create_consumer.get_request_token end |