twitter-jruby 0.9.5.2010052501 → 0.9.7.2010061001

Sign up to get free protection for your applications and to get access to all the features.
data/History CHANGED
@@ -1,4 +1,9 @@
1
- 0.9.5 - April, 21, 2010
1
+ 0.9.7 - May 25, 2010
2
+ * Added api_endpoint option for Search
3
+ 0.9.6 - May 25, 2010
4
+ * Deprecated Basic Auth
5
+ * Added api_endpoint option for OAuth
6
+ 0.9.5 - April 21, 2010
2
7
  * Saved searches (@zmoazeni)
3
8
  * Patch to handle nil in .each in Search.fetch (@sferik)
4
9
  * Added report_spam - Christopher Bailey
data/Rakefile CHANGED
@@ -19,6 +19,7 @@ Jeweler::Tasks.new do |gem|
19
19
  gem.add_development_dependency("jnunemaker-matchy", "~> 0.4.0")
20
20
  gem.add_development_dependency("mocha", "~> 0.9.0")
21
21
  gem.add_development_dependency("fakeweb", "~> 1.2.0")
22
+ gem.add_development_dependency("redgreen", "~> 1.2.2")
22
23
  end
23
24
 
24
25
  Jeweler::GemcutterTasks.new
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :minor: 9
3
- :patch: 5
4
- :build: 2010052501
3
+ :build: 2010061001
4
+ :patch: 7
5
5
  :major: 0
@@ -7,6 +7,8 @@ module Twitter
7
7
  attr_reader :username, :password, :options
8
8
 
9
9
  def initialize(username, password, options={})
10
+ warn "[DEPRECATION] Baic auth is deprecated as Twitter is ending support in June 2010. Please migrate to OAuth."
11
+
10
12
  @username, @password = username, password
11
13
  @options = {:ssl => false}.merge(options)
12
14
  options[:api_endpoint] ||= "api.twitter.com"
@@ -14,18 +16,26 @@ module Twitter
14
16
  end
15
17
 
16
18
  def get(uri, headers={})
19
+ warn "[DEPRECATION] Baic auth is deprecated as Twitter is ending support in June 2010. Please migrate to OAuth."
20
+
17
21
  self.class.get(uri, :headers => headers, :basic_auth => basic_auth)
18
22
  end
19
23
 
20
24
  def post(uri, body={}, headers={})
25
+ warn "[DEPRECATION] Baic auth is deprecated as Twitter is ending support in June 2010. Please migrate to OAuth."
26
+
21
27
  self.class.post(uri, :body => body, :headers => headers, :basic_auth => basic_auth)
22
28
  end
23
29
 
24
30
  def put(uri, body={}, headers={})
31
+ warn "[DEPRECATION] Baic auth is deprecated as Twitter is ending support in June 2010. Please migrate to OAuth."
32
+
25
33
  self.class.put(uri, :body => body, :headers => headers, :basic_auth => basic_auth)
26
34
  end
27
35
 
28
36
  def delete(uri, body={}, headers={})
37
+ warn "[DEPRECATION] Baic auth is deprecated as Twitter is ending support in June 2010. Please migrate to OAuth."
38
+
29
39
  self.class.delete(uri, :body => body, :headers => headers, :basic_auth => basic_auth)
30
40
  end
31
41
 
@@ -4,20 +4,26 @@ module Twitter
4
4
 
5
5
  def_delegators :access_token, :get, :post, :put, :delete
6
6
 
7
- attr_reader :ctoken, :csecret, :consumer_options
7
+ attr_reader :ctoken, :csecret, :consumer_options, :api_endpoint, :signing_endpoint
8
8
 
9
9
  # Options
10
10
  # :sign_in => true to just sign in with twitter instead of doing oauth authorization
11
11
  # (http://apiwiki.twitter.com/Sign-in-with-Twitter)
12
12
  def initialize(ctoken, csecret, options={})
13
13
  @ctoken, @csecret, @consumer_options = ctoken, csecret, {}
14
+ @api_endpoint = options[:api_endpoint] || 'http://api.twitter.com'
15
+ @signing_endpoint = options[:signing_endpoint] || 'http://api.twitter.com'
14
16
  if options[:sign_in]
15
17
  @consumer_options[:authorize_path] = '/oauth/authenticate'
16
18
  end
17
19
  end
18
20
 
19
21
  def consumer
20
- @consumer ||= ::OAuth::Consumer.new(@ctoken, @csecret, {:site => 'http://api.twitter.com'}.merge(consumer_options))
22
+ @consumer ||= ::OAuth::Consumer.new(@ctoken, @csecret, {:site => api_endpoint}.merge(consumer_options))
23
+ end
24
+
25
+ def signing_consumer
26
+ @signing_consumer ||= ::OAuth::Consumer.new(@ctoken, @csecret, {:site => signing_endpoint}.merge(consumer_options))
21
27
  end
22
28
 
23
29
  def set_callback_url(url)
@@ -29,13 +35,13 @@ module Twitter
29
35
  # Options:
30
36
  # :oauth_callback => String, url that twitter should redirect to
31
37
  def request_token(options={})
32
- @request_token ||= consumer.get_request_token(options)
38
+ @request_token ||= signing_consumer.get_request_token(options)
33
39
  end
34
40
 
35
41
  # For web apps use params[:oauth_verifier], for desktop apps,
36
42
  # use the verifier is the pin that twitter gives users.
37
43
  def authorize_from_request(rtoken, rsecret, verifier_or_pin)
38
- request_token = ::OAuth::RequestToken.new(consumer, rtoken, rsecret)
44
+ request_token = ::OAuth::RequestToken.new(signing_consumer, rtoken, rsecret)
39
45
  access_token = request_token.get_access_token(:oauth_verifier => verifier_or_pin)
40
46
  @atoken, @asecret = access_token.token, access_token.secret
41
47
  end
@@ -11,6 +11,7 @@ module Twitter
11
11
  @options = options
12
12
  clear
13
13
  containing(q) if q && q.strip != ""
14
+ self.class.base_uri(options[:api_endpoint]) if options[:api_endpoint]
14
15
  end
15
16
 
16
17
  def user_agent
@@ -4,6 +4,7 @@ require "shoulda"
4
4
  require "matchy"
5
5
  require "mocha"
6
6
  require "fakeweb"
7
+ require "redgreen"
7
8
 
8
9
  FakeWeb.allow_net_connect = false
9
10
 
@@ -59,7 +59,7 @@ class OAuthTest < Test::Unit::TestCase
59
59
  should "be able to create access token from request token, request secret and verifier" do
60
60
  twitter = Twitter::OAuth.new('token', 'secret')
61
61
  consumer = OAuth::Consumer.new('token', 'secret', {:site => 'http://api.twitter.com'})
62
- twitter.stubs(:consumer).returns(consumer)
62
+ twitter.stubs(:signing_consumer).returns(consumer)
63
63
 
64
64
  access_token = mock('access token', :token => 'atoken', :secret => 'asecret')
65
65
  request_token = mock('request token')
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 5
9
- - 2010052501
10
- version: 0.9.5.2010052501
8
+ - 7
9
+ - 2010061001
10
+ version: 0.9.7.2010061001
11
11
  platform: ruby
12
12
  authors:
13
13
  - John Nunemaker
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-05-25 00:00:00 +09:00
20
+ date: 2010-06-10 00:00:00 +09:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -142,6 +142,20 @@ dependencies:
142
142
  version: 1.2.0
143
143
  type: :development
144
144
  version_requirements: *id009
145
+ - !ruby/object:Gem::Dependency
146
+ name: redgreen
147
+ prerelease: false
148
+ requirement: &id010 !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ~>
151
+ - !ruby/object:Gem::Version
152
+ segments:
153
+ - 1
154
+ - 2
155
+ - 2
156
+ version: 1.2.2
157
+ type: :development
158
+ version_requirements: *id010
145
159
  description:
146
160
  email: fujibee@gmail.com
147
161
  executables: []