t 2.6.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/t/cli.rb +10 -11
- data/lib/t/printable.rb +1 -0
- data/lib/t/version.rb +1 -1
- data/spec/cli_spec.rb +17 -17
- data/spec/delete_spec.rb +4 -4
- data/spec/editor_spec.rb +1 -1
- data/spec/helper.rb +1 -1
- data/spec/list_spec.rb +6 -6
- data/spec/stream_spec.rb +30 -30
- data/t.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ea297cdce1433a41e22a761b8733085600eaac1
|
4
|
+
data.tar.gz: 5fe95feae2722d81db4ce981e1165d0cbbdb6a29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bf21ca07c797bf8b2e13ca7ffead2ffd4410caf58f294b6d37ba2129cb178e5cdc560fdf29d90cc9096691f077a992af50045ee424e9ac34f54dbefaca945fb
|
7
|
+
data.tar.gz: b20ae5df1eae6d4f006ee0957bfa741ac4f4f5777af17ce0d1589ece0aca45cbb534feb499034c1417adad06a45ce07f885555af18edbf38ed149cf7b0f4b13a
|
data/Rakefile
CHANGED
data/lib/t/cli.rb
CHANGED
@@ -96,7 +96,7 @@ module T
|
|
96
96
|
open_or_print(uri, :dry_run => options['display-uri'])
|
97
97
|
pin = ask 'Enter the supplied PIN:'
|
98
98
|
access_token = request_token.get_access_token(:oauth_verifier => pin.chomp)
|
99
|
-
oauth_response = access_token.get('/1.1/account/verify_credentials.json?
|
99
|
+
oauth_response = access_token.get('/1.1/account/verify_credentials.json?skip_status=true')
|
100
100
|
screen_name = oauth_response.body.match(/"screen_name"\s*:\s*"(.*?)"/).captures.first
|
101
101
|
@rcfile[screen_name] = {
|
102
102
|
key => {
|
@@ -667,7 +667,7 @@ module T
|
|
667
667
|
map %w[retweetsofme] => :retweets_of_me
|
668
668
|
|
669
669
|
desc 'ruler', 'Prints a 140-character ruler'
|
670
|
-
method_option 'indent', :aliases => '-i', :type => :numeric, :default => 0, :desc => 'The number of
|
670
|
+
method_option 'indent', :aliases => '-i', :type => :numeric, :default => 0, :desc => 'The number of spaces to print before the ruler.'
|
671
671
|
def ruler
|
672
672
|
markings = '----|'.chars.cycle.take(140).join
|
673
673
|
say "#{' ' * options['indent'].to_i}#{markings}"
|
@@ -683,15 +683,15 @@ module T
|
|
683
683
|
opts[:include_entities] = !!options['decode_uris']
|
684
684
|
status = client.status(status_id.to_i, opts)
|
685
685
|
location = if status.place?
|
686
|
-
if status.place.name && status.place.attributes && status.place.attributes[:street_address] && status.place.attributes[:locality] && status.place.attributes[:region] && status.place.country
|
686
|
+
if status.place.name? && status.place.attributes? && status.place.attributes[:street_address] && status.place.attributes[:locality] && status.place.attributes[:region] && status.place.country?
|
687
687
|
[status.place.name, status.place.attributes[:street_address], status.place.attributes[:locality], status.place.attributes[:region], status.place.country].join(', ')
|
688
|
-
elsif status.place.name && status.place.attributes && status.place.attributes[:locality] && status.place.attributes[:region] && status.place.country
|
688
|
+
elsif status.place.name? && status.place.attributes? && status.place.attributes[:locality] && status.place.attributes[:region] && status.place.country?
|
689
689
|
[status.place.name, status.place.attributes[:locality], status.place.attributes[:region], status.place.country].join(', ')
|
690
|
-
elsif status.place.full_name && status.place.attributes && status.place.attributes[:region] && status.place.country
|
690
|
+
elsif status.place.full_name? && status.place.attributes? && status.place.attributes[:region] && status.place.country?
|
691
691
|
[status.place.full_name, status.place.attributes[:region], status.place.country].join(', ')
|
692
|
-
elsif status.place.full_name && status.place.country
|
692
|
+
elsif status.place.full_name? && status.place.country?
|
693
693
|
[status.place.full_name, status.place.country].join(', ')
|
694
|
-
elsif status.place.full_name
|
694
|
+
elsif status.place.full_name?
|
695
695
|
status.place.full_name
|
696
696
|
else
|
697
697
|
status.place.name
|
@@ -953,10 +953,9 @@ module T
|
|
953
953
|
end
|
954
954
|
|
955
955
|
def add_location!(options, opts)
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
end
|
956
|
+
return nil unless options['location']
|
957
|
+
lat, lng = options['location'] == 'location' ? [location.lat, location.lng] : options['location'].split(',').collect(&:to_f)
|
958
|
+
opts.merge!(:lat => lat, :long => lng)
|
960
959
|
end
|
961
960
|
|
962
961
|
def location
|
data/lib/t/printable.rb
CHANGED
data/lib/t/version.rb
CHANGED
data/spec/cli_spec.rb
CHANGED
@@ -47,7 +47,7 @@ testcli
|
|
47
47
|
@cli.options = @cli.options.merge('profile' => project_path + '/tmp/authorize', 'display-uri' => true)
|
48
48
|
stub_post('/oauth/request_token').to_return(:body => fixture('request_token'))
|
49
49
|
stub_post('/oauth/access_token').to_return(:body => fixture('access_token'))
|
50
|
-
stub_get('/1.1/account/verify_credentials.json').with(:query => {:
|
50
|
+
stub_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
51
51
|
end
|
52
52
|
it 'requests the correct resource' do
|
53
53
|
expect(Readline).to receive(:readline).with('Press [Enter] to open the Twitter Developer site. ', true).and_return("\n")
|
@@ -58,7 +58,7 @@ testcli
|
|
58
58
|
@cli.authorize
|
59
59
|
expect(a_post('/oauth/request_token')).to have_been_made
|
60
60
|
expect(a_post('/oauth/access_token')).to have_been_made
|
61
|
-
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:
|
61
|
+
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
|
62
62
|
end
|
63
63
|
it 'does not raise error' do
|
64
64
|
expect do
|
@@ -86,7 +86,7 @@ testcli
|
|
86
86
|
@cli.authorize
|
87
87
|
expect(a_post('/oauth/request_token')).to have_been_made
|
88
88
|
expect(a_post('/oauth/access_token')).to have_been_made
|
89
|
-
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:
|
89
|
+
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
|
90
90
|
end
|
91
91
|
it 'does not raise error' do
|
92
92
|
expect do
|
@@ -937,14 +937,14 @@ ID Posted at Screen name Text
|
|
937
937
|
end
|
938
938
|
context 'one user' do
|
939
939
|
before do
|
940
|
-
stub_get('/1.1/account/verify_credentials.json').with(:query => {:
|
940
|
+
stub_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
941
941
|
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
942
942
|
stub_post('/1.1/users/lookup.json').with(:body => {:screen_name => 'sferik,pengwynn'}).to_return(:body => fixture('users.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
943
943
|
stub_post('/1.1/friendships/create.json').with(:body => {:user_id => '14100886'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
944
944
|
end
|
945
945
|
it 'requests the correct resource' do
|
946
946
|
@cli.follow('sferik', 'pengwynn')
|
947
|
-
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:
|
947
|
+
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
|
948
948
|
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
|
949
949
|
expect(a_post('/1.1/users/lookup.json').with(:body => {:screen_name => 'sferik,pengwynn'})).to have_been_made
|
950
950
|
expect(a_post('/1.1/friendships/create.json').with(:body => {:user_id => '14100886'})).to have_been_made
|
@@ -985,13 +985,13 @@ ID Posted at Screen name Text
|
|
985
985
|
|
986
986
|
describe '#followings' do
|
987
987
|
before do
|
988
|
-
stub_get('/1.1/account/verify_credentials.json').with(:query => {:
|
988
|
+
stub_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
989
989
|
stub_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
990
990
|
stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('users.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
991
991
|
end
|
992
992
|
it 'requests the correct resource' do
|
993
993
|
@cli.followings
|
994
|
-
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:
|
994
|
+
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
|
995
995
|
expect(a_get('/1.1/friends/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
|
996
996
|
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'})).to have_been_made
|
997
997
|
end
|
@@ -1281,13 +1281,13 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
1281
1281
|
|
1282
1282
|
describe '#followers' do
|
1283
1283
|
before do
|
1284
|
-
stub_get('/1.1/account/verify_credentials.json').with(:query => {:
|
1284
|
+
stub_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
1285
1285
|
stub_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'}).to_return(:body => fixture('friends_ids.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
1286
1286
|
stub_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'}).to_return(:body => fixture('users.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
1287
1287
|
end
|
1288
1288
|
it 'requests the correct resource' do
|
1289
1289
|
@cli.followers
|
1290
|
-
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:
|
1290
|
+
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
|
1291
1291
|
expect(a_get('/1.1/followers/ids.json').with(:query => {:cursor => '-1', :user_id => '7505382'})).to have_been_made
|
1292
1292
|
expect(a_post('/1.1/users/lookup.json').with(:body => {:user_id => '7505382'})).to have_been_made
|
1293
1293
|
end
|
@@ -2071,9 +2071,9 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
2071
2071
|
@cli.lists
|
2072
2072
|
expect($stdout.string).to eq <<-eos
|
2073
2073
|
ID,Created at,Screen name,Slug,Members,Subscribers,Mode,Description
|
2074
|
-
1129440,2009-10-30 14:39:25 +0000,pengwynn,rubyists,499,39,public,
|
2075
|
-
574,2009-09-23 01:18:01 +0000,twitter,team,1199,78078,other,
|
2076
|
-
73546689,2012-07-08 22:19:05 +0000,sferik,test,2,0,private,
|
2074
|
+
1129440,2009-10-30 14:39:25 +0000,pengwynn,rubyists,499,39,public,
|
2075
|
+
574,2009-09-23 01:18:01 +0000,twitter,team,1199,78078,other,
|
2076
|
+
73546689,2012-07-08 22:19:05 +0000,sferik,test,2,0,private,
|
2077
2077
|
eos
|
2078
2078
|
end
|
2079
2079
|
end
|
@@ -3201,7 +3201,7 @@ Location Blowfish Sushi To Die For
|
|
3201
3201
|
context 'with no place' do
|
3202
3202
|
before do
|
3203
3203
|
stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_place.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
3204
|
-
stub_request(:get, '
|
3204
|
+
stub_request(:get, 'https://maps.google.com/maps/api/geocode/json').with(:query => {:latlng => '37.75963095,-122.410067', :sensor => 'false'}).to_return(:body => fixture('geo.json'), :headers => {:content_type => 'application/json; charset=UTF-8'})
|
3205
3205
|
end
|
3206
3206
|
it 'has the correct output' do
|
3207
3207
|
@cli.status('55709764298092545')
|
@@ -3219,7 +3219,7 @@ Location San Francisco, CA, United States
|
|
3219
3219
|
context 'with no city' do
|
3220
3220
|
before do
|
3221
3221
|
stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_place.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
3222
|
-
stub_request(:get, '
|
3222
|
+
stub_request(:get, 'https://maps.google.com/maps/api/geocode/json').with(:query => {:latlng => '37.75963095,-122.410067', :sensor => 'false'}).to_return(:body => fixture('geo_no_city.json'), :headers => {:content_type => 'application/json; charset=UTF-8'})
|
3223
3223
|
end
|
3224
3224
|
it 'has the correct output' do
|
3225
3225
|
@cli.status('55709764298092545')
|
@@ -3238,7 +3238,7 @@ Location CA, United States
|
|
3238
3238
|
context 'with no state' do
|
3239
3239
|
before do
|
3240
3240
|
stub_get('/1.1/statuses/show/55709764298092545.json').with(:query => {:include_my_retweet => 'false', :include_entities => 'false'}).to_return(:body => fixture('status_no_place.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
3241
|
-
stub_request(:get, '
|
3241
|
+
stub_request(:get, 'https://maps.google.com/maps/api/geocode/json').with(:query => {:latlng => '37.75963095,-122.410067', :sensor => 'false'}).to_return(:body => fixture('geo_no_state.json'), :headers => {:content_type => 'application/json; charset=UTF-8'})
|
3242
3242
|
end
|
3243
3243
|
it 'has the correct output' do
|
3244
3244
|
@cli.status('55709764298092545')
|
@@ -3709,7 +3709,7 @@ WOEID,Parent ID,Type,Name,Country
|
|
3709
3709
|
2487956,23424977,Town,San Francisco,United States
|
3710
3710
|
1587677,23424942,Unknown,Soweto,South Africa
|
3711
3711
|
23424977,1,Country,United States,United States
|
3712
|
-
1,0,Supername,Worldwide,
|
3712
|
+
1,0,Supername,Worldwide,
|
3713
3713
|
eos
|
3714
3714
|
end
|
3715
3715
|
end
|
@@ -3743,7 +3743,7 @@ WOEID Parent ID Type Name Country
|
|
3743
3743
|
end
|
3744
3744
|
it 'sorts by the country name' do
|
3745
3745
|
@cli.trend_locations
|
3746
|
-
expect($stdout.string.chomp).to eq '
|
3746
|
+
expect($stdout.string.chomp).to eq 'Soweto San Francisco United States Worldwide'
|
3747
3747
|
end
|
3748
3748
|
end
|
3749
3749
|
context '--sort=parent' do
|
data/spec/delete_spec.rb
CHANGED
@@ -128,14 +128,14 @@ describe T::Delete do
|
|
128
128
|
describe '#list' do
|
129
129
|
before do
|
130
130
|
@delete.options = @delete.options.merge('profile' => fixture_path + '/.trc')
|
131
|
-
stub_get('/1.1/account/verify_credentials.json').with(:query => {:
|
131
|
+
stub_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
132
132
|
stub_get('/1.1/lists/show.json').with(:query => {:owner_id => '7505382', :slug => 'presidents'}).to_return(:body => fixture('list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
133
133
|
stub_post('/1.1/lists/destroy.json').with(:body => {:owner_id => '7505382', :list_id => '8863586'}).to_return(:body => fixture('list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
134
134
|
end
|
135
135
|
it 'requests the correct resource' do
|
136
136
|
expect(Readline).to receive(:readline).with("Are you sure you want to permanently delete the list \"presidents\"? [y/N] ", false).and_return('yes')
|
137
137
|
@delete.list('presidents')
|
138
|
-
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:
|
138
|
+
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
|
139
139
|
expect(a_post('/1.1/lists/destroy.json').with(:body => {:owner_id => '7505382', :list_id => '8863586'})).to have_been_made
|
140
140
|
end
|
141
141
|
context 'yes' do
|
@@ -158,7 +158,7 @@ describe T::Delete do
|
|
158
158
|
end
|
159
159
|
it 'requests the correct resource' do
|
160
160
|
@delete.list('presidents')
|
161
|
-
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:
|
161
|
+
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
|
162
162
|
expect(a_post('/1.1/lists/destroy.json').with(:body => {:owner_id => '7505382', :list_id => '8863586'})).to have_been_made
|
163
163
|
end
|
164
164
|
it 'has the correct output' do
|
@@ -175,7 +175,7 @@ describe T::Delete do
|
|
175
175
|
expect(Readline).to receive(:readline).with("Are you sure you want to permanently delete the list \"presidents\"? [y/N] ", false).and_return('yes')
|
176
176
|
@delete.list('8863586')
|
177
177
|
expect(a_get('/1.1/lists/show.json').with(:query => {:owner_id => '7505382', :list_id => '8863586'})).to have_been_made
|
178
|
-
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:
|
178
|
+
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
|
179
179
|
expect(a_post('/1.1/lists/destroy.json').with(:body => {:owner_id => '7505382', :list_id => '8863586'})).to have_been_made
|
180
180
|
end
|
181
181
|
end
|
data/spec/editor_spec.rb
CHANGED
data/spec/helper.rb
CHANGED
data/spec/list_spec.rb
CHANGED
@@ -31,12 +31,12 @@ describe T::List do
|
|
31
31
|
describe '#add' do
|
32
32
|
before do
|
33
33
|
@list.options = @list.options.merge('profile' => fixture_path + '/.trc')
|
34
|
-
stub_get('/1.1/account/verify_credentials.json').with(:query => {:
|
34
|
+
stub_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
35
35
|
stub_post('/1.1/lists/members/create_all.json').with(:body => {:screen_name => 'BarackObama', :slug => 'presidents', :owner_id => '7505382'}).to_return(:body => fixture('list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
36
36
|
end
|
37
37
|
it 'requests the correct resource' do
|
38
38
|
@list.add('presidents', 'BarackObama')
|
39
|
-
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:
|
39
|
+
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
|
40
40
|
expect(a_post('/1.1/lists/members/create_all.json').with(:body => {:screen_name => 'BarackObama', :slug => 'presidents', :owner_id => '7505382'})).to have_been_made
|
41
41
|
end
|
42
42
|
it 'has the correct output' do
|
@@ -50,7 +50,7 @@ describe T::List do
|
|
50
50
|
end
|
51
51
|
it 'requests the correct resource' do
|
52
52
|
@list.add('presidents', '7505382')
|
53
|
-
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:
|
53
|
+
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
|
54
54
|
expect(a_post('/1.1/lists/members/create_all.json').with(:body => {:user_id => '7505382', :slug => 'presidents', :owner_id => '7505382'})).to have_been_made
|
55
55
|
end
|
56
56
|
end
|
@@ -290,12 +290,12 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
290
290
|
describe '#remove' do
|
291
291
|
before do
|
292
292
|
@list.options = @list.options.merge('profile' => fixture_path + '/.trc')
|
293
|
-
stub_get('/1.1/account/verify_credentials.json').with(:query => {:
|
293
|
+
stub_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'}).to_return(:body => fixture('sferik.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
294
294
|
end
|
295
295
|
it 'requests the correct resource' do
|
296
296
|
stub_post('/1.1/lists/members/destroy_all.json').with(:body => {:screen_name => 'BarackObama', :slug => 'presidents', :owner_id => '7505382'}).to_return(:body => fixture('list.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
297
297
|
@list.remove('presidents', 'BarackObama')
|
298
|
-
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:
|
298
|
+
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
|
299
299
|
expect(a_post('/1.1/lists/members/destroy_all.json').with(:body => {:screen_name => 'BarackObama', :slug => 'presidents', :owner_id => '7505382'})).to have_been_made
|
300
300
|
end
|
301
301
|
it 'has the correct output' do
|
@@ -310,7 +310,7 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
310
310
|
end
|
311
311
|
it 'requests the correct resource' do
|
312
312
|
@list.remove('presidents', '7505382')
|
313
|
-
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:
|
313
|
+
expect(a_get('/1.1/account/verify_credentials.json').with(:query => {:skip_status => 'true'})).to have_been_made
|
314
314
|
expect(a_post('/1.1/lists/members/destroy_all.json').with(:body => {:user_id => '7505382', :slug => 'presidents', :owner_id => '7505382'})).to have_been_made
|
315
315
|
end
|
316
316
|
end
|
data/spec/stream_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'helper'
|
|
3
3
|
describe T::Stream do
|
4
4
|
let(:t_class) do
|
5
5
|
klass = Class.new
|
6
|
-
allow(klass).to receive(:options=)
|
6
|
+
allow(klass).to receive(:options=)
|
7
7
|
allow(klass).to receive(:options).and_return({})
|
8
8
|
klass
|
9
9
|
end
|
@@ -17,7 +17,7 @@ describe T::Stream do
|
|
17
17
|
@streaming_client = double('Twitter::Streaming::Client').as_null_object
|
18
18
|
@stream = T::Stream.new
|
19
19
|
allow(@stream).to receive(:streaming_client) { @streaming_client }
|
20
|
-
allow(@stream).to receive(:say)
|
20
|
+
allow(@stream).to receive(:say)
|
21
21
|
allow(STDOUT).to receive(:tty?).and_return(true)
|
22
22
|
end
|
23
23
|
|
@@ -35,12 +35,12 @@ describe T::Stream do
|
|
35
35
|
end
|
36
36
|
it 'outputs headings when the stream initializes' do
|
37
37
|
allow(@streaming_client).to receive(:before_request).and_yield
|
38
|
-
allow(@streaming_client).to receive(:sample)
|
38
|
+
allow(@streaming_client).to receive(:sample)
|
39
39
|
expect(@stream).to receive(:say).with("ID,Posted at,Screen name,Text\n")
|
40
40
|
@stream.all
|
41
41
|
end
|
42
42
|
it 'outputs in CSV format' do
|
43
|
-
allow(@streaming_client).to receive(:before_request)
|
43
|
+
allow(@streaming_client).to receive(:before_request)
|
44
44
|
allow(@streaming_client).to receive(:sample).and_yield(@status)
|
45
45
|
expect(@stream).to receive(:print_csv_tweet).with(any_args)
|
46
46
|
@stream.all
|
@@ -52,20 +52,20 @@ describe T::Stream do
|
|
52
52
|
end
|
53
53
|
it 'outputs headings when the stream initializes' do
|
54
54
|
allow(@streaming_client).to receive(:before_request).and_yield
|
55
|
-
allow(@streaming_client).to receive(:sample)
|
55
|
+
allow(@streaming_client).to receive(:sample)
|
56
56
|
expect(@stream).to receive(:print_table).with(any_args)
|
57
57
|
@stream.all
|
58
58
|
end
|
59
59
|
it 'outputs in long text format' do
|
60
|
-
allow(@streaming_client).to receive(:before_request)
|
60
|
+
allow(@streaming_client).to receive(:before_request)
|
61
61
|
allow(@streaming_client).to receive(:sample).and_yield(@status)
|
62
62
|
expect(@stream).to receive(:print_table).with(any_args)
|
63
63
|
@stream.all
|
64
64
|
end
|
65
65
|
end
|
66
66
|
it 'invokes Twitter::Streaming::Client#sample' do
|
67
|
-
allow(@streaming_client).to receive(:before_request)
|
68
|
-
allow(@streaming_client).to receive(:sample)
|
67
|
+
allow(@streaming_client).to receive(:before_request)
|
68
|
+
allow(@streaming_client).to receive(:sample)
|
69
69
|
expect(@streaming_client).to receive(:sample)
|
70
70
|
@stream.all
|
71
71
|
end
|
@@ -89,7 +89,7 @@ describe T::Stream do
|
|
89
89
|
@stream.options = @stream.options.merge('csv' => true)
|
90
90
|
end
|
91
91
|
it 'outputs in CSV format' do
|
92
|
-
allow(@streaming_client).to receive(:before_request)
|
92
|
+
allow(@streaming_client).to receive(:before_request)
|
93
93
|
allow(@streaming_client).to receive(:filter).and_yield(@status)
|
94
94
|
expect(@stream).to receive(:print_csv_tweet).with(any_args)
|
95
95
|
@stream.list('presidents')
|
@@ -104,7 +104,7 @@ describe T::Stream do
|
|
104
104
|
@stream.options = @stream.options.merge('long' => true)
|
105
105
|
end
|
106
106
|
it 'outputs in long text format' do
|
107
|
-
allow(@streaming_client).to receive(:before_request)
|
107
|
+
allow(@streaming_client).to receive(:before_request)
|
108
108
|
allow(@streaming_client).to receive(:filter).and_yield(@status)
|
109
109
|
expect(@stream).to receive(:print_table).with(any_args)
|
110
110
|
@stream.list('presidents')
|
@@ -116,13 +116,13 @@ describe T::Stream do
|
|
116
116
|
end
|
117
117
|
it 'performs a REST search when the stream initializes' do
|
118
118
|
allow(@streaming_client).to receive(:before_request).and_yield
|
119
|
-
allow(@streaming_client).to receive(:filter)
|
119
|
+
allow(@streaming_client).to receive(:filter)
|
120
120
|
allow(T::List).to receive(:new).and_return(t_class)
|
121
|
-
expect(t_class).to receive(:timeline)
|
121
|
+
expect(t_class).to receive(:timeline)
|
122
122
|
@stream.list('presidents')
|
123
123
|
end
|
124
124
|
it 'invokes Twitter::Streaming::Client#userstream' do
|
125
|
-
allow(@streaming_client).to receive(:filter)
|
125
|
+
allow(@streaming_client).to receive(:filter)
|
126
126
|
expect(@streaming_client).to receive(:filter)
|
127
127
|
@stream.list('presidents')
|
128
128
|
end
|
@@ -133,13 +133,13 @@ describe T::Stream do
|
|
133
133
|
stub_get('/1.1/search/tweets.json').with(:query => {:q => 'lang:ja', :count => 100, :include_entities => 'false'}).to_return(:body => fixture('empty_cursor.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
134
134
|
end
|
135
135
|
it 'outputs the tweet status' do
|
136
|
-
allow(@streaming_client).to receive(:before_request)
|
136
|
+
allow(@streaming_client).to receive(:before_request)
|
137
137
|
allow(@streaming_client).to receive(:sample).and_yield(@status)
|
138
138
|
expect(@stream).to receive(:say).with(any_args)
|
139
139
|
@stream.matrix
|
140
140
|
end
|
141
141
|
it 'invokes Twitter::Streaming::Client#sample' do
|
142
|
-
allow(@streaming_client).to receive(:before_request)
|
142
|
+
allow(@streaming_client).to receive(:before_request)
|
143
143
|
allow(@streaming_client).to receive(:sample).and_yield(@status)
|
144
144
|
expect(@streaming_client).to receive(:sample)
|
145
145
|
@stream.matrix
|
@@ -164,7 +164,7 @@ describe T::Stream do
|
|
164
164
|
@stream.options = @stream.options.merge('csv' => true)
|
165
165
|
end
|
166
166
|
it 'outputs in CSV format' do
|
167
|
-
allow(@streaming_client).to receive(:before_request)
|
167
|
+
allow(@streaming_client).to receive(:before_request)
|
168
168
|
expect(@stream).to receive(:print_csv_tweet).with(any_args)
|
169
169
|
@stream.search(%w[twitter gem])
|
170
170
|
end
|
@@ -174,7 +174,7 @@ describe T::Stream do
|
|
174
174
|
@stream.options = @stream.options.merge('long' => true)
|
175
175
|
end
|
176
176
|
it 'outputs in long text format' do
|
177
|
-
allow(@streaming_client).to receive(:before_request)
|
177
|
+
allow(@streaming_client).to receive(:before_request)
|
178
178
|
allow(@streaming_client).to receive(:filter).with(:track => 'twitter,gem').and_yield(@status)
|
179
179
|
expect(@stream).to receive(:print_table).with(any_args)
|
180
180
|
@stream.search(%w[twitter gem])
|
@@ -182,13 +182,13 @@ describe T::Stream do
|
|
182
182
|
end
|
183
183
|
it 'performs a REST search when the stream initializes' do
|
184
184
|
allow(@streaming_client).to receive(:before_request).and_yield
|
185
|
-
allow(@streaming_client).to receive(:filter)
|
185
|
+
allow(@streaming_client).to receive(:filter)
|
186
186
|
allow(T::Search).to receive(:new).and_return(t_class)
|
187
|
-
expect(t_class).to receive(:all).with('t OR gem')
|
187
|
+
expect(t_class).to receive(:all).with('t OR gem')
|
188
188
|
@stream.search('t', 'gem')
|
189
189
|
end
|
190
190
|
it 'invokes Twitter::Streaming::Client#filter' do
|
191
|
-
allow(@streaming_client).to receive(:filter)
|
191
|
+
allow(@streaming_client).to receive(:filter)
|
192
192
|
expect(@streaming_client).to receive(:filter).with(:track => 'twitter,gem')
|
193
193
|
@stream.search(%w[twitter gem])
|
194
194
|
end
|
@@ -207,7 +207,7 @@ describe T::Stream do
|
|
207
207
|
@stream.options = @stream.options.merge('csv' => true)
|
208
208
|
end
|
209
209
|
it 'outputs in CSV format' do
|
210
|
-
allow(@streaming_client).to receive(:before_request)
|
210
|
+
allow(@streaming_client).to receive(:before_request)
|
211
211
|
expect(@stream).to receive(:print_csv_tweet).with(any_args)
|
212
212
|
@stream.timeline
|
213
213
|
end
|
@@ -217,20 +217,20 @@ describe T::Stream do
|
|
217
217
|
@stream.options = @stream.options.merge('long' => true)
|
218
218
|
end
|
219
219
|
it 'outputs in long text format' do
|
220
|
-
allow(@streaming_client).to receive(:before_request)
|
220
|
+
allow(@streaming_client).to receive(:before_request)
|
221
221
|
expect(@stream).to receive(:print_table).with(any_args)
|
222
222
|
@stream.timeline
|
223
223
|
end
|
224
224
|
end
|
225
225
|
it 'performs a REST search when the stream initializes' do
|
226
226
|
allow(@streaming_client).to receive(:before_request).and_yield
|
227
|
-
allow(@streaming_client).to receive(:user)
|
227
|
+
allow(@streaming_client).to receive(:user)
|
228
228
|
allow(T::CLI).to receive(:new).and_return(t_class)
|
229
|
-
expect(t_class).to receive(:timeline)
|
229
|
+
expect(t_class).to receive(:timeline)
|
230
230
|
@stream.timeline
|
231
231
|
end
|
232
232
|
it 'invokes Twitter::Streaming::Client#userstream' do
|
233
|
-
allow(@streaming_client).to receive(:user)
|
233
|
+
allow(@streaming_client).to receive(:user)
|
234
234
|
expect(@streaming_client).to receive(:user)
|
235
235
|
@stream.timeline
|
236
236
|
end
|
@@ -250,12 +250,12 @@ describe T::Stream do
|
|
250
250
|
end
|
251
251
|
it 'outputs headings when the stream initializes' do
|
252
252
|
allow(@streaming_client).to receive(:before_request).and_yield
|
253
|
-
allow(@streaming_client).to receive(:filter)
|
253
|
+
allow(@streaming_client).to receive(:filter)
|
254
254
|
expect(@stream).to receive(:say).with("ID,Posted at,Screen name,Text\n")
|
255
255
|
@stream.users('123')
|
256
256
|
end
|
257
257
|
it 'outputs in CSV format' do
|
258
|
-
allow(@streaming_client).to receive(:before_request)
|
258
|
+
allow(@streaming_client).to receive(:before_request)
|
259
259
|
expect(@stream).to receive(:print_csv_tweet).with(any_args)
|
260
260
|
@stream.users('123')
|
261
261
|
end
|
@@ -266,19 +266,19 @@ describe T::Stream do
|
|
266
266
|
end
|
267
267
|
it 'outputs headings when the stream initializes' do
|
268
268
|
allow(@streaming_client).to receive(:before_request).and_yield
|
269
|
-
allow(@streaming_client).to receive(:filter)
|
269
|
+
allow(@streaming_client).to receive(:filter)
|
270
270
|
expect(@stream).to receive(:print_table).with(any_args)
|
271
271
|
@stream.users('123')
|
272
272
|
end
|
273
273
|
it 'outputs in long text format' do
|
274
|
-
allow(@streaming_client).to receive(:before_request)
|
274
|
+
allow(@streaming_client).to receive(:before_request)
|
275
275
|
allow(@streaming_client).to receive(:filter).and_yield(@status)
|
276
276
|
expect(@stream).to receive(:print_table).with(any_args)
|
277
277
|
@stream.users('123')
|
278
278
|
end
|
279
279
|
end
|
280
280
|
it 'invokes Twitter::Streaming::Client#follow' do
|
281
|
-
allow(@streaming_client).to receive(:filter)
|
281
|
+
allow(@streaming_client).to receive(:filter)
|
282
282
|
expect(@streaming_client).to receive(:filter).with(:follow => '123,456,789')
|
283
283
|
@stream.users('123', '456', '789')
|
284
284
|
end
|
data/t.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.add_dependency 'oauth', '~> 0.4.7'
|
11
11
|
spec.add_dependency 'retryable', '~> 1.3'
|
12
12
|
spec.add_dependency 'thor', ['>= 0.19.1', '< 2']
|
13
|
-
spec.add_dependency 'twitter', '~> 5.
|
13
|
+
spec.add_dependency 'twitter', '~> 5.11'
|
14
14
|
spec.add_development_dependency 'bundler', '~> 1.0'
|
15
15
|
spec.author = 'Erik Michaels-Ober'
|
16
16
|
spec.bindir = 'bin'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: t
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Michaels-Ober
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: launchy
|
@@ -112,14 +112,14 @@ dependencies:
|
|
112
112
|
requirements:
|
113
113
|
- - "~>"
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: '5.
|
115
|
+
version: '5.11'
|
116
116
|
type: :runtime
|
117
117
|
prerelease: false
|
118
118
|
version_requirements: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
120
|
- - "~>"
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: '5.
|
122
|
+
version: '5.11'
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
124
|
name: bundler
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
@@ -245,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
245
|
version: 1.3.5
|
246
246
|
requirements: []
|
247
247
|
rubyforge_project:
|
248
|
-
rubygems_version: 2.
|
248
|
+
rubygems_version: 2.3.0
|
249
249
|
signing_key:
|
250
250
|
specification_version: 4
|
251
251
|
summary: CLI for Twitter
|
@@ -312,3 +312,4 @@ test_files:
|
|
312
312
|
- spec/set_spec.rb
|
313
313
|
- spec/stream_spec.rb
|
314
314
|
- spec/utils_spec.rb
|
315
|
+
has_rdoc:
|