Class: Atig::Agent::StreamFollow
- Inherits:
-
Object
- Object
- Atig::Agent::StreamFollow
- Includes:
- Util
- Defined in:
- lib/atig/agent/stream_follow.rb
Instance Method Summary collapse
-
#initialize(context, api, db) ⇒ StreamFollow
constructor
A new instance of StreamFollow.
Methods included from ExceptionUtil
Constructor Details
#initialize(context, api, db) ⇒ StreamFollow
Returns a new instance of StreamFollow.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/atig/agent/stream_follow.rb', line 9 def initialize(context, api, db) @log = context.log @api = api @prev = nil return unless context.opts.stream log :info, "initialize" @api.delay(0)do|t| @follows = context.opts.follow.split(',').map{|user| t.get("users/show",:screen_name=>user).id }.join(',') end @api.stream do|t| Thread.pass until @follows t.watch('statuses/filter', :follow => @follows) do |status| if status and status.user db.transaction do|d| d.statuses.add :status => status, :user => status.user, :source => :stream_follow end end end end end |