twitter4r 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -14,7 +14,7 @@ Code:
14
14
  * Carl Crawley <cwcrawley at gmail dot com> - Friendship get => post fix
15
15
  * Christian Johansen <christian at cjohansen dot no> - in_reply_to attributes in Twitter::Status
16
16
  * Harry Love <harrylove at gmail dot com> - added attributes to Twitter::Status
17
- * Filipe Giusti <filipegiusti at gmail dot com> - fixed users/show issue that Twitter.com changed from under us
17
+ * Filipe Giusti <filipegiusti at gmail dot com> - fixed users/show issue that Twitter.com changed from under us, also inspired the v0.5.2 bugfix release by submitting great issue example code.
18
18
  * Seth Cousins <seth.cousins at gmail dot com> - added HTTP timeout option and provided a patch that inspired the OAuth support for Twitter4R
19
19
  * John McKerrell <@mcknut on twitter> - added geo attribute to Twitter::Message.
20
20
 
@@ -61,6 +61,8 @@ class Twitter::Client
61
61
  @rest_consumer = OAuth::Consumer.new(key, secret,
62
62
  :site => construct_site_url,
63
63
  :proxy => construct_proxy_url)
64
+ http = @rest_consumer.http
65
+ http.read_timeout = cfg.timeout
64
66
  end
65
67
  @rest_consumer
66
68
  end
@@ -94,6 +96,8 @@ class Twitter::Client
94
96
  @search_consumer = OAuth::Consumer.new(key, secret,
95
97
  :site => construct_site_url(:search),
96
98
  :proxy => construct_proxy_url)
99
+ http = @search_consumer.http
100
+ http.read_timeout = cfg.timeout
97
101
  end
98
102
  @search_consumer
99
103
  end
@@ -3,7 +3,7 @@ class Twitter::Client
3
3
  :received => '/direct_messages.json',
4
4
  :sent => '/direct_messages/sent.json',
5
5
  :post => '/direct_messages/new.json',
6
- :delete => '/direct_messages/destroy',
6
+ :delete => '/direct_messages/destroy.json',
7
7
  }
8
8
 
9
9
  # Provides access to Twitter's Messaging API for received and
@@ -70,7 +70,7 @@ class Twitter::Client
70
70
  when :post
71
71
  response = rest_oauth_connect(:post, uri, {:text => value, :user => user, :source => self.class.config.source})
72
72
  when :delete
73
- response = rest_oauth_connect(:delete, "#{uri}/#{value.to_i}")
73
+ response = rest_oauth_connect(:delete, uri, :id => value.to_i)
74
74
  end
75
75
  message = Twitter::Message.unmarshal(response.body)
76
76
  bless_model(message)
@@ -4,7 +4,7 @@
4
4
  module Twitter::Version #:nodoc:
5
5
  MAJOR = 0
6
6
  MINOR = 5
7
- REVISION = 2
7
+ REVISION = 3
8
8
  class << self
9
9
  # Returns X.Y.Z formatted version string
10
10
  def to_version
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
2
2
 
3
3
  describe Twitter::Client, "#account_info" do
4
4
  before(:each) do
@@ -9,7 +9,6 @@ describe Twitter::Client, "#account_info" do
9
9
  @response = mas_net_http_response(:success)
10
10
  @connection = mas_net_http(@response)
11
11
  @response.stub!(:body).and_return("{}")
12
- Net::HTTP.stub!(:new).and_return(@connection)
13
12
  @rate_limit_status = mock(Twitter::RateLimitStatus)
14
13
  @twitter.stub!(:bless_models).and_return({})
15
14
  end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
2
2
 
3
3
  describe Twitter::Client, "#authenticate?" do
4
4
  before(:each) do
@@ -9,7 +9,6 @@ describe Twitter::Client, "#authenticate?" do
9
9
  @response = mas_net_http_response(:success)
10
10
  @error_response = mas_net_http_response(404, "Resource Not Found")
11
11
  @connection = mas_net_http(@response)
12
- Net::HTTP.stub!(:new).and_return(@connection)
13
12
  @access_key = "applestillsucks"
14
13
  @access_secret = "linuxstillrocks"
15
14
  end
@@ -1,4 +1,27 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
2
+
3
+ shared_examples_for "consumer initialization with timeout" do
4
+ before(:each) do
5
+ @old_timeout = nil
6
+ Twitter::Client.configure do |conf|
7
+ @old_timeout = conf.timeout
8
+ conf.timeout = @timeout
9
+ end
10
+ @client = client_context
11
+ end
12
+
13
+ it "should set timeout on underlying HTTP object" do
14
+ consumer = get_consumer
15
+ http = consumer.http
16
+ http.read_timeout.should == timeout
17
+ end
18
+
19
+ after(:each) do
20
+ Twitter::Client.configure do |conf|
21
+ conf.timeout = @old_timeout
22
+ end
23
+ end
24
+ end
2
25
 
3
26
  describe "Twitter::Client" do
4
27
  before(:each) do
@@ -237,3 +260,33 @@ describe Twitter::Client, "#construct_proxy_url" do
237
260
  end
238
261
  end
239
262
  end
263
+
264
+ describe Twitter::Client, "#rest_consumer" do
265
+ it_should_behave_like "consumer initialization with timeout"
266
+ before(:each) do
267
+ @timeout = 49
268
+ end
269
+
270
+ def timeout
271
+ @timeout
272
+ end
273
+
274
+ def get_consumer
275
+ @client.send(:rest_consumer)
276
+ end
277
+ end
278
+
279
+ describe Twitter::Client, "#search_consumer" do
280
+ it_should_behave_like "consumer initialization with timeout"
281
+ before(:each) do
282
+ @timeout = 96
283
+ end
284
+
285
+ def timeout
286
+ @timeout
287
+ end
288
+
289
+ def get_consumer
290
+ @client.send(:search_consumer)
291
+ end
292
+ end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
2
2
 
3
3
  describe Twitter::Client, "#block" do
4
4
  before(:each) do
@@ -10,7 +10,6 @@ describe Twitter::Client, "#block" do
10
10
  @request = mas_net_http_get(:basic_auth => nil)
11
11
  @response = mas_net_http_response(:success)
12
12
  @connection = mas_net_http(@response)
13
- Net::HTTP.stub!(:new).and_return(@connection)
14
13
  Twitter::User.stub!(:unmarshal).and_return(@friend)
15
14
  end
16
15
 
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
2
2
 
3
3
  describe Twitter::Client, "#favorites" do
4
4
  before(:each) do
@@ -9,7 +9,6 @@ describe Twitter::Client, "#favorites" do
9
9
  @response = mas_net_http_response(:success)
10
10
  @connection = mas_net_http(@response)
11
11
  @options = { :page => 4 }
12
- Net::HTTP.stub!(:new).and_return(@connection)
13
12
  @favorites = []
14
13
  Twitter::Status.stub!(:unmarshal).and_return(@favorites)
15
14
  end
@@ -79,7 +78,6 @@ module FavoriteSpecMixin
79
78
  @default_header = @twitter.send(:http_header)
80
79
  @response = mas_net_http_response(:success)
81
80
  @connection = mas_net_http(@response)
82
- Net::HTTP.stub!(:new).and_return(@connection)
83
81
  @id = 234923423
84
82
  @status = mas_twitter_status(:id => @id, :to_i => @id)
85
83
  Twitter::Status.stub!(:unmarshal).and_return(@status)
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
2
2
 
3
3
  describe Twitter::Client, "#friendships" do
4
4
  before(:each) do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
2
2
 
3
3
  describe Twitter::Client, "#graph(:friends...)" do
4
4
  before(:each) do
@@ -11,7 +11,6 @@ describe Twitter::Client, "#graph(:friends...)" do
11
11
  @response = mas_net_http_response(:success)
12
12
  @response.stub!(:body).and_return("[1, 2, 3, 4, 5, 6]")
13
13
  @connection = mas_net_http(@response)
14
- Net::HTTP.stub!(:new).and_return(@connection)
15
14
  Twitter::User.stub!(:unmarshal).and_return(@friend)
16
15
  end
17
16
 
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
2
2
 
3
3
  describe Twitter::Client, "#messages" do
4
4
  before(:each) do
@@ -7,7 +7,6 @@ describe Twitter::Client, "#messages" do
7
7
  @request = mas_net_http_get(:basic_auth => nil)
8
8
  @response = mas_net_http_response(:success, "[]")
9
9
  @connection = mas_net_http(@response)
10
- Net::HTTP.stub!(:new).and_return(@connection)
11
10
  @messages = []
12
11
  Twitter::Message.stub!(:unmarshal).and_return(@messages)
13
12
  @page = 2
@@ -77,7 +76,6 @@ describe Twitter::Client, "#message" do
77
76
  @connection = mas_net_http(@response)
78
77
  @source = Twitter::Client.class_eval("@@defaults[:source]")
79
78
 
80
- Net::HTTP.stub!(:new).and_return(@connection)
81
79
  Twitter::Message.stub!(:unmarshal).and_return(@message)
82
80
  end
83
81
 
@@ -98,7 +96,7 @@ describe Twitter::Client, "#message" do
98
96
  end
99
97
 
100
98
  it "should create expected HTTP DELETE request for :delete case" do
101
- @twitter.should_receive(:rest_oauth_connect).with(:delete, "#{@uris[:delete]}/#{@message.to_i}").and_return(@request)
99
+ @twitter.should_receive(:rest_oauth_connect).with(:delete, @uris[:delete], :id => @message.to_i).and_return(@request)
102
100
  @twitter.message(:delete, @message)
103
101
  end
104
102
 
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
2
2
 
3
3
  describe Twitter::Client, "#profile" do
4
4
  before(:each) do
@@ -34,7 +34,6 @@ describe Twitter::Client, "#profile" do
34
34
  @response = mas_net_http_response(:success, @json)
35
35
  @connection = mas_net_http(@response)
36
36
 
37
- Net::HTTP.stub!(:new).and_return(@connection)
38
37
  Twitter::User.stub!(:unmarshal).and_return(@user)
39
38
  end
40
39
 
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
2
2
 
3
3
  describe Twitter::Client, "#search" do
4
4
  before(:each) do
@@ -7,7 +7,6 @@ describe Twitter::Client, "#search" do
7
7
  @request = mas_net_http_get(:basic_auth => nil)
8
8
  @response = mas_net_http_response(:success, "{\"results\": [], \"refresh_url\":\"?since_id=1768746401&q=blabla\"}")
9
9
  @connection = mas_net_http(@response)
10
- Net::HTTP.stub!(:new).and_return(@connection)
11
10
  @statuses = []
12
11
  Twitter::Status.stub!(:unmarshal).and_return(@statuses)
13
12
  @page = 2
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
2
2
 
3
3
  describe Twitter::Client, "#status" do
4
4
  before(:each) do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
2
2
 
3
3
  describe Twitter::Client, "Timeline API" do
4
4
  before(:each) do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
2
2
 
3
3
  describe Twitter::Client, "#user(id, :info)" do
4
4
  before(:each) do
@@ -15,7 +15,6 @@ describe Twitter::Client, "#user(id, :info)" do
15
15
  @connection = mas_net_http(@response)
16
16
  @uris = Twitter::Client.class_eval("@@USER_URIS")
17
17
  Twitter::User.stub!(:unmarshal).and_return(@user)
18
- Net::HTTP.stub!(:new).and_return(@connection)
19
18
  end
20
19
 
21
20
  it "should create expected HTTP GET request when giving numeric user id" do
@@ -60,7 +59,6 @@ describe Twitter::Client, "#user(id, :friends)" do
60
59
  @connection = mas_net_http(@response)
61
60
  @uris = Twitter::Client.class_eval("@@USER_URIS")
62
61
  Twitter::User.stub!(:unmarshal).and_return(@user)
63
- Net::HTTP.stub!(:new).and_return(@connection)
64
62
  end
65
63
 
66
64
  it "should create expected HTTP GET request when giving numeric user id" do
@@ -117,7 +115,6 @@ describe Twitter::Client, "#my(:info)" do
117
115
  @connection = mas_net_http(@response)
118
116
  @uris = Twitter::Client.class_eval("@@USER_URIS")
119
117
  @twitter.stub!(:rest_oauth_connect).and_return(@response)
120
- Net::HTTP.stub!(:new).and_return(@connection)
121
118
  Twitter::User.stub!(:unmarshal).and_return(@user)
122
119
  end
123
120
 
@@ -156,7 +153,6 @@ describe Twitter::Client, "#my(:friends)" do
156
153
  @connection = mas_net_http(@response)
157
154
  @uris = Twitter::Client.class_eval("@@USER_URIS")
158
155
  Twitter::User.stub!(:unmarshal).and_return(@friends)
159
- Net::HTTP.stub!(:new).and_return(@connection)
160
156
  end
161
157
 
162
158
  it "should create expected HTTP GET request" do
@@ -1,2 +1,2 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
2
 
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
2
 
3
3
  describe Twitter::Client, ".configure" do
4
4
  it "should respond to :configure class method" do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
2
 
3
3
  describe Twitter::Client, ".from_config" do
4
4
  before(:each) do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
2
 
3
3
  describe "Twitter::ClassUtilMixin mixed-in class" do
4
4
  before(:each) do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
2
2
 
3
3
  describe Hash, "#to_http_str" do
4
4
  before(:each) do
@@ -40,4 +40,3 @@ describe Time, "#to_s" do
40
40
  nilize(@time, @expected_string)
41
41
  end
42
42
  end
43
-
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
2
 
3
3
  describe Twitter::Client, "#featured(:users)" do
4
4
  before(:each) do
@@ -6,7 +6,6 @@ describe Twitter::Client, "#featured(:users)" do
6
6
  @uris = Twitter::Client.class_eval("@@FEATURED_URIS")
7
7
  @response = mas_net_http_response(:success)
8
8
  @connection = mas_net_http(@response)
9
- Net::HTTP.stub!(:new).and_return(@connection)
10
9
  @users = [
11
10
  Twitter::User.new(:screen_name => 'twitter4r'),
12
11
  Twitter::User.new(:screen_name => 'dictionary'),
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
2
 
3
3
  def glob_files(*path_elements)
4
4
  Dir.glob(File.join(*path_elements))
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
2
 
3
3
  module Test
4
4
  class Model
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', 'spec_helper')
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
2
2
 
3
3
  VERSION_LIST = [Twitter::Version::MAJOR, Twitter::Version::MINOR, Twitter::Version::REVISION]
4
4
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter4r
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 2
10
- version: 0.5.2
9
+ - 3
10
+ version: 0.5.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Susan Potter
@@ -15,7 +15,7 @@ autorequire: twitter
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-13 00:00:00 -05:00
18
+ date: 2010-09-21 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency