tweetstream 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of tweetstream might be problematic. Click here for more details.
- data/CONTRIBUTING.md +9 -0
- data/README.md +4 -6
- data/lib/tweetstream/client.rb +55 -26
- data/lib/tweetstream/version.rb +1 -1
- data/spec/fixtures/stall_warning.json +7 -0
- data/spec/tweetstream/client_authentication_spec.rb +2 -2
- data/spec/tweetstream/client_site_stream_spec.rb +49 -29
- data/spec/tweetstream/client_spec.rb +19 -12
- data/spec/tweetstream/client_userstream_spec.rb +5 -5
- data/tweetstream.gemspec +2 -2
- metadata +9 -6
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
## Contributing
|
2
|
+
* Fork the project.
|
3
|
+
* Make your feature addition or bug fix.
|
4
|
+
* Add tests for it. This is important so I don't break it in a future version
|
5
|
+
unintentionally.
|
6
|
+
* Commit, do not mess with rakefile, version, or history. (if you want to have
|
7
|
+
your own version, that is fine but bump version in a commit by itself I can
|
8
|
+
ignore when I pull)
|
9
|
+
* Send me a pull request. Bonus points for topic branches.
|
data/README.md
CHANGED
@@ -328,13 +328,11 @@ end
|
|
328
328
|
If you put the above into a script and run the script with `ruby scriptname.rb`,
|
329
329
|
you will see a list of daemonization commands such as start, stop, and run.
|
330
330
|
|
331
|
-
##
|
331
|
+
## REST
|
332
332
|
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
337
|
-
* Send me a pull request. Bonus points for topic branches.
|
333
|
+
To access the Twitter REST API, we recommend the [Twitter][] gem.
|
334
|
+
|
335
|
+
[twitter]: https://github.com/sferik/twitter
|
338
336
|
|
339
337
|
## Contributors
|
340
338
|
|
data/lib/tweetstream/client.rb
CHANGED
@@ -55,7 +55,7 @@ module TweetStream
|
|
55
55
|
# Creative use of a combination of other resources and various access
|
56
56
|
# levels can satisfy nearly every application use case.
|
57
57
|
def firehose(query_parameters = {}, &block)
|
58
|
-
start('/1/statuses/firehose.json', query_parameters, &block)
|
58
|
+
start('/1.1/statuses/firehose.json', query_parameters, &block)
|
59
59
|
end
|
60
60
|
|
61
61
|
# Returns all statuses containing http: and https:. The links stream is
|
@@ -63,7 +63,7 @@ module TweetStream
|
|
63
63
|
# of access. Creative use of a combination of other resources and various
|
64
64
|
# access levels can satisfy nearly every application use case.
|
65
65
|
def links(query_parameters = {}, &block)
|
66
|
-
start('/1/statuses/links.json', query_parameters, &block)
|
66
|
+
start('/1.1/statuses/links.json', query_parameters, &block)
|
67
67
|
end
|
68
68
|
|
69
69
|
# Returns all retweets. The retweet stream is not a generally available
|
@@ -73,7 +73,7 @@ module TweetStream
|
|
73
73
|
# the site-wide retweet feature has not yet launched,
|
74
74
|
# so there are currently few, if any, retweets on this stream.
|
75
75
|
def retweet(query_parameters = {}, &block)
|
76
|
-
start('/1/statuses/retweet.json', query_parameters, &block)
|
76
|
+
start('/1.1/statuses/retweet.json', query_parameters, &block)
|
77
77
|
end
|
78
78
|
|
79
79
|
# Returns a random sample of all public statuses. The default access level
|
@@ -82,7 +82,7 @@ module TweetStream
|
|
82
82
|
# research applications that desire a larger proportion to be statistically
|
83
83
|
# significant sample.
|
84
84
|
def sample(query_parameters = {}, &block)
|
85
|
-
start('/1/statuses/sample.json', query_parameters, &block)
|
85
|
+
start('/1.1/statuses/sample.json', query_parameters, &block)
|
86
86
|
end
|
87
87
|
|
88
88
|
# Specify keywords to track. Queries are subject to Track Limitations,
|
@@ -125,14 +125,14 @@ module TweetStream
|
|
125
125
|
# method is provided separately for cases when it would conserve the
|
126
126
|
# number of HTTP connections to combine track and follow.
|
127
127
|
def filter(query_params = {}, &block)
|
128
|
-
start('/1/statuses/filter.json', query_params.merge(:method => :post), &block)
|
128
|
+
start('/1.1/statuses/filter.json', query_params.merge(:method => :post), &block)
|
129
129
|
end
|
130
130
|
|
131
131
|
# Make a call to the userstream api for currently authenticated user
|
132
132
|
def userstream(query_params = {}, &block)
|
133
133
|
stream_params = { :host => "userstream.twitter.com" }
|
134
134
|
query_params.merge!(:extra_stream_parameters => stream_params)
|
135
|
-
start('/
|
135
|
+
start('/1.1/user.json', query_params, &block)
|
136
136
|
end
|
137
137
|
|
138
138
|
# Make a call to the userstream api
|
@@ -144,7 +144,7 @@ module TweetStream
|
|
144
144
|
:extra_stream_parameters => stream_params
|
145
145
|
})
|
146
146
|
query_params.merge!(:with => 'followings') if query_params.delete(:followings)
|
147
|
-
start('/
|
147
|
+
start('/1.1/site.json', query_params, &block)
|
148
148
|
end
|
149
149
|
|
150
150
|
# Set a Proc to be run when a deletion notice is received
|
@@ -335,6 +335,26 @@ module TweetStream
|
|
335
335
|
on('user_withheld', &block)
|
336
336
|
end
|
337
337
|
|
338
|
+
# Set a Proc to be run when a Site Stream friends list is received.
|
339
|
+
#
|
340
|
+
# @client = TweetStream::Client.new
|
341
|
+
# @client.on_friends do |friends|
|
342
|
+
# # do something with the friends list
|
343
|
+
# end
|
344
|
+
def on_friends(&block)
|
345
|
+
on('friends', &block)
|
346
|
+
end
|
347
|
+
|
348
|
+
# Set a Proc to be run when a stall warning is received.
|
349
|
+
#
|
350
|
+
# @client = TweetStream::Client.new
|
351
|
+
# @client.on_stall_warning do |warning|
|
352
|
+
# # do something with the friends list
|
353
|
+
# end
|
354
|
+
def on_stall_warning(&block)
|
355
|
+
on('stall_warning', &block)
|
356
|
+
end
|
357
|
+
|
338
358
|
# Set a Proc to be run on userstream events
|
339
359
|
#
|
340
360
|
# @client = TweetStream::Client.new
|
@@ -370,26 +390,9 @@ module TweetStream
|
|
370
390
|
|
371
391
|
# connect to twitter without starting a new EventMachine run loop
|
372
392
|
def connect(path, options = {}, &block)
|
373
|
-
|
374
|
-
warn_if_callbacks(options)
|
393
|
+
stream_parameters, callbacks = connection_options(path, options)
|
375
394
|
|
376
|
-
|
377
|
-
OPTION_CALLBACKS.each do |callback|
|
378
|
-
callbacks.merge(callback.to_s => options.delete(callback)) if options[callback]
|
379
|
-
end
|
380
|
-
|
381
|
-
inited_proc = options.delete(:inited) || @callbacks['inited']
|
382
|
-
extra_stream_parameters = options.delete(:extra_stream_parameters) || {}
|
383
|
-
|
384
|
-
stream_params = {
|
385
|
-
:path => path,
|
386
|
-
:method => request_method.to_s.upcase,
|
387
|
-
:user_agent => user_agent,
|
388
|
-
:on_inited => inited_proc,
|
389
|
-
:params => normalize_filter_parameters(options)
|
390
|
-
}.merge(extra_stream_parameters).merge(auth_params)
|
391
|
-
|
392
|
-
@stream = EM::Twitter::Client.connect(stream_params)
|
395
|
+
@stream = EM::Twitter::Client.connect(stream_parameters)
|
393
396
|
@stream.each do |item|
|
394
397
|
begin
|
395
398
|
hash = MultiJson.decode(item, :symbolize_keys => true)
|
@@ -443,6 +446,8 @@ module TweetStream
|
|
443
446
|
require 'tweetstream/site_stream_client'
|
444
447
|
@control = TweetStream::SiteStreamClient.new(@control_uri, options)
|
445
448
|
@control.on_error(&callbacks['error'])
|
449
|
+
elsif hash[:warning]
|
450
|
+
invoke_callback(callbacks['stall_warning'], hash[:warning])
|
446
451
|
elsif hash[:delete] && hash[:delete][:status]
|
447
452
|
invoke_callback(callbacks['delete'], hash[:delete][:status][:id], hash[:delete][:status][:user_id])
|
448
453
|
elsif hash[:scrub_geo] && hash[:scrub_geo][:up_to_status_id]
|
@@ -457,6 +462,8 @@ module TweetStream
|
|
457
462
|
invoke_callback(callbacks['user_withheld'], hash[:user_withheld])
|
458
463
|
elsif hash[:event]
|
459
464
|
invoke_callback(callbacks[hash[:event].to_s], hash)
|
465
|
+
elsif hash[:friends]
|
466
|
+
invoke_callback(callbacks['friends'], hash[:friends])
|
460
467
|
elsif hash[:text] && hash[:user]
|
461
468
|
@last_status = Twitter::Tweet.new(hash)
|
462
469
|
yield_message_to(callbacks['timeline_status'], @last_status)
|
@@ -529,6 +536,28 @@ module TweetStream
|
|
529
536
|
end
|
530
537
|
end
|
531
538
|
|
539
|
+
def connection_options(path, options)
|
540
|
+
warn_if_callbacks(options)
|
541
|
+
|
542
|
+
callbacks = @callbacks.dup
|
543
|
+
OPTION_CALLBACKS.each do |callback|
|
544
|
+
callbacks.merge(callback.to_s => options.delete(callback)) if options[callback]
|
545
|
+
end
|
546
|
+
|
547
|
+
inited_proc = options.delete(:inited) || @callbacks['inited']
|
548
|
+
extra_stream_parameters = options.delete(:extra_stream_parameters) || {}
|
549
|
+
|
550
|
+
stream_params = {
|
551
|
+
:path => path,
|
552
|
+
:method => (options.delete(:method) || 'get').to_s.upcase,
|
553
|
+
:user_agent => user_agent,
|
554
|
+
:on_inited => inited_proc,
|
555
|
+
:params => normalize_filter_parameters(options)
|
556
|
+
}.merge(extra_stream_parameters).merge(auth_params)
|
557
|
+
|
558
|
+
[stream_params, callbacks]
|
559
|
+
end
|
560
|
+
|
532
561
|
def warn_if_callbacks(options={})
|
533
562
|
if OPTION_CALLBACKS.select { |callback| options[callback] }.size > 0
|
534
563
|
Kernel.warn("Passing callbacks via the options hash is deprecated and will be removed in TweetStream 3.0")
|
data/lib/tweetstream/version.rb
CHANGED
@@ -31,7 +31,7 @@ describe TweetStream::Client do
|
|
31
31
|
|
32
32
|
it 'should try to connect via a JSON stream with basic auth' do
|
33
33
|
EM::Twitter::Client.should_receive(:connect).with(
|
34
|
-
:path => '/1/statuses/filter.json',
|
34
|
+
:path => '/1.1/statuses/filter.json',
|
35
35
|
:method => 'POST',
|
36
36
|
:user_agent => TweetStream::Configuration::DEFAULT_USER_AGENT,
|
37
37
|
:on_inited => nil,
|
@@ -61,7 +61,7 @@ describe TweetStream::Client do
|
|
61
61
|
|
62
62
|
it 'should try to connect via a JSON stream with oauth' do
|
63
63
|
EM::Twitter::Client.should_receive(:connect).with(
|
64
|
-
:path => '/1/statuses/filter.json',
|
64
|
+
:path => '/1.1/statuses/filter.json',
|
65
65
|
:method => 'POST',
|
66
66
|
:user_agent => TweetStream::Configuration::DEFAULT_USER_AGENT,
|
67
67
|
:on_inited => nil,
|
@@ -34,35 +34,35 @@ describe TweetStream::Client do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
it "uses the sitestream uri" do
|
37
|
-
@client.should_receive(:start).once.with('/
|
37
|
+
@client.should_receive(:start).once.with('/1.1/site.json', an_instance_of(Hash)).and_return(@stream)
|
38
38
|
@client.sitestream
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'supports "with followings" when followings set as a boolean' do
|
42
|
-
@client.should_receive(:start).once.with('/
|
42
|
+
@client.should_receive(:start).once.with('/1.1/site.json', hash_including(:with => 'followings')).and_return(@stream)
|
43
43
|
@client.sitestream(['115192457'], :followings => true)
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'supports "with followings" when followings set as an option' do
|
47
|
-
@client.should_receive(:start).once.with('/
|
47
|
+
@client.should_receive(:start).once.with('/1.1/site.json', hash_including(:with => 'followings')).and_return(@stream)
|
48
48
|
@client.sitestream(['115192457'], :with => 'followings')
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'supports "with user"' do
|
52
|
-
@client.should_receive(:start).once.with('/
|
52
|
+
@client.should_receive(:start).once.with('/1.1/site.json', hash_including(:with => 'user')).and_return(@stream)
|
53
53
|
@client.sitestream(['115192457'], :with => 'user')
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'supports "replies all"' do
|
57
|
-
@client.should_receive(:start).once.with('/
|
57
|
+
@client.should_receive(:start).once.with('/1.1/site.json', hash_including(:replies => 'all')).and_return(@stream)
|
58
58
|
@client.sitestream(['115192457'], :replies => 'all')
|
59
59
|
end
|
60
60
|
|
61
|
-
|
61
|
+
describe 'control management' do
|
62
62
|
before do
|
63
63
|
@control_response = {"control" =>
|
64
64
|
{
|
65
|
-
"control_uri" =>"/
|
65
|
+
"control_uri" =>"/1.1/site/c/01_225167_334389048B872A533002B34D73F8C29FD09EFC50"
|
66
66
|
}
|
67
67
|
}
|
68
68
|
end
|
@@ -70,7 +70,7 @@ describe TweetStream::Client do
|
|
70
70
|
@stream.should_receive(:each).and_yield(@control_response.to_json)
|
71
71
|
@client.sitestream
|
72
72
|
|
73
|
-
@client.control_uri.should eq("/
|
73
|
+
@client.control_uri.should eq("/1.1/site/c/01_225167_334389048B872A533002B34D73F8C29FD09EFC50")
|
74
74
|
end
|
75
75
|
|
76
76
|
it 'instantiates a SiteStreamClient' do
|
@@ -92,31 +92,51 @@ describe TweetStream::Client do
|
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
95
|
+
describe 'data handling' do
|
96
|
+
context 'messages' do
|
97
|
+
before do
|
98
|
+
@ss_message = {'for_user' => '12345', 'message' => {'id' => 123, 'user' => {'screen_name' => 'monkey'}, 'text' => 'Oo oo aa aa'}}
|
99
|
+
end
|
100
100
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
101
|
+
it 'yields a site stream message' do
|
102
|
+
@stream.should_receive(:each).and_yield(@ss_message.to_json)
|
103
|
+
yielded_status = nil
|
104
|
+
@client.sitestream do |message|
|
105
|
+
yielded_status = message
|
106
|
+
end
|
107
|
+
yielded_status.should_not be_nil
|
108
|
+
yielded_status[:for_user].should == '12345'
|
109
|
+
yielded_status[:message][:user][:screen_name].should == 'monkey'
|
110
|
+
yielded_status[:message][:text].should == 'Oo oo aa aa'
|
111
|
+
end
|
112
|
+
it 'yields itself if block has an arity of 2' do
|
113
|
+
@stream.should_receive(:each).and_yield(@ss_message.to_json)
|
114
|
+
yielded_client = nil
|
115
|
+
@client.sitestream do |_, client|
|
116
|
+
yielded_client = client
|
117
|
+
end
|
118
|
+
yielded_client.should_not be_nil
|
119
|
+
yielded_client.should == @client
|
106
120
|
end
|
107
|
-
yielded_status.should_not be_nil
|
108
|
-
yielded_status[:for_user].should == '12345'
|
109
|
-
yielded_status[:message][:user][:screen_name].should == 'monkey'
|
110
|
-
yielded_status[:message][:text].should == 'Oo oo aa aa'
|
111
121
|
end
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
122
|
+
|
123
|
+
context 'friends list' do
|
124
|
+
before do
|
125
|
+
@friends_list = { 'friends' => [123, 456] }
|
126
|
+
end
|
127
|
+
|
128
|
+
it 'yields a friends list array' do
|
129
|
+
@stream.should_receive(:each).and_yield(@friends_list.to_json)
|
130
|
+
yielded_list = nil
|
131
|
+
@client.on_friends do |friends|
|
132
|
+
yielded_list = friends
|
133
|
+
end
|
134
|
+
@client.sitestream
|
135
|
+
|
136
|
+
yielded_list.should_not be_nil
|
137
|
+
yielded_list.should be_an(Array)
|
138
|
+
yielded_list.first.should eq(123)
|
117
139
|
end
|
118
|
-
yielded_client.should_not be_nil
|
119
|
-
yielded_client.should == @client
|
120
140
|
end
|
121
141
|
end
|
122
142
|
end
|
@@ -75,7 +75,14 @@ describe TweetStream::Client do
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
it '
|
78
|
+
it 'calls the on_stall_warning callback if specified' do
|
79
|
+
@stream.should_receive(:each).and_yield(fixture('stall_warning.json'))
|
80
|
+
@client.on_stall_warning do |warning|
|
81
|
+
warning[:code].should eq('FALLING_BEHIND')
|
82
|
+
end.track('abc')
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'calls the on_scrub_geo callback if specified' do
|
79
86
|
@stream.should_receive(:each).and_yield(fixture('scrub_geo.json'))
|
80
87
|
@client.on_scrub_geo do |up_to_status_id, user_id|
|
81
88
|
up_to_status_id.should == 9876
|
@@ -241,64 +248,64 @@ describe TweetStream::Client do
|
|
241
248
|
describe 'API methods' do
|
242
249
|
%w(firehose retweet sample links).each do |method|
|
243
250
|
it "##{method} should make a call to start with \"statuses/#{method}\"" do
|
244
|
-
@client.should_receive(:start).once.with('/1/statuses/' + method + '.json', {})
|
251
|
+
@client.should_receive(:start).once.with('/1.1/statuses/' + method + '.json', {})
|
245
252
|
@client.send(method)
|
246
253
|
end
|
247
254
|
end
|
248
255
|
|
249
256
|
describe '#filter' do
|
250
257
|
it 'makes a call to "statuses/filter" with the query params provided' do
|
251
|
-
@client.should_receive(:start).once.with('/1/statuses/filter.json', :follow => 123, :method => :post)
|
258
|
+
@client.should_receive(:start).once.with('/1.1/statuses/filter.json', :follow => 123, :method => :post)
|
252
259
|
@client.filter(:follow => 123)
|
253
260
|
end
|
254
261
|
it 'makes a call to "statuses/filter" with the query params provided longitude/latitude pairs, separated by commas ' do
|
255
|
-
@client.should_receive(:start).once.with('/1/statuses/filter.json', :locations => '-122.75,36.8,-121.75,37.8,-74,40,-73,41', :method => :post)
|
262
|
+
@client.should_receive(:start).once.with('/1.1/statuses/filter.json', :locations => '-122.75,36.8,-121.75,37.8,-74,40,-73,41', :method => :post)
|
256
263
|
@client.filter(:locations => '-122.75,36.8,-121.75,37.8,-74,40,-73,41')
|
257
264
|
end
|
258
265
|
end
|
259
266
|
|
260
267
|
describe '#follow' do
|
261
268
|
it 'makes a call to start with "statuses/filter" and a follow query parameter' do
|
262
|
-
@client.should_receive(:start).once.with('/1/statuses/filter.json', :follow => [123], :method => :post)
|
269
|
+
@client.should_receive(:start).once.with('/1.1/statuses/filter.json', :follow => [123], :method => :post)
|
263
270
|
@client.follow(123)
|
264
271
|
end
|
265
272
|
|
266
273
|
it 'comma-joins multiple arguments' do
|
267
|
-
@client.should_receive(:start).once.with('/1/statuses/filter.json', :follow => [123,456], :method => :post)
|
274
|
+
@client.should_receive(:start).once.with('/1.1/statuses/filter.json', :follow => [123,456], :method => :post)
|
268
275
|
@client.follow(123, 456)
|
269
276
|
end
|
270
277
|
end
|
271
278
|
|
272
279
|
describe '#locations' do
|
273
280
|
it 'should call #start with "statuses/filter" with the query params provided longitude/latitude pairs' do
|
274
|
-
@client.should_receive(:start).once.with('/1/statuses/filter.json', :locations => ['-122.75,36.8,-121.75,37.8,-74,40,-73,41'], :method => :post)
|
281
|
+
@client.should_receive(:start).once.with('/1.1/statuses/filter.json', :locations => ['-122.75,36.8,-121.75,37.8,-74,40,-73,41'], :method => :post)
|
275
282
|
@client.locations('-122.75,36.8,-121.75,37.8,-74,40,-73,41')
|
276
283
|
end
|
277
284
|
|
278
285
|
it 'should call #start with "statuses/filter" with the query params provided longitude/latitude pairs and additional filter' do
|
279
|
-
@client.should_receive(:start).once.with('/1/statuses/filter.json', :locations => ['-122.75,36.8,-121.75,37.8,-74,40,-73,41'], :track => 'rock', :method => :post)
|
286
|
+
@client.should_receive(:start).once.with('/1.1/statuses/filter.json', :locations => ['-122.75,36.8,-121.75,37.8,-74,40,-73,41'], :track => 'rock', :method => :post)
|
280
287
|
@client.locations('-122.75,36.8,-121.75,37.8,-74,40,-73,41', :track => 'rock')
|
281
288
|
end
|
282
289
|
end
|
283
290
|
|
284
291
|
describe '#track' do
|
285
292
|
it 'makes a call to start with "statuses/filter" and a track query parameter' do
|
286
|
-
@client.should_receive(:start).once.with('/1/statuses/filter.json', :track => ['test'], :method => :post)
|
293
|
+
@client.should_receive(:start).once.with('/1.1/statuses/filter.json', :track => ['test'], :method => :post)
|
287
294
|
@client.track('test')
|
288
295
|
end
|
289
296
|
|
290
297
|
it 'comma-joins multiple arguments' do
|
291
|
-
@client.should_receive(:start).once.with('/1/statuses/filter.json', :track => ['foo', 'bar', 'baz'], :method => :post)
|
298
|
+
@client.should_receive(:start).once.with('/1.1/statuses/filter.json', :track => ['foo', 'bar', 'baz'], :method => :post)
|
292
299
|
@client.track('foo', 'bar', 'baz')
|
293
300
|
end
|
294
301
|
|
295
302
|
it 'comma-joins an array of arguments' do
|
296
|
-
@client.should_receive(:start).once.with('/1/statuses/filter.json', :track => [['foo','bar','baz']], :method => :post)
|
303
|
+
@client.should_receive(:start).once.with('/1.1/statuses/filter.json', :track => [['foo','bar','baz']], :method => :post)
|
297
304
|
@client.track(['foo','bar','baz'])
|
298
305
|
end
|
299
306
|
|
300
307
|
it 'should call #start with "statuses/filter" and the provided queries' do
|
301
|
-
@client.should_receive(:start).once.with('/1/statuses/filter.json', :track => ['rock'], :method => :post)
|
308
|
+
@client.should_receive(:start).once.with('/1.1/statuses/filter.json', :track => ['rock'], :method => :post)
|
302
309
|
@client.track('rock')
|
303
310
|
end
|
304
311
|
end
|
@@ -34,27 +34,27 @@ describe TweetStream::Client do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
it "uses the userstream uri" do
|
37
|
-
@client.should_receive(:start).once.with("/
|
37
|
+
@client.should_receive(:start).once.with("/1.1/user.json", an_instance_of(Hash)).and_return(@stream)
|
38
38
|
@client.userstream
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'supports "replies"' do
|
42
|
-
@client.should_receive(:start).once.with("/
|
42
|
+
@client.should_receive(:start).once.with("/1.1/user.json", hash_including(:replies => 'all')).and_return(@stream)
|
43
43
|
@client.userstream(:replies => 'all')
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'supports "stall_warnings"' do
|
47
|
-
@client.should_receive(:start).once.with("/
|
47
|
+
@client.should_receive(:start).once.with("/1.1/user.json", hash_including(:stall_warnings => 'true')).and_return(@stream)
|
48
48
|
@client.userstream(:stall_warnings => 'true')
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'supports "with followings"' do
|
52
|
-
@client.should_receive(:start).once.with("/
|
52
|
+
@client.should_receive(:start).once.with("/1.1/user.json", hash_including(:with => 'followings')).and_return(@stream)
|
53
53
|
@client.userstream(:with => 'followings')
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'supports "with user"' do
|
57
|
-
@client.should_receive(:start).once.with("/
|
57
|
+
@client.should_receive(:start).once.with("/1.1/user.json", hash_including(:with => 'user')).and_return(@stream)
|
58
58
|
@client.userstream(:with => 'user')
|
59
59
|
end
|
60
60
|
|
data/tweetstream.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.summary = %q{TweetStream is a simple wrapper for consuming the Twitter Streaming API.}
|
12
12
|
s.homepage = 'http://github.com/intridea/tweetstream'
|
13
13
|
|
14
|
-
s.add_dependency 'em-twitter', '~> 0.
|
14
|
+
s.add_dependency 'em-twitter', '~> 0.2'
|
15
15
|
s.add_dependency 'twitter', '~> 4.0'
|
16
16
|
s.add_dependency 'daemons', '~> 1.1'
|
17
17
|
s.add_dependency 'multi_json', '~> 1.3'
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_development_dependency 'rdiscount'
|
25
25
|
s.add_development_dependency 'rspec'
|
26
26
|
s.add_development_dependency 'simplecov'
|
27
|
-
s.add_development_dependency 'webmock'
|
27
|
+
s.add_development_dependency 'webmock', '>= 1.8.8'
|
28
28
|
s.add_development_dependency 'yajl-ruby'
|
29
29
|
s.add_development_dependency 'yard'
|
30
30
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tweetstream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-10-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: em-twitter
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '0.
|
22
|
+
version: '0.2'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,7 +27,7 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ~>
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version: '0.
|
30
|
+
version: '0.2'
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: twitter
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
@@ -211,7 +211,7 @@ dependencies:
|
|
211
211
|
requirements:
|
212
212
|
- - ! '>='
|
213
213
|
- !ruby/object:Gem::Version
|
214
|
-
version:
|
214
|
+
version: 1.8.8
|
215
215
|
type: :development
|
216
216
|
prerelease: false
|
217
217
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -219,7 +219,7 @@ dependencies:
|
|
219
219
|
requirements:
|
220
220
|
- - ! '>='
|
221
221
|
- !ruby/object:Gem::Version
|
222
|
-
version:
|
222
|
+
version: 1.8.8
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
224
|
name: yajl-ruby
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
@@ -268,6 +268,7 @@ files:
|
|
268
268
|
- .travis.yml
|
269
269
|
- .yardopts
|
270
270
|
- CHANGELOG.md
|
271
|
+
- CONTRIBUTING.md
|
271
272
|
- Gemfile
|
272
273
|
- Guardfile
|
273
274
|
- LICENSE.md
|
@@ -290,6 +291,7 @@ files:
|
|
290
291
|
- spec/fixtures/info.json
|
291
292
|
- spec/fixtures/limit.json
|
292
293
|
- spec/fixtures/scrub_geo.json
|
294
|
+
- spec/fixtures/stall_warning.json
|
293
295
|
- spec/fixtures/status_withheld.json
|
294
296
|
- spec/fixtures/statuses.json
|
295
297
|
- spec/fixtures/user_withheld.json
|
@@ -334,6 +336,7 @@ test_files:
|
|
334
336
|
- spec/fixtures/info.json
|
335
337
|
- spec/fixtures/limit.json
|
336
338
|
- spec/fixtures/scrub_geo.json
|
339
|
+
- spec/fixtures/stall_warning.json
|
337
340
|
- spec/fixtures/status_withheld.json
|
338
341
|
- spec/fixtures/statuses.json
|
339
342
|
- spec/fixtures/user_withheld.json
|