Module: Herald::Watcher::Twitter
- Defined in:
- lib/herald/watchers/twitter.rb
Overview
TODO, ignore retweets, if option passed
Constant Summary collapse
- TWITTER_API =
"http://search.twitter.com/search.json"
Instance Attribute Summary collapse
-
#last_tweet_id ⇒ Object
Returns the value of attribute last_tweet_id.
-
#uri ⇒ Object
Returns the value of attribute uri.
Class Method Summary collapse
-
.included(base) ⇒ Object
lazy-load open-uri when this Module is used.
Instance Method Summary collapse
- #cleanup ⇒ Object
- #parse_options(options) ⇒ Object
-
#prepare ⇒ Object
executed before Watcher starts.
- #to_s ⇒ Object
Instance Attribute Details
#last_tweet_id ⇒ Object
Returns the value of attribute last_tweet_id.
8 9 10 |
# File 'lib/herald/watchers/twitter.rb', line 8 def last_tweet_id @last_tweet_id end |
#uri ⇒ Object
Returns the value of attribute uri.
8 9 10 |
# File 'lib/herald/watchers/twitter.rb', line 8 def uri @uri end |
Class Method Details
Instance Method Details
#cleanup ⇒ Object
31 |
# File 'lib/herald/watchers/twitter.rb', line 31 def cleanup; end |
#parse_options(options) ⇒ Object
16 |
# File 'lib/herald/watchers/twitter.rb', line 16 def (); end |
#prepare ⇒ Object
executed before Watcher starts
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/herald/watchers/twitter.rb', line 19 def prepare # twitter doesn't allow you to query its api without # providing a query string if @keywords.empty? raise ArgumentError, "Keywords are missing" end # initialise array, first element will be the Twitter API with search query string, # the second element will be a "since_id" extra query parameter, added at close of # activities() loop @uri = ["#{TWITTER_API}?q=#{@keywords.join('+')}"] end |
#to_s ⇒ Object
33 34 35 |
# File 'lib/herald/watchers/twitter.rb', line 33 def to_s "Herald Twitter Watcher, Keywords: '#{@keywords}', Timer: #{@timer}, State: #{@keep_alive ? 'Watching' : 'Stopped'}" end |