tweetstream 1.0.3 → 1.0.4
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 +1 -1
- data/lib/tweetstream/client.rb +8 -1
- data/spec/tweetstream/client_spec.rb +7 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.4
|
data/lib/tweetstream/client.rb
CHANGED
@@ -194,7 +194,14 @@ module TweetStream
|
|
194
194
|
)
|
195
195
|
|
196
196
|
@stream.each_item do |item|
|
197
|
-
|
197
|
+
raw_hash = @parser.decode(item)
|
198
|
+
|
199
|
+
unless raw_hash.is_a?(::Hash)
|
200
|
+
error_proc.call("Unexpected JSON object in stream: #{item}")
|
201
|
+
next
|
202
|
+
end
|
203
|
+
|
204
|
+
hash = TweetStream::Hash.new(raw_hash) # @parser.parse(item)
|
198
205
|
|
199
206
|
if hash[:delete] && hash[:delete][:status]
|
200
207
|
delete_proc.call(hash[:delete][:status][:id], hash[:delete][:status][:user_id]) if delete_proc.is_a?(Proc)
|
@@ -125,6 +125,13 @@ describe TweetStream::Client do
|
|
125
125
|
track.should == 1234
|
126
126
|
end.track('abc')
|
127
127
|
end
|
128
|
+
|
129
|
+
it 'should call on_error if a non-hash response is received' do
|
130
|
+
@stream.should_receive(:each_item).and_yield('["favorited"]')
|
131
|
+
@client.on_error do |message|
|
132
|
+
message.should == 'Unexpected JSON object in stream: ["favorited"]'
|
133
|
+
end.track('abc')
|
134
|
+
end
|
128
135
|
end
|
129
136
|
|
130
137
|
describe '#on_error' 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: 1.0.
|
4
|
+
version: 1.0.4
|
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: 2010-02-
|
12
|
+
date: 2010-02-11 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|