t 1.3.1 → 1.4.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.
- data/lib/t/cli.rb +6 -3
- data/lib/t/version.rb +2 -2
- data/spec/cli_spec.rb +27 -13
- data/spec/fixtures/activity_summary.json +1 -0
- data/spec/helper.rb +2 -2
- data/t.gemspec +1 -1
- metadata +10 -8
data/lib/t/cli.rb
CHANGED
@@ -557,7 +557,7 @@ module T
|
|
557
557
|
number = retweets.length
|
558
558
|
say "@#{@rcfile.active_profile[0]} retweeted #{pluralize(number, 'tweet')}."
|
559
559
|
say
|
560
|
-
say "Run `#{File.basename($0)} delete status #{retweets.map
|
560
|
+
say "Run `#{File.basename($0)} delete status #{retweets.map{|tweet| tweet.retweeted_status.id}.join(' ')}` to undo."
|
561
561
|
end
|
562
562
|
map %w(rt) => :retweet
|
563
563
|
|
@@ -598,6 +598,7 @@ module T
|
|
598
598
|
method_option "csv", :aliases => "-c", :type => :boolean, :default => false, :desc => "Output in CSV format."
|
599
599
|
def status(status_id)
|
600
600
|
status = client.status(status_id.to_i, :include_my_retweet => false)
|
601
|
+
status_activity = client.status_activity(status_id.to_i)
|
601
602
|
location = if status.place
|
602
603
|
if status.place.name && status.place.attributes && status.place.attributes[:street_address] && status.place.attributes[:locality] && status.place.attributes[:region] && status.place.country
|
603
604
|
[status.place.name, status.place.attributes[:street_address], status.place.attributes[:locality], status.place.attributes[:region], status.place.country].join(", ")
|
@@ -619,8 +620,8 @@ module T
|
|
619
620
|
if options['csv']
|
620
621
|
require 'csv'
|
621
622
|
require 'fastercsv' unless Array.new.respond_to?(:to_csv)
|
622
|
-
say ["ID", "Text", "Screen name", "Posted at", "Location", "Retweets", "Source", "URL"].to_csv
|
623
|
-
say [status.id, HTMLEntities.new.decode(status.full_text), status.from_user, csv_formatted_time(status), location, status.retweet_count, strip_tags(status.source), "https://twitter.com/#{status.from_user}/status/#{status.id}"].to_csv
|
623
|
+
say ["ID", "Text", "Screen name", "Posted at", "Location", "Retweets", "Favorites", "Replies", "Source", "URL"].to_csv
|
624
|
+
say [status.id, HTMLEntities.new.decode(status.full_text), status.from_user, csv_formatted_time(status), location, status.retweet_count, status_activity.favoriters_count, status_activity.repliers_count, strip_tags(status.source), "https://twitter.com/#{status.from_user}/status/#{status.id}"].to_csv
|
624
625
|
else
|
625
626
|
array = []
|
626
627
|
array << ["ID", status.id.to_s]
|
@@ -629,6 +630,8 @@ module T
|
|
629
630
|
array << ["Posted at", "#{ls_formatted_time(status)} (#{time_ago_in_words(status.created_at)} ago)"]
|
630
631
|
array << ["Location", location] unless location.nil?
|
631
632
|
array << ["Retweets", number_with_delimiter(status.retweet_count)]
|
633
|
+
array << ["Favorites", number_with_delimiter(status_activity.favoriters_count)]
|
634
|
+
array << ["Replies", number_with_delimiter(status_activity.repliers_count)]
|
632
635
|
array << ["Source", strip_tags(status.source)]
|
633
636
|
array << ["URL", "https://twitter.com/#{status.from_user}/status/#{status.id}"]
|
634
637
|
print_table(array)
|
data/lib/t/version.rb
CHANGED
data/spec/cli_spec.rb
CHANGED
@@ -2301,10 +2301,12 @@ ID Posted at Screen name Text
|
|
2301
2301
|
describe "#status" do
|
2302
2302
|
before do
|
2303
2303
|
stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2304
|
+
stub_get("/i/statuses/55709764298092545/activity/summary.json").to_return(:body => fixture("activity_summary.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2304
2305
|
end
|
2305
|
-
it "should request the correct
|
2306
|
+
it "should request the correct resources" do
|
2306
2307
|
@cli.status("55709764298092545")
|
2307
2308
|
expect(a_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"})).to have_been_made
|
2309
|
+
expect(a_get("/i/statuses/55709764298092545/activity/summary.json")).to have_been_made
|
2308
2310
|
end
|
2309
2311
|
it "should have the correct output" do
|
2310
2312
|
@cli.status("55709764298092545")
|
@@ -2315,6 +2317,8 @@ Screen name @sferik
|
|
2315
2317
|
Posted at Apr 6 2011 (8 months ago)
|
2316
2318
|
Location Blowfish Sushi To Die For, 2170 Bryant St, San Francisco, California, United States
|
2317
2319
|
Retweets 320
|
2320
|
+
Favorites 2
|
2321
|
+
Replies 1
|
2318
2322
|
Source Twitter for iPhone
|
2319
2323
|
URL https://twitter.com/sferik/status/55709764298092545
|
2320
2324
|
eos
|
@@ -2326,17 +2330,17 @@ URL https://twitter.com/sferik/status/55709764298092545
|
|
2326
2330
|
it "should have the correct output" do
|
2327
2331
|
@cli.status("55709764298092545")
|
2328
2332
|
expect($stdout.string).to eq <<-eos
|
2329
|
-
ID,Text,Screen name,Posted at,Location,Retweets,Source,URL
|
2330
|
-
55709764298092545,The problem with your code is that it's doing exactly what you told it to do.,sferik,2011-04-06 19:13:37 +0000,"Blowfish Sushi To Die For, 2170 Bryant St, San Francisco, California, United States",320,Twitter for iPhone,https://twitter.com/sferik/status/55709764298092545
|
2333
|
+
ID,Text,Screen name,Posted at,Location,Retweets,Favorites,Replies,Source,URL
|
2334
|
+
55709764298092545,The problem with your code is that it's doing exactly what you told it to do.,sferik,2011-04-06 19:13:37 +0000,"Blowfish Sushi To Die For, 2170 Bryant St, San Francisco, California, United States",320,2,1,Twitter for iPhone,https://twitter.com/sferik/status/55709764298092545
|
2331
2335
|
eos
|
2332
2336
|
end
|
2333
2337
|
end
|
2334
2338
|
context "with no street address" do
|
2335
2339
|
before do
|
2336
|
-
stub_get("/1.1/statuses/show/
|
2340
|
+
stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_street_address.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2337
2341
|
end
|
2338
2342
|
it "should have the correct output" do
|
2339
|
-
@cli.status("
|
2343
|
+
@cli.status("55709764298092545")
|
2340
2344
|
expect($stdout.string).to eq <<-eos
|
2341
2345
|
ID 55709764298092550
|
2342
2346
|
Text The problem with your code is that it's doing exactly what you told it to do.
|
@@ -2344,6 +2348,8 @@ Screen name @sferik
|
|
2344
2348
|
Posted at Apr 6 2011 (8 months ago)
|
2345
2349
|
Location Blowfish Sushi To Die For, San Francisco, California, United States
|
2346
2350
|
Retweets 320
|
2351
|
+
Favorites 2
|
2352
|
+
Replies 1
|
2347
2353
|
Source Twitter for iPhone
|
2348
2354
|
URL https://twitter.com/sferik/status/55709764298092550
|
2349
2355
|
eos
|
@@ -2351,10 +2357,10 @@ URL https://twitter.com/sferik/status/55709764298092550
|
|
2351
2357
|
end
|
2352
2358
|
context "with no locality" do
|
2353
2359
|
before do
|
2354
|
-
stub_get("/1.1/statuses/show/
|
2360
|
+
stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_locality.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2355
2361
|
end
|
2356
2362
|
it "should have the correct output" do
|
2357
|
-
@cli.status("
|
2363
|
+
@cli.status("55709764298092545")
|
2358
2364
|
expect($stdout.string).to eq <<-eos
|
2359
2365
|
ID 55709764298092549
|
2360
2366
|
Text The problem with your code is that it's doing exactly what you told it to do.
|
@@ -2362,6 +2368,8 @@ Screen name @sferik
|
|
2362
2368
|
Posted at Apr 6 2011 (8 months ago)
|
2363
2369
|
Location Blowfish Sushi To Die For, San Francisco, California, United States
|
2364
2370
|
Retweets 320
|
2371
|
+
Favorites 2
|
2372
|
+
Replies 1
|
2365
2373
|
Source Twitter for iPhone
|
2366
2374
|
URL https://twitter.com/sferik/status/55709764298092549
|
2367
2375
|
eos
|
@@ -2369,10 +2377,10 @@ URL https://twitter.com/sferik/status/55709764298092549
|
|
2369
2377
|
end
|
2370
2378
|
context "with no attributes" do
|
2371
2379
|
before do
|
2372
|
-
stub_get("/1.1/statuses/show/
|
2380
|
+
stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_attributes.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2373
2381
|
end
|
2374
2382
|
it "should have the correct output" do
|
2375
|
-
@cli.status("
|
2383
|
+
@cli.status("55709764298092545")
|
2376
2384
|
expect($stdout.string).to eq <<-eos
|
2377
2385
|
ID 55709764298092546
|
2378
2386
|
Text The problem with your code is that it's doing exactly what you told it to do.
|
@@ -2380,6 +2388,8 @@ Screen name @sferik
|
|
2380
2388
|
Posted at Apr 6 2011 (8 months ago)
|
2381
2389
|
Location Blowfish Sushi To Die For, San Francisco, United States
|
2382
2390
|
Retweets 320
|
2391
|
+
Favorites 2
|
2392
|
+
Replies 1
|
2383
2393
|
Source Twitter for iPhone
|
2384
2394
|
URL https://twitter.com/sferik/status/55709764298092546
|
2385
2395
|
eos
|
@@ -2387,10 +2397,10 @@ URL https://twitter.com/sferik/status/55709764298092546
|
|
2387
2397
|
end
|
2388
2398
|
context "with no country" do
|
2389
2399
|
before do
|
2390
|
-
stub_get("/1.1/statuses/show/
|
2400
|
+
stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_country.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2391
2401
|
end
|
2392
2402
|
it "should have the correct output" do
|
2393
|
-
@cli.status("
|
2403
|
+
@cli.status("55709764298092545")
|
2394
2404
|
expect($stdout.string).to eq <<-eos
|
2395
2405
|
ID 55709764298092547
|
2396
2406
|
Text The problem with your code is that it's doing exactly what you told it to do.
|
@@ -2398,6 +2408,8 @@ Screen name @sferik
|
|
2398
2408
|
Posted at Apr 6 2011 (8 months ago)
|
2399
2409
|
Location Blowfish Sushi To Die For, San Francisco
|
2400
2410
|
Retweets 320
|
2411
|
+
Favorites 2
|
2412
|
+
Replies 1
|
2401
2413
|
Source Twitter for iPhone
|
2402
2414
|
URL https://twitter.com/sferik/status/55709764298092547
|
2403
2415
|
eos
|
@@ -2405,10 +2417,10 @@ URL https://twitter.com/sferik/status/55709764298092547
|
|
2405
2417
|
end
|
2406
2418
|
context "with no full name" do
|
2407
2419
|
before do
|
2408
|
-
stub_get("/1.1/statuses/show/
|
2420
|
+
stub_get("/1.1/statuses/show/55709764298092545.json").with(:query => {:include_my_retweet => "false"}).to_return(:body => fixture("status_no_full_name.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
2409
2421
|
end
|
2410
2422
|
it "should have the correct output" do
|
2411
|
-
@cli.status("
|
2423
|
+
@cli.status("55709764298092545")
|
2412
2424
|
expect($stdout.string).to eq <<-eos
|
2413
2425
|
ID 55709764298092548
|
2414
2426
|
Text The problem with your code is that it's doing exactly what you told it to do.
|
@@ -2416,6 +2428,8 @@ Screen name @sferik
|
|
2416
2428
|
Posted at Apr 6 2011 (8 months ago)
|
2417
2429
|
Location Blowfish Sushi To Die For
|
2418
2430
|
Retweets 320
|
2431
|
+
Favorites 2
|
2432
|
+
Replies 1
|
2419
2433
|
Source Twitter for iPhone
|
2420
2434
|
URL https://twitter.com/sferik/status/55709764298092548
|
2421
2435
|
eos
|
@@ -0,0 +1 @@
|
|
1
|
+
{"retweeters_count":"1","repliers":[15395778],"retweeters":[5407632],"favoriters_count":"2","repliers_count":"1","favoriters":[5407632,15395778]}
|
data/spec/helper.rb
CHANGED
@@ -11,7 +11,7 @@ require 't'
|
|
11
11
|
require 'rspec'
|
12
12
|
require 'timecop'
|
13
13
|
require 'webmock/rspec'
|
14
|
-
require '
|
14
|
+
require 'multi_json'
|
15
15
|
|
16
16
|
RSpec.configure do |config|
|
17
17
|
config.expect_with :rspec do |c|
|
@@ -64,5 +64,5 @@ def fixture(file)
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def status_from_fixture(file)
|
67
|
-
Twitter::Status.new(
|
67
|
+
Twitter::Status.new(MultiJson.load(fixture(file).read, :symbolize_keys => true))
|
68
68
|
end
|
data/t.gemspec
CHANGED
@@ -6,8 +6,8 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.add_dependency 'fastercsv', '~> 1.5'
|
7
7
|
gem.add_dependency 'geokit', '~> 1.6'
|
8
8
|
gem.add_dependency 'htmlentities', '~> 4.3'
|
9
|
-
gem.add_dependency 'json', '~> 1.6'
|
10
9
|
gem.add_dependency 'oauth', '~> 0.4'
|
10
|
+
gem.add_dependency 'oj', '~> 1.4'
|
11
11
|
gem.add_dependency 'retryable', '~> 1.2'
|
12
12
|
gem.add_dependency 'thor', ['>= 0.16', '< 2']
|
13
13
|
gem.add_dependency 'tweetstream', '~> 2.3'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: t
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: launchy
|
@@ -76,13 +76,13 @@ dependencies:
|
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '4.3'
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
79
|
+
name: oauth
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|
83
83
|
- - ~>
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: '
|
85
|
+
version: '0.4'
|
86
86
|
type: :runtime
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,15 +90,15 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: '
|
93
|
+
version: '0.4'
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
95
|
+
name: oj
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
99
99
|
- - ~>
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: '
|
101
|
+
version: '1.4'
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,7 +106,7 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
109
|
+
version: '1.4'
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: retryable
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -305,6 +305,7 @@ files:
|
|
305
305
|
- spec/fixtures/501_ids.json
|
306
306
|
- spec/fixtures/501_users_list.json
|
307
307
|
- spec/fixtures/access_token
|
308
|
+
- spec/fixtures/activity_summary.json
|
308
309
|
- spec/fixtures/checkip.html
|
309
310
|
- spec/fixtures/direct_message.json
|
310
311
|
- spec/fixtures/direct_messages.json
|
@@ -380,6 +381,7 @@ test_files:
|
|
380
381
|
- spec/fixtures/501_ids.json
|
381
382
|
- spec/fixtures/501_users_list.json
|
382
383
|
- spec/fixtures/access_token
|
384
|
+
- spec/fixtures/activity_summary.json
|
383
385
|
- spec/fixtures/checkip.html
|
384
386
|
- spec/fixtures/direct_message.json
|
385
387
|
- spec/fixtures/direct_messages.json
|