twitter 5.4.0 → 5.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +4 -0
- data/lib/twitter/rest/api/search.rb +2 -0
- data/lib/twitter/version.rb +1 -1
- data/spec/twitter/rest/api/search_spec.rb +25 -18
- data/spec/twitter/search_results_spec.rb +2 -2
- metadata +2 -4
- metadata.gz.sig +2 -3
- data/spec/twitter_spec.rb +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
5.4.1
|
2
|
+
-----
|
3
|
+
* [Default to maximum number of tweets per request](https://github.com/sferik/twitter/commit/1e41b5d4dde8678f5968b57dafe9da63b092646c)
|
4
|
+
|
1
5
|
5.4.0
|
2
6
|
-----
|
3
7
|
* [Fix enumerable search interface](https://github.com/sferik/twitter/commit/e14cc3391ebe8229184e9e83806c870df3baa24c)
|
@@ -6,6 +6,7 @@ module Twitter
|
|
6
6
|
module API
|
7
7
|
module Search
|
8
8
|
include Twitter::REST::API::Utils
|
9
|
+
MAX_TWEETS_PER_REQUEST = 100
|
9
10
|
|
10
11
|
# Returns tweets that match a specified query.
|
11
12
|
#
|
@@ -28,6 +29,7 @@ module Twitter
|
|
28
29
|
# @option options [Boolean, String, Integer] :include_entities The tweet entities node will be disincluded when set to false.
|
29
30
|
# @return [Twitter::SearchResults] Return tweets that match a specified query with search metadata
|
30
31
|
def search(q, options = {})
|
32
|
+
options[:count] ||= MAX_TWEETS_PER_REQUEST
|
31
33
|
search_results_from_response(:get, '/1.1/search/tweets.json', options.merge(:q => q))
|
32
34
|
end
|
33
35
|
|
data/lib/twitter/version.rb
CHANGED
@@ -7,27 +7,34 @@ describe Twitter::REST::API::Search do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
describe '#search' do
|
10
|
-
|
11
|
-
stub_get('/1.1/search/tweets.json').with(:query => {:q => '#freebandnames'}).to_return(:body => fixture('search.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
12
|
-
end
|
13
|
-
it 'requests the correct resource' do
|
14
|
-
@client.search('#freebandnames')
|
15
|
-
expect(a_get('/1.1/search/tweets.json').with(:query => {:q => '#freebandnames'})).to have_been_made
|
16
|
-
end
|
17
|
-
it 'returns recent Tweets related to a query with images and videos embedded' do
|
18
|
-
search = @client.search('#freebandnames')
|
19
|
-
expect(search).to be_a Twitter::SearchResults
|
20
|
-
expect(search.first).to be_a Twitter::Tweet
|
21
|
-
expect(search.first.text).to eq('@Just_Reboot #FreeBandNames mono surround')
|
22
|
-
end
|
23
|
-
context 'when search API responds a malformed result' do
|
10
|
+
context 'without count specified' do
|
24
11
|
before do
|
25
|
-
stub_get('/1.1/search/tweets.json').with(:query => {:q => '#freebandnames'}).to_return(:body => fixture('
|
12
|
+
stub_get('/1.1/search/tweets.json').with(:query => {:q => '#freebandnames', :count => '100'}).to_return(:body => fixture('search.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
26
13
|
end
|
27
|
-
it '
|
14
|
+
it 'requests the correct resource' do
|
15
|
+
@client.search('#freebandnames')
|
16
|
+
expect(a_get('/1.1/search/tweets.json').with(:query => {:q => '#freebandnames', :count => '100'})).to have_been_made
|
17
|
+
end
|
18
|
+
it 'returns recent Tweets related to a query with images and videos embedded' do
|
28
19
|
search = @client.search('#freebandnames')
|
29
|
-
expect(search
|
30
|
-
expect(search.
|
20
|
+
expect(search).to be_a Twitter::SearchResults
|
21
|
+
expect(search.first).to be_a Twitter::Tweet
|
22
|
+
expect(search.first.text).to eq('@Just_Reboot #FreeBandNames mono surround')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
context 'with count specified' do
|
26
|
+
before do
|
27
|
+
stub_get('/1.1/search/tweets.json').with(:query => {:q => '#freebandnames', :count => '3'}).to_return(:body => fixture('search.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
28
|
+
end
|
29
|
+
it 'requests the correct resource' do
|
30
|
+
@client.search('#freebandnames', :count => 3)
|
31
|
+
expect(a_get('/1.1/search/tweets.json').with(:query => {:q => '#freebandnames', :count => '3'})).to have_been_made
|
32
|
+
end
|
33
|
+
it 'returns recent Tweets related to a query with images and videos embedded' do
|
34
|
+
search = @client.search('#freebandnames', :count => 3)
|
35
|
+
expect(search).to be_a Twitter::SearchResults
|
36
|
+
expect(search.first).to be_a Twitter::Tweet
|
37
|
+
expect(search.first.text).to eq('@Just_Reboot #FreeBandNames mono surround')
|
31
38
|
end
|
32
39
|
end
|
33
40
|
end
|
@@ -5,12 +5,12 @@ describe Twitter::SearchResults do
|
|
5
5
|
describe '#each' do
|
6
6
|
before do
|
7
7
|
@client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
|
8
|
-
stub_get('/1.1/search/tweets.json').with(:query => {:q => '#freebandnames'}).to_return(:body => fixture('search.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
8
|
+
stub_get('/1.1/search/tweets.json').with(:query => {:q => '#freebandnames', :count => '100'}).to_return(:body => fixture('search.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
9
9
|
stub_get('/1.1/search/tweets.json').with(:query => {:q => '#freebandnames', :count => '3', :include_entities => '1', :max_id => '414071361066532863'}).to_return(:body => fixture('search2.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
10
10
|
end
|
11
11
|
it 'requests the correct resources' do
|
12
12
|
@client.search('#freebandnames').each {}
|
13
|
-
expect(a_get('/1.1/search/tweets.json').with(:query => {:q => '#freebandnames'})).to have_been_made
|
13
|
+
expect(a_get('/1.1/search/tweets.json').with(:query => {:q => '#freebandnames', :count => '100'})).to have_been_made
|
14
14
|
expect(a_get('/1.1/search/tweets.json').with(:query => {:q => '#freebandnames', :count => '3', :include_entities => '1', :max_id => '414071361066532863'})).to have_been_made
|
15
15
|
end
|
16
16
|
it 'iterates' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.4.
|
4
|
+
version: 5.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -453,7 +453,6 @@ files:
|
|
453
453
|
- spec/twitter/trend_spec.rb
|
454
454
|
- spec/twitter/tweet_spec.rb
|
455
455
|
- spec/twitter/user_spec.rb
|
456
|
-
- spec/twitter_spec.rb
|
457
456
|
homepage: http://sferik.github.com/twitter/
|
458
457
|
licenses:
|
459
458
|
- MIT
|
@@ -469,7 +468,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
469
468
|
version: '0'
|
470
469
|
segments:
|
471
470
|
- 0
|
472
|
-
hash:
|
471
|
+
hash: -2856060050130677509
|
473
472
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
474
473
|
none: false
|
475
474
|
requirements:
|
@@ -605,5 +604,4 @@ test_files:
|
|
605
604
|
- spec/twitter/trend_spec.rb
|
606
605
|
- spec/twitter/tweet_spec.rb
|
607
606
|
- spec/twitter/user_spec.rb
|
608
|
-
- spec/twitter_spec.rb
|
609
607
|
has_rdoc:
|
metadata.gz.sig
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
��&/�y�D�i$!�7�Ŀ�������H�ɄfF�,�Ӎ ��J�+�6b8���ܔ��'�ע��(�p�l��Ds�B�oM�gN� z
|
1
|
+
6����rNV
|
2
|
+
�FK�� r�VԮ_�J�҉O�_k� ��ae��҇�h�U������y����FX�gҒ������<V��%�m����$B<F#9#м�۸ڂ�K)i��/
|
data/spec/twitter_spec.rb
DELETED
File without changes
|