Permalink
Browse files

Rename oauth_token to access_token

  • Loading branch information...
1 parent 239c5a8 commit d360f8015c487c4599460abd0dd0bc7e59a522a3 @sferik committed Aug 18, 2013
View
@@ -115,7 +115,7 @@ def initialize(attrs={})
#
# @param method [String, Symbol] Message to send to the object
def [](method)
- send(method)
+ send(method.to_sym)
rescue NoMethodError
nil
end
@@ -133,7 +133,7 @@ def memoize(key, &block)
# @param other [Twitter::Base]
# @return [Boolean]
def attr_equal(attr, other)
- self.class == other.class && !other.send(attr).nil? && send(attr) == other.send(attr)
+ self.class == other.class && !other.send(attr.to_sym).nil? && send(attr.to_sym) == other.send(attr.to_sym)
end
# @param other [Twitter::Base]
View
@@ -51,8 +51,8 @@ class Client
include Twitter::API::Users
attr_writer :bearer_token, :connection_options, :consumer_key,
- :consumer_secret, :endpoint, :middleware, :oauth_token,
- :oauth_token_secret
+ :consumer_secret, :endpoint, :middleware, :access_token,
+ :access_token_secret
ENDPOINT = 'https://api.twitter.com'
@@ -67,13 +67,13 @@ def consumer_secret
end
# @return [String]
- def oauth_token
- @oauth_token || ENV['TWITTER_oauth_token']
+ def access_token
+ @access_token || ENV['TWITTER_access_token']
end
# @return [String]
- def oauth_token_secret
- @oauth_token_secret || ENV['TWITTER_oauth_token_SECRET']
+ def access_token_secret
+ @access_token_secret || ENV['TWITTER_access_token_SECRET']
end
# @return [String]
@@ -150,7 +150,7 @@ def put(path, params={})
# @return [Boolean]
def user_token?
- !!(oauth_token && oauth_token_secret)
+ !!(access_token && access_token_secret)
end
# @return [Boolean]
@@ -163,8 +163,8 @@ def credentials
{
:consumer_key => consumer_key,
:consumer_secret => consumer_secret,
- :token => oauth_token,
- :token_secret => oauth_token_secret,
+ :token => access_token,
+ :token_secret => access_token_secret,
}
end
@@ -3,7 +3,7 @@
describe Twitter::API::DirectMessages do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
end
describe "#direct_messages_received" do
@@ -3,7 +3,7 @@
describe Twitter::API::Favorites do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
end
describe "#favorites" do
@@ -3,7 +3,7 @@
describe Twitter::API::FriendsAndFollowers do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
end
describe "#friend_ids" do
@@ -3,7 +3,7 @@
describe Twitter::API::PlacesAndGeo do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
end
describe "#place" do
@@ -3,7 +3,7 @@
describe Twitter::API::Help do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
end
describe "#configuration" do
@@ -3,7 +3,7 @@
describe Twitter::API::Lists do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
end
describe "#lists" do
@@ -3,7 +3,7 @@
describe Twitter::API::SavedSearches do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
end
describe "#saved_searches" do
@@ -3,7 +3,7 @@
describe Twitter::API::Search do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
end
describe "#search" do
@@ -3,7 +3,7 @@
describe Twitter::API::SpamReporting do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
end
describe "#report_spam" do
@@ -3,7 +3,7 @@
describe Twitter::API::SuggestedUsers do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
end
describe "#suggestions" do
@@ -3,7 +3,7 @@
describe Twitter::API::Timelines do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
end
describe "#mentions_timeline" do
@@ -3,7 +3,7 @@
describe Twitter::API::Trends do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
end
describe "#trends" do
@@ -3,7 +3,7 @@
describe Twitter::API::Tweets do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
end
describe "#retweets" do
@@ -3,7 +3,7 @@
describe Twitter::API::Undocumented do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
end
describe "#following_followers_of" do
@@ -3,7 +3,7 @@
describe Twitter::API::Users do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
end
describe "#settings" do
@@ -3,7 +3,7 @@
describe Twitter::Client do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
end
describe ".new" do
@@ -30,20 +30,20 @@
expect(client.credentials?).to be_true
end
it "returns true if all OAuth credentials are present" do
- client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
expect(client.credentials?).to be_true
end
it "returns false if any credentials are missing" do
- client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT")
+ client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT")
expect(client.credentials?).to be_false
end
end
it "does not cache the screen name across clients" do
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
- user1 = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS").current_user
+ user1 = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS").current_user
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("pengwynn.json"), :headers => {:content_type => "application/json; charset=utf-8"})
- user2 = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS").current_user
+ user2 = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS").current_user
expect(user1).not_to eq(user2)
end
@@ -69,11 +69,11 @@
describe "#user_token?" do
it "returns true if the user token/secret are present" do
- client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
expect(client.user_token?).to be_true
end
it "returns false if the user token/secret are not completely present" do
- client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT")
+ client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT")
expect(client.user_token?).to be_false
end
end
@@ -91,11 +91,11 @@
describe "#credentials?" do
it "returns true if all credentials are present" do
- client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
expect(client.credentials?).to be_true
end
it "returns false if any credentials are missing" do
- client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT")
+ client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT")
expect(client.credentials?).to be_false
end
end
@@ -139,8 +139,8 @@
expect(authorization.options[:version]).to eq("1.0")
expect(authorization.options[:consumer_key]).to eq("CK")
expect(authorization.options[:consumer_secret]).to eq("CS")
- expect(authorization.options[:token]).to eq("OT")
- expect(authorization.options[:token_secret]).to eq("OS")
+ expect(authorization.options[:token]).to eq("AT")
+ expect(authorization.options[:token_secret]).to eq("AS")
end
it "submits the correct auth header when no media is present" do
# We use static values for nounce and timestamp to get a stable signature
@@ -4,7 +4,7 @@
describe "#each" do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("ids_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end
@@ -3,7 +3,7 @@
describe Twitter::Error do
before do
- @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :oauth_token => "OT", :oauth_token_secret => "OS")
+ @client = Twitter::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
end
describe "#initialize" do

0 comments on commit d360f80

Please sign in to comment.