scamp 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/scamp/rooms.rb +7 -1
- data/lib/scamp/version.rb +1 -1
- data/spec/lib/scamp_spec.rb +15 -2
- metadata +16 -16
data/lib/scamp/rooms.rb
CHANGED
@@ -99,7 +99,13 @@ class Scamp
|
|
99
99
|
http = EventMachine::HttpRequest.new(url, :connect_timeout => 20, :inactivity_timeout => 0).get :head => {'authorization' => [api_key, 'X']}
|
100
100
|
http.errback { logger.error "Couldn't stream room #{room_id} at url #{url}" }
|
101
101
|
http.callback { logger.info "Disconnected from #{url}"; rooms_to_join << room_id}
|
102
|
-
http.stream
|
102
|
+
http.stream do |chunk|
|
103
|
+
begin
|
104
|
+
json_parser << chunk
|
105
|
+
rescue Yajl::ParseError => e
|
106
|
+
logger.error "Couldn't parse room data for room #{room_id} with url #{url}, http response data was #{chunk[0..50]}..."
|
107
|
+
end
|
108
|
+
end
|
103
109
|
end
|
104
110
|
|
105
111
|
def room_id_from_room_name(room_name)
|
data/lib/scamp/version.rb
CHANGED
data/spec/lib/scamp_spec.rb
CHANGED
@@ -662,10 +662,23 @@ describe Scamp do
|
|
662
662
|
}
|
663
663
|
logger_output.should =~ /ERROR.*Couldn't connect to #{@room_url} to fetch room data for room 123/
|
664
664
|
end
|
665
|
-
|
665
|
+
|
666
666
|
it "should stream a room"
|
667
|
+
|
668
|
+
it "should handle response errors streaming a room" do
|
669
|
+
mock_logger
|
670
|
+
bot = a Scamp
|
671
|
+
|
672
|
+
EM.run_block {
|
673
|
+
stub_request(:get, @stream_url).
|
674
|
+
with(:headers => {'Authorization'=>[@valid_params[:api_key], 'X']}).
|
675
|
+
to_return(:status => 201, :body => 'foobarbaz', :headers => {})
|
676
|
+
lambda { bot.send(:stream, 123) }.should_not raise_error
|
677
|
+
}
|
678
|
+
logger_output.should =~ /ERROR.*Couldn't parse room data for room 123 with url #{@stream_url}, http response data was foobarbaz.../
|
679
|
+
end
|
680
|
+
|
667
681
|
it "should handle HTTP errors streaming a room"
|
668
|
-
it "should handle network errors streaming a room"
|
669
682
|
end
|
670
683
|
|
671
684
|
context "message operations" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scamp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-25 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|
16
|
-
requirement: &
|
16
|
+
requirement: &2151961800 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.0.0.beta.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2151961800
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: yajl-ruby
|
27
|
-
requirement: &
|
27
|
+
requirement: &2151961120 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.8.3
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2151961120
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: em-http-request
|
38
|
-
requirement: &
|
38
|
+
requirement: &2151959580 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.0.0.beta.4
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2151959580
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
|
-
requirement: &
|
49
|
+
requirement: &2151959120 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.9.2
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2151959120
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &2151958640 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 2.6.0
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2151958640
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: mocha
|
71
|
-
requirement: &
|
71
|
+
requirement: &2151958160 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.10.0
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2151958160
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: webmock
|
82
|
-
requirement: &
|
82
|
+
requirement: &2151957680 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: 1.7.6
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2151957680
|
91
91
|
description: Eventmachine based Campfire bot framework
|
92
92
|
email:
|
93
93
|
- will@willj.net
|