tweetstream 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of tweetstream might be problematic. Click here for more details.

data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -65,9 +65,9 @@ module TweetStream
65
65
  def track(*keywords, &block)
66
66
  query_params = keywords.pop if keywords.last.is_a?(::Hash)
67
67
  query_params ||= {}
68
- start('statuses/filter', query_params.merge(:track => keywords.join(',')), &block)
68
+ filter(query_params.merge(:track => keywords), &block)
69
69
  end
70
-
70
+
71
71
  # Returns public statuses from or in reply to a set of users. Mentions
72
72
  # ("Hello @user!") and implicit replies ("@user Hello!" created without
73
73
  # pressing the reply "swoosh") are not matched. Requires integer user
@@ -75,7 +75,23 @@ module TweetStream
75
75
  def follow(*user_ids, &block)
76
76
  query_params = user_ids.pop if user_ids.last.is_a?(::Hash)
77
77
  query_params ||= {}
78
- start('statuses/filter', query_params.merge(:follow => user_ids.join(',')), &block)
78
+ filter(query_params.merge(:follow => user_ids), &block)
79
+ end
80
+
81
+ # Make a call to the statuses/filter method of the Streaming API,
82
+ # you may provide <tt>:follow</tt>, <tt>:track</tt> or both as options
83
+ # to follow the tweets of specified users or track keywords. This
84
+ # method is provided separately for cases when it would conserve the
85
+ # number of HTTP connections to combine track and follow.
86
+ def filter(query_params = {}, &block)
87
+ [:follow, :track].each do |param|
88
+ if query_params[param].is_a?(Array)
89
+ query_params[param] = query_params[param].collect{|q| q.to_s}.join(',')
90
+ elsif query_params[param]
91
+ query_params[param] = query_params[param].to_s
92
+ end
93
+ end
94
+ start('statuses/filter', query_params, &block)
79
95
  end
80
96
 
81
97
  def start(path, query_parameters = {}, &block) #:nodoc:
@@ -107,6 +107,11 @@ describe TweetStream::Client do
107
107
  @client.should_receive(:start).once.with('statuses/filter', :follow => '123,456')
108
108
  @client.follow(123, 456)
109
109
  end
110
+
111
+ it '#filter should make a call to "statuses/filter" with the query params provided' do
112
+ @client.should_receive(:start).once.with('statuses/filter', :follow => '123')
113
+ @client.filter(:follow => 123)
114
+ end
110
115
  end
111
116
 
112
117
  describe '#track' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tweetstream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-22 00:00:00 -04:00
12
+ date: 2009-09-23 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency