lib/augury/fortune.rb in augury-1.1.1 vs lib/augury/fortune.rb in augury-1.1.2
- old
+ new
@@ -25,18 +25,21 @@
collect_with_max_id(collection, response.last.id - 1, &block)
end
end
def retrieve_tweets
+ # Make sure the case of the name is correct to avoid errors in the Twitter API
+ screen_name = @twitter.user(@username).screen_name
+
@tweets = collect_with_max_id do |max_id|
options = {
count: 200,
tweet_mode: 'extended',
include_rts: @config[:retweets],
exclude_replies: !@config[:replies],
}
options[:max_id] = max_id unless max_id.nil?
- @twitter.user_timeline(@username, options)
+ @twitter.user_timeline(screen_name, options)
end
rescue Twitter::Error::TooManyRequests => e
reset_length = e.rate_limit.reset_in + 1
puts "Twitter rate limit exceeded. Waiting #{reset_length} minute(s)"
sleep reset_length