class Myun2::TwitterShell::Tail
Public Class Methods
home_timeline_streaming(profile, &block)
click to toggle source
# File lib/myun2/twitter_shell/tail.rb, line 25 def self.home_timeline_streaming(profile, &block) streaming_client(profile).user({}, &block) end
new(profile, *params)
click to toggle source
# File lib/myun2/twitter_shell/tail.rb, line 7 def initialize(profile, *params) Tail.home_timeline_streaming(profile) do |o| if o.is_a?(::Twitter::Tweet) puts "#{o.created_at} -> @#{o.user.screen_name}" puts "\e[38;5;#{o.user.id % 255}m<#{o.user.name}>\e[0m: #{o.text}" end end end
streaming_client(profile)
click to toggle source
# File lib/myun2/twitter_shell/tail.rb, line 16 def self.streaming_client(profile) @@client ||= ::Twitter::Streaming::Client.new( consumer_key: Myun2::TwitterShell::ConsumerKey::KEY, consumer_secret: Myun2::TwitterShell::ConsumerKey::SECRET, access_token: profile[:access_token], access_token_secret: profile[:access_token_secret], ) end