Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow user to pass String or Twitter::User to Twitter::Streaming::Cli…

…ent#site
  • Loading branch information...
commit e3ad4f2da1f8fc82e1d3febbc2602f626bced8a8 1 parent 2b20b37
@sferik authored
Showing with 18 additions and 1 deletion.
  1. +18 −1 lib/twitter/streaming/client.rb
View
19 lib/twitter/streaming/client.rb
@@ -65,7 +65,8 @@ def sample(options={}, &block)
# @yield [Twitter::Tweet] A stream of tweets.
def site(*args, &block)
arguments = Arguments.new(args)
- request(:get, 'https://sitestream.twitter.com:443/1.1/site.json', arguments.options.merge(:follow => arguments.join(',')), &block)
+ user_ids = collect_user_ids(arguments)
+ request(:get, 'https://sitestream.twitter.com:443/1.1/site.json', arguments.options.merge(:follow => user_ids.join(',')), &block)
end
# Streams messages for a single user
@@ -121,6 +122,22 @@ def default_headers
:user_agent => user_agent,
}
end
+
+ def collect_user_ids(users)
+ user_ids = []
+ users.flatten.each do |user|
+ case user
+ when Integer
+ user_ids << user
+ when String
+ user_ids << user.to_i
+ when Twitter::User
+ user_ids << user.id
+ end
+ end
+ user_ids
+ end
+
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.