lib/pupil/stream/base.rb in pupil-0.3.0 vs lib/pupil/stream/base.rb in pupil-0.3.1
- old
+ new
@@ -64,22 +64,24 @@
end
end
end
def guess_event status
- if status["event"]
+ if status["event"] && status["event"]["follow"]
+ return Pupil::Stream::User.new(status["target"], @access_token, :follow)
+ elsif status["event"]
return Pupil::Stream::Hash.new(status, status["event"].to_sym)
elsif status["friends"]
return Pupil::Stream::Array.new(status["friends"], :friends)
elsif status["delete"]
return Pupil::Stream::Hash.new(status["delete"]["status"], :delete)
elsif status["direct_message"]
return Pupil::Stream::Hash.new(status["direct_message"], :direct_message)
elsif status["retweeted_status"]
return Pupil::Stream::Status.new(status, @access_token, :retweeted)
elsif status["text"]
- return Pupil::Stream::Status.new(status, @access_token)
+ return Pupil::Stream::Status.new(status, @access_token, :status)
else
return Pupil::Stream::Hash.new(status, :unknown)
end
end
@@ -116,9 +118,19 @@
def initialize(status, event)
super(status)
#self.update(status)
@event = event
+ end
+ end
+
+ # Stream User
+ class User < Pupil::User
+ attr_reader :event
+
+ def initialize(status, access_token, event=nil)
+ super(status, access_token)
+ @event = :follow
end
end
end
end