punchblock 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # develop
2
2
 
3
+ # v0.7.1 - 2011-11-24
4
+ * [FEATURE] Add `Connection#not_ready!`, to instruct the server not to send any more offers.
5
+ * [BUGFIX] Translate all exceptions raised by the XMPP connection into a ProtocolError
6
+ * [UPDATE] Blather dependency to >= 0.5.9
7
+
3
8
  # v0.7.0 - 2011-11-22
4
9
  * Bugfix: Some spec mistakes
5
10
  * Feature: Allow execution of actions against global components on Asterisk
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
- require 'bundler'
3
- Bundler::GemHelper.install_tasks
2
+ require 'bundler/gem_tasks'
3
+ require 'bundler/setup'
4
4
 
5
5
  require 'rspec/core'
6
6
  require 'rspec/core/rake_task'
@@ -6,7 +6,9 @@ module Punchblock
6
6
  end
7
7
 
8
8
  def ready!
9
+ end
9
10
 
11
+ def not_ready!
10
12
  end
11
13
  end
12
14
  end
@@ -76,7 +76,7 @@ module Punchblock
76
76
  def connect
77
77
  begin
78
78
  EM.run { client.run }
79
- rescue Blather::SASLError, Blather::StreamError => e
79
+ rescue => e
80
80
  raise ProtocolError.new(e.class.to_s, e.message)
81
81
  end
82
82
  end
@@ -91,14 +91,23 @@ module Punchblock
91
91
  end
92
92
 
93
93
  def ready!
94
- status = Blather::Stanza::Presence::Status.new :chat
95
- status.to = @rayo_domain
96
- client.write status
94
+ send_presence :chat
95
+ super
96
+ end
97
+
98
+ def not_ready!
99
+ send_presence :dnd
97
100
  super
98
101
  end
99
102
 
100
103
  private
101
104
 
105
+ def send_presence(presence)
106
+ status = Blather::Stanza::Presence::Status.new presence
107
+ status.to = @rayo_domain
108
+ client.write status
109
+ end
110
+
102
111
  def handle_presence(p)
103
112
  throw :pass unless p.rayo_event?
104
113
  pb_logger.info "Receiving event for call ID #{p.call_id}"
@@ -1,3 +1,3 @@
1
1
  module Punchblock
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
data/punchblock.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.required_rubygems_version = Gem::Requirement.new(">= 1.3.7") if s.respond_to? :required_rubygems_version=
24
24
 
25
25
  s.add_runtime_dependency %q<niceogiri>, [">= 0.0.4"]
26
- s.add_runtime_dependency %q<blather>, [">= 0.5.7"]
26
+ s.add_runtime_dependency %q<blather>, [">= 0.5.9"]
27
27
  s.add_runtime_dependency %q<activesupport>, [">= 2.1.0"]
28
28
  s.add_runtime_dependency %q<state_machine>, [">= 1.0.1"]
29
29
  s.add_runtime_dependency %q<future-resource>, [">= 0.0.2"]
@@ -81,6 +81,26 @@ module Punchblock
81
81
  say.component_id.should == 'fgh4590'
82
82
  end
83
83
 
84
+ it 'should send a "Chat" presence when ready' do
85
+ client = connection.send :client
86
+ client.expects(:write).once.with do |stanza|
87
+ stanza.to.should == 'call.rayo.net' &&
88
+ stanza.is_a?(Blather::Stanza::Presence::Status) &&
89
+ stanza.chat?
90
+ end
91
+ connection.ready!
92
+ end
93
+
94
+ it 'should send a "Do Not Disturb" presence when not_ready' do
95
+ client = connection.send :client
96
+ client.expects(:write).once.with do |stanza|
97
+ stanza.to.should == 'call.rayo.net' &&
98
+ stanza.is_a?(Blather::Stanza::Presence::Status) &&
99
+ stanza.dnd?
100
+ end
101
+ connection.not_ready!
102
+ end
103
+
84
104
  describe '#handle_presence' do
85
105
  let :offer_xml do
86
106
  <<-MSG
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: punchblock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-11-22 00:00:00.000000000 Z
14
+ date: 2011-11-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: niceogiri
18
- requirement: &2152241520 !ruby/object:Gem::Requirement
18
+ requirement: &2169359040 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,21 +23,21 @@ dependencies:
23
23
  version: 0.0.4
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *2152241520
26
+ version_requirements: *2169359040
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: blather
29
- requirement: &2152240540 !ruby/object:Gem::Requirement
29
+ requirement: &2169357700 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
33
33
  - !ruby/object:Gem::Version
34
- version: 0.5.7
34
+ version: 0.5.9
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *2152240540
37
+ version_requirements: *2169357700
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: activesupport
40
- requirement: &2152237640 !ruby/object:Gem::Requirement
40
+ requirement: &2169356540 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: 2.1.0
46
46
  type: :runtime
47
47
  prerelease: false
48
- version_requirements: *2152237640
48
+ version_requirements: *2169356540
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: state_machine
51
- requirement: &2152235840 !ruby/object:Gem::Requirement
51
+ requirement: &2169355640 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: 1.0.1
57
57
  type: :runtime
58
58
  prerelease: false
59
- version_requirements: *2152235840
59
+ version_requirements: *2169355640
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: future-resource
62
- requirement: &2152460240 !ruby/object:Gem::Requirement
62
+ requirement: &2169355140 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ! '>='
@@ -67,10 +67,10 @@ dependencies:
67
67
  version: 0.0.2
68
68
  type: :runtime
69
69
  prerelease: false
70
- version_requirements: *2152460240
70
+ version_requirements: *2169355140
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: has-guarded-handlers
73
- requirement: &2152456100 !ruby/object:Gem::Requirement
73
+ requirement: &2169354420 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - ! '>='
@@ -78,10 +78,10 @@ dependencies:
78
78
  version: 0.1.0
79
79
  type: :runtime
80
80
  prerelease: false
81
- version_requirements: *2152456100
81
+ version_requirements: *2169354420
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: celluloid
84
- requirement: &2152468640 !ruby/object:Gem::Requirement
84
+ requirement: &2169353200 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ! '>='
@@ -89,10 +89,10 @@ dependencies:
89
89
  version: 0.6.0
90
90
  type: :runtime
91
91
  prerelease: false
92
- version_requirements: *2152468640
92
+ version_requirements: *2169353200
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: ruby_ami
95
- requirement: &2152466340 !ruby/object:Gem::Requirement
95
+ requirement: &2169352440 !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
98
98
  - - ! '>='
@@ -100,10 +100,10 @@ dependencies:
100
100
  version: 0.1.3
101
101
  type: :runtime
102
102
  prerelease: false
103
- version_requirements: *2152466340
103
+ version_requirements: *2169352440
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: bundler
106
- requirement: &2152477180 !ruby/object:Gem::Requirement
106
+ requirement: &2169368900 !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements:
109
109
  - - ~>
@@ -111,10 +111,10 @@ dependencies:
111
111
  version: 1.0.0
112
112
  type: :development
113
113
  prerelease: false
114
- version_requirements: *2152477180
114
+ version_requirements: *2169368900
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: rspec
117
- requirement: &2152471200 !ruby/object:Gem::Requirement
117
+ requirement: &2169367920 !ruby/object:Gem::Requirement
118
118
  none: false
119
119
  requirements:
120
120
  - - ! '>='
@@ -122,10 +122,10 @@ dependencies:
122
122
  version: 2.5.0
123
123
  type: :development
124
124
  prerelease: false
125
- version_requirements: *2152471200
125
+ version_requirements: *2169367920
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: ci_reporter
128
- requirement: &2152483240 !ruby/object:Gem::Requirement
128
+ requirement: &2169366660 !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
131
131
  - - ! '>='
@@ -133,10 +133,10 @@ dependencies:
133
133
  version: 1.6.3
134
134
  type: :development
135
135
  prerelease: false
136
- version_requirements: *2152483240
136
+ version_requirements: *2169366660
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: yard
139
- requirement: &2152495500 !ruby/object:Gem::Requirement
139
+ requirement: &2169365560 !ruby/object:Gem::Requirement
140
140
  none: false
141
141
  requirements:
142
142
  - - ~>
@@ -144,10 +144,10 @@ dependencies:
144
144
  version: 0.6.0
145
145
  type: :development
146
146
  prerelease: false
147
- version_requirements: *2152495500
147
+ version_requirements: *2169365560
148
148
  - !ruby/object:Gem::Dependency
149
149
  name: rcov
150
- requirement: &2152493260 !ruby/object:Gem::Requirement
150
+ requirement: &2169364020 !ruby/object:Gem::Requirement
151
151
  none: false
152
152
  requirements:
153
153
  - - ! '>='
@@ -155,10 +155,10 @@ dependencies:
155
155
  version: '0'
156
156
  type: :development
157
157
  prerelease: false
158
- version_requirements: *2152493260
158
+ version_requirements: *2169364020
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: rake
161
- requirement: &2152489000 !ruby/object:Gem::Requirement
161
+ requirement: &2169363080 !ruby/object:Gem::Requirement
162
162
  none: false
163
163
  requirements:
164
164
  - - ! '>='
@@ -166,10 +166,10 @@ dependencies:
166
166
  version: '0'
167
167
  type: :development
168
168
  prerelease: false
169
- version_requirements: *2152489000
169
+ version_requirements: *2169363080
170
170
  - !ruby/object:Gem::Dependency
171
171
  name: mocha
172
- requirement: &2152501500 !ruby/object:Gem::Requirement
172
+ requirement: &2169362260 !ruby/object:Gem::Requirement
173
173
  none: false
174
174
  requirements:
175
175
  - - ! '>='
@@ -177,10 +177,10 @@ dependencies:
177
177
  version: '0'
178
178
  type: :development
179
179
  prerelease: false
180
- version_requirements: *2152501500
180
+ version_requirements: *2169362260
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: i18n
183
- requirement: &2152499180 !ruby/object:Gem::Requirement
183
+ requirement: &2169377820 !ruby/object:Gem::Requirement
184
184
  none: false
185
185
  requirements:
186
186
  - - ! '>='
@@ -188,10 +188,10 @@ dependencies:
188
188
  version: '0'
189
189
  type: :development
190
190
  prerelease: false
191
- version_requirements: *2152499180
191
+ version_requirements: *2169377820
192
192
  - !ruby/object:Gem::Dependency
193
193
  name: countdownlatch
194
- requirement: &2152495980 !ruby/object:Gem::Requirement
194
+ requirement: &2169377080 !ruby/object:Gem::Requirement
195
195
  none: false
196
196
  requirements:
197
197
  - - ! '>='
@@ -199,10 +199,10 @@ dependencies:
199
199
  version: '0'
200
200
  type: :development
201
201
  prerelease: false
202
- version_requirements: *2152495980
202
+ version_requirements: *2169377080
203
203
  - !ruby/object:Gem::Dependency
204
204
  name: guard-rspec
205
- requirement: &2152510640 !ruby/object:Gem::Requirement
205
+ requirement: &2169375900 !ruby/object:Gem::Requirement
206
206
  none: false
207
207
  requirements:
208
208
  - - ! '>='
@@ -210,7 +210,7 @@ dependencies:
210
210
  version: '0'
211
211
  type: :development
212
212
  prerelease: false
213
- version_requirements: *2152510640
213
+ version_requirements: *2169375900
214
214
  description: Like Rack is to Rails and Sinatra, Punchblock provides a consistent API
215
215
  on top of several underlying third-party call control protocols.
216
216
  email: punchblock@adhearsion.com
@@ -356,6 +356,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
356
356
  - - ! '>='
357
357
  - !ruby/object:Gem::Version
358
358
  version: '0'
359
+ segments:
360
+ - 0
361
+ hash: 1064139490941906549
359
362
  required_rubygems_version: !ruby/object:Gem::Requirement
360
363
  none: false
361
364
  requirements:
@@ -412,4 +415,3 @@ test_files:
412
415
  - spec/punchblock/translator/asterisk/component_spec.rb
413
416
  - spec/punchblock/translator/asterisk_spec.rb
414
417
  - spec/spec_helper.rb
415
- has_rdoc: