Skip to content

Commit

Permalink
Aliased client to access_token to get create a standard interface met…
Browse files Browse the repository at this point in the history
…hod for Twitter::Base to use once I add http auth.
  • Loading branch information
jnunemaker committed Apr 11, 2009
1 parent 624ccfe commit 9d4fd99
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/twitter/oauth.rb
Expand Up @@ -24,6 +24,8 @@ def access_token
@access_token ||= ::OAuth::AccessToken.new(consumer, @atoken, @asecret)
end

alias client access_token

def authorize_from_access(atoken, asecret)
@atoken, @asecret = atoken, asecret
end
Expand Down
7 changes: 7 additions & 0 deletions test/twitter/oauth_test.rb
Expand Up @@ -52,4 +52,11 @@ class OAuthTest < Test::Unit::TestCase
twitter.access_token.token.should == 'atoken'
twitter.access_token.secret.should == 'asecret'
end

should "alias oauth token to client" do
twitter = Twitter::OAuth.new('token', 'secret')
twitter.authorize_from_access('atoken', 'asecret')

twitter.client.should == twitter.access_token
end
end

0 comments on commit 9d4fd99

Please sign in to comment.