lib/streambot.rb in streambot-0.2.5 vs lib/streambot.rb in streambot-0.3.0

- old
+ new

@@ -1,36 +1,15 @@ require 'rubygems' +require 'open-uri' +require 'net/http' require 'tweetstream' -require 'retweet' +require 'logger' -# The StreamBot class that provides a start and a stop method -class StreamBot - - # the initialization method aka the constructor - def initialize(auth, blacklist, *keywords) - @stream = TweetStream::Client.new(auth[:username],auth[:password]) - # initializing retweet - @retweet = Retweet.new(auth) # - # get string with keywords comma separated keywords - @keywords=keywords.join(',') - # set blacklist array if not nil - @blacklist=blacklist - end - - # start the bot - def start - # starting to track the keywords via tweetstream - @stream.track(@keywords) do |status| - # if status.user is NOT in blacklist then retweet it - if !@blacklist.include?(status.user.screen_name) - #puts "#{status.text} ##{status.id}" - @retweet.retweet(status.id) - end - end - end - - # stop the bot - def stop - @stream.stop - end - -end +require 'streambot/tracker' +require 'streambot/retweet' +require 'streambot/http' + +module StreamBot + LOG = Logger.new(STDOUT) + LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR + PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR +end \ No newline at end of file