Skip to content

Commit

Permalink
Only stream Tweets
Browse files Browse the repository at this point in the history
Closes #133.
  • Loading branch information
sferik committed Dec 12, 2013
1 parent 20876ca commit 7d07285
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/t/stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def all
end
end
client.sample do |tweet|
next unless tweet.is_a?(Twitter::Tweet)
if options['csv']
print_csv_tweet(tweet)
elsif options['long']
Expand All @@ -53,6 +54,7 @@ def all
desc 'matrix', 'Unfortunately, no one can be told what the Matrix is. You have to see it for yourself.'
def matrix
client.sample(:language => 'ja') do |tweet|
next unless tweet.is_a?(Twitter::Tweet)
say(tweet.full_text.gsub("\n", '').reverse, [:bold, :green, :on_black])
end
end
Expand All @@ -71,6 +73,7 @@ def search(keyword, *keywords)
search.all(keywords.join(' OR '))
end
client.filter(:track => keywords) do |tweet|
next unless tweet.is_a?(Twitter::Tweet)
if options['csv']
print_csv_tweet(tweet)
elsif options['long']
Expand All @@ -97,6 +100,7 @@ def timeline
cli.timeline
end
client.user do |tweet|
next unless tweet.is_a?(Twitter::Tweet)
if options['csv']
print_csv_tweet(tweet)
elsif options['long']
Expand Down Expand Up @@ -128,6 +132,7 @@ def users(user_id, *user_ids)
end
end
client.follow(user_ids) do |tweet|
next unless tweet.is_a?(Twitter::Tweet)
if options['csv']
print_csv_tweet(tweet)
elsif options['long']
Expand Down
2 changes: 1 addition & 1 deletion t.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'oauth', '~> 0.4'
spec.add_dependency 'retryable', '~> 1.2'
spec.add_dependency 'thor', ['>= 0.18.1', '< 2']
spec.add_dependency 'twitter', '~> 5.0'
spec.add_dependency 'twitter', '~> 5.2'
spec.add_development_dependency 'bundler', '~> 1.0'
spec.author = "Erik Michaels-Ober"
spec.bindir = 'bin'
Expand Down

0 comments on commit 7d07285

Please sign in to comment.