punchblock 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. data/.document +5 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +3 -0
  4. data/Gemfile +2 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.markdown +31 -0
  7. data/Rakefile +23 -0
  8. data/assets/ozone/ask-1.0.xsd +56 -0
  9. data/assets/ozone/conference-1.0.xsd +17 -0
  10. data/assets/ozone/ozone-1.0.xsd +127 -0
  11. data/assets/ozone/say-1.0.xsd +24 -0
  12. data/assets/ozone/transfer-1.0.xsd +32 -0
  13. data/bin/punchblock-console +125 -0
  14. data/lib/punchblock/command/accept.rb +30 -0
  15. data/lib/punchblock/command/answer.rb +30 -0
  16. data/lib/punchblock/command/dial.rb +88 -0
  17. data/lib/punchblock/command/hangup.rb +25 -0
  18. data/lib/punchblock/command/join.rb +81 -0
  19. data/lib/punchblock/command/mute.rb +7 -0
  20. data/lib/punchblock/command/redirect.rb +49 -0
  21. data/lib/punchblock/command/reject.rb +61 -0
  22. data/lib/punchblock/command/unjoin.rb +50 -0
  23. data/lib/punchblock/command/unmute.rb +7 -0
  24. data/lib/punchblock/command.rb +16 -0
  25. data/lib/punchblock/command_node.rb +46 -0
  26. data/lib/punchblock/component/input.rb +320 -0
  27. data/lib/punchblock/component/output.rb +449 -0
  28. data/lib/punchblock/component/record.rb +216 -0
  29. data/lib/punchblock/component/tropo/ask.rb +197 -0
  30. data/lib/punchblock/component/tropo/conference.rb +328 -0
  31. data/lib/punchblock/component/tropo/say.rb +113 -0
  32. data/lib/punchblock/component/tropo/transfer.rb +178 -0
  33. data/lib/punchblock/component/tropo.rb +12 -0
  34. data/lib/punchblock/component.rb +73 -0
  35. data/lib/punchblock/connection.rb +209 -0
  36. data/lib/punchblock/core_ext/blather/stanza/presence.rb +11 -0
  37. data/lib/punchblock/core_ext/blather/stanza.rb +26 -0
  38. data/lib/punchblock/dsl.rb +46 -0
  39. data/lib/punchblock/event/answered.rb +7 -0
  40. data/lib/punchblock/event/complete.rb +65 -0
  41. data/lib/punchblock/event/dtmf.rb +19 -0
  42. data/lib/punchblock/event/end.rb +15 -0
  43. data/lib/punchblock/event/info.rb +15 -0
  44. data/lib/punchblock/event/joined.rb +50 -0
  45. data/lib/punchblock/event/offer.rb +29 -0
  46. data/lib/punchblock/event/ringing.rb +7 -0
  47. data/lib/punchblock/event/unjoined.rb +50 -0
  48. data/lib/punchblock/event.rb +16 -0
  49. data/lib/punchblock/generic_connection.rb +18 -0
  50. data/lib/punchblock/has_headers.rb +34 -0
  51. data/lib/punchblock/header.rb +47 -0
  52. data/lib/punchblock/media_container.rb +39 -0
  53. data/lib/punchblock/media_node.rb +17 -0
  54. data/lib/punchblock/protocol_error.rb +16 -0
  55. data/lib/punchblock/rayo_node.rb +88 -0
  56. data/lib/punchblock/ref.rb +26 -0
  57. data/lib/punchblock/version.rb +3 -0
  58. data/lib/punchblock.rb +42 -0
  59. data/log/.gitkeep +0 -0
  60. data/punchblock.gemspec +42 -0
  61. data/spec/punchblock/command/accept_spec.rb +13 -0
  62. data/spec/punchblock/command/answer_spec.rb +13 -0
  63. data/spec/punchblock/command/dial_spec.rb +54 -0
  64. data/spec/punchblock/command/hangup_spec.rb +13 -0
  65. data/spec/punchblock/command/join_spec.rb +21 -0
  66. data/spec/punchblock/command/mute_spec.rb +11 -0
  67. data/spec/punchblock/command/redirect_spec.rb +19 -0
  68. data/spec/punchblock/command/reject_spec.rb +43 -0
  69. data/spec/punchblock/command/unjoin_spec.rb +19 -0
  70. data/spec/punchblock/command/unmute_spec.rb +11 -0
  71. data/spec/punchblock/command_node_spec.rb +80 -0
  72. data/spec/punchblock/component/input_spec.rb +188 -0
  73. data/spec/punchblock/component/output_spec.rb +531 -0
  74. data/spec/punchblock/component/record_spec.rb +235 -0
  75. data/spec/punchblock/component/tropo/ask_spec.rb +183 -0
  76. data/spec/punchblock/component/tropo/conference_spec.rb +360 -0
  77. data/spec/punchblock/component/tropo/say_spec.rb +171 -0
  78. data/spec/punchblock/component/tropo/transfer_spec.rb +153 -0
  79. data/spec/punchblock/component_spec.rb +126 -0
  80. data/spec/punchblock/connection_spec.rb +194 -0
  81. data/spec/punchblock/event/answered_spec.rb +23 -0
  82. data/spec/punchblock/event/complete_spec.rb +80 -0
  83. data/spec/punchblock/event/dtmf_spec.rb +24 -0
  84. data/spec/punchblock/event/end_spec.rb +30 -0
  85. data/spec/punchblock/event/info_spec.rb +30 -0
  86. data/spec/punchblock/event/joined_spec.rb +32 -0
  87. data/spec/punchblock/event/offer_spec.rb +35 -0
  88. data/spec/punchblock/event/ringing_spec.rb +23 -0
  89. data/spec/punchblock/event/unjoined_spec.rb +32 -0
  90. data/spec/punchblock/header_spec.rb +44 -0
  91. data/spec/punchblock/protocol_error_spec.rb +9 -0
  92. data/spec/punchblock/ref_spec.rb +21 -0
  93. data/spec/spec_helper.rb +43 -0
  94. metadata +353 -0
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ module Punchblock
4
+ describe Ref do
5
+ it 'registers itself' do
6
+ RayoNode.class_from_registration(:ref, 'urn:xmpp:rayo:1').should == Ref
7
+ end
8
+
9
+ describe "from a stanza" do
10
+ let(:stanza) { "<ref id='fgh4590' xmlns='urn:xmpp:rayo:1' />" }
11
+
12
+ subject { RayoNode.import parse_stanza(stanza).root, '9f00061', '1' }
13
+
14
+ it { should be_instance_of Ref }
15
+
16
+ it_should_behave_like 'event'
17
+
18
+ its(:id) { should == 'fgh4590' }
19
+ end
20
+ end
21
+ end # Punchblock
@@ -0,0 +1,43 @@
1
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
2
+ $LOAD_PATH.unshift File.dirname(__FILE__)
3
+ require 'punchblock'
4
+ require 'mocha'
5
+ require 'countdownlatch'
6
+
7
+ Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
8
+
9
+ RSpec.configure do |config|
10
+ config.mock_with :mocha
11
+ config.filter_run :focus => true
12
+ config.run_all_when_everything_filtered = true
13
+ end
14
+
15
+ def parse_stanza(xml)
16
+ Nokogiri::XML.parse xml, nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS
17
+ end
18
+
19
+ def import_stanza(xml)
20
+ Blather::Stanza.import parse_stanza(xml).root
21
+ end
22
+
23
+ shared_examples_for 'event' do
24
+ its(:call_id) { should == '9f00061' }
25
+ its(:component_id) { should == '1' }
26
+ end
27
+
28
+ shared_examples_for 'command_headers' do
29
+ it 'takes a hash of keys and values for headers' do
30
+ headers = { :x_skill => 'agent', :x_customer_id => '8877' }
31
+
32
+ control = [ Punchblock::Header.new(:x_skill, 'agent'), Punchblock::Header.new(:x_customer_id, '8877')]
33
+
34
+ di = subject.class.new :headers => headers
35
+ di.headers.should have(2).items
36
+ di.headers.each { |i| control.include?(i).should be_true }
37
+ end
38
+ end
39
+
40
+ shared_examples_for 'event_headers' do
41
+ its(:headers) { should == [Punchblock::Header.new(:x_skill, 'agent'), Punchblock::Header.new(:x_customer_id, '8877')]}
42
+ its(:headers_hash) { should == {:x_skill => 'agent', :x_customer_id => '8877'} }
43
+ end
metadata ADDED
@@ -0,0 +1,353 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: punchblock
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jason Goecke
9
+ - Ben Klang
10
+ - Ben Langfeld
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2011-09-15 00:00:00.000000000 +01:00
15
+ default_executable:
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: niceogiri
19
+ requirement: &2168880140 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ! '>='
23
+ - !ruby/object:Gem::Version
24
+ version: 0.0.4
25
+ type: :runtime
26
+ prerelease: false
27
+ version_requirements: *2168880140
28
+ - !ruby/object:Gem::Dependency
29
+ name: blather
30
+ requirement: &2168879620 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: 0.5.3
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: *2168879620
39
+ - !ruby/object:Gem::Dependency
40
+ name: pry
41
+ requirement: &2168879080 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: 0.8.3
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: *2168879080
50
+ - !ruby/object:Gem::Dependency
51
+ name: activesupport
52
+ requirement: &2168878540 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: 2.1.0
58
+ type: :runtime
59
+ prerelease: false
60
+ version_requirements: *2168878540
61
+ - !ruby/object:Gem::Dependency
62
+ name: state_machine
63
+ requirement: &2168872980 !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: 1.0.1
69
+ type: :runtime
70
+ prerelease: false
71
+ version_requirements: *2168872980
72
+ - !ruby/object:Gem::Dependency
73
+ name: future-resource
74
+ requirement: &2168872440 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: 0.0.2
80
+ type: :runtime
81
+ prerelease: false
82
+ version_requirements: *2168872440
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: &2168871920 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ~>
89
+ - !ruby/object:Gem::Version
90
+ version: 1.0.0
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: *2168871920
94
+ - !ruby/object:Gem::Dependency
95
+ name: rspec
96
+ requirement: &2168871320 !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: 2.3.0
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: *2168871320
105
+ - !ruby/object:Gem::Dependency
106
+ name: ci_reporter
107
+ requirement: &2168870720 !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: 1.6.3
113
+ type: :development
114
+ prerelease: false
115
+ version_requirements: *2168870720
116
+ - !ruby/object:Gem::Dependency
117
+ name: yard
118
+ requirement: &2168870120 !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ~>
122
+ - !ruby/object:Gem::Version
123
+ version: 0.6.0
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: *2168870120
127
+ - !ruby/object:Gem::Dependency
128
+ name: bluecloth
129
+ requirement: &2168869520 !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ type: :development
136
+ prerelease: false
137
+ version_requirements: *2168869520
138
+ - !ruby/object:Gem::Dependency
139
+ name: rcov
140
+ requirement: &2168868920 !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: *2168868920
149
+ - !ruby/object:Gem::Dependency
150
+ name: rake
151
+ requirement: &2168868320 !ruby/object:Gem::Requirement
152
+ none: false
153
+ requirements:
154
+ - - ! '>='
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ type: :development
158
+ prerelease: false
159
+ version_requirements: *2168868320
160
+ - !ruby/object:Gem::Dependency
161
+ name: mocha
162
+ requirement: &2168867720 !ruby/object:Gem::Requirement
163
+ none: false
164
+ requirements:
165
+ - - ! '>='
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ type: :development
169
+ prerelease: false
170
+ version_requirements: *2168867720
171
+ - !ruby/object:Gem::Dependency
172
+ name: i18n
173
+ requirement: &2168867240 !ruby/object:Gem::Requirement
174
+ none: false
175
+ requirements:
176
+ - - ! '>='
177
+ - !ruby/object:Gem::Version
178
+ version: '0'
179
+ type: :development
180
+ prerelease: false
181
+ version_requirements: *2168867240
182
+ - !ruby/object:Gem::Dependency
183
+ name: countdownlatch
184
+ requirement: &2168866660 !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ type: :development
191
+ prerelease: false
192
+ version_requirements: *2168866660
193
+ description: Like Rack is to Rails and Sinatra, Punchblock provides a consistent API
194
+ on top of several underlying third-party call control protocols.
195
+ email: punchblock@adhearsion.com
196
+ executables:
197
+ - punchblock-console
198
+ extensions: []
199
+ extra_rdoc_files: []
200
+ files:
201
+ - .document
202
+ - .gitignore
203
+ - .rspec
204
+ - Gemfile
205
+ - LICENSE.txt
206
+ - README.markdown
207
+ - Rakefile
208
+ - assets/ozone/ask-1.0.xsd
209
+ - assets/ozone/conference-1.0.xsd
210
+ - assets/ozone/ozone-1.0.xsd
211
+ - assets/ozone/say-1.0.xsd
212
+ - assets/ozone/transfer-1.0.xsd
213
+ - bin/punchblock-console
214
+ - lib/punchblock.rb
215
+ - lib/punchblock/command.rb
216
+ - lib/punchblock/command/accept.rb
217
+ - lib/punchblock/command/answer.rb
218
+ - lib/punchblock/command/dial.rb
219
+ - lib/punchblock/command/hangup.rb
220
+ - lib/punchblock/command/join.rb
221
+ - lib/punchblock/command/mute.rb
222
+ - lib/punchblock/command/redirect.rb
223
+ - lib/punchblock/command/reject.rb
224
+ - lib/punchblock/command/unjoin.rb
225
+ - lib/punchblock/command/unmute.rb
226
+ - lib/punchblock/command_node.rb
227
+ - lib/punchblock/component.rb
228
+ - lib/punchblock/component/input.rb
229
+ - lib/punchblock/component/output.rb
230
+ - lib/punchblock/component/record.rb
231
+ - lib/punchblock/component/tropo.rb
232
+ - lib/punchblock/component/tropo/ask.rb
233
+ - lib/punchblock/component/tropo/conference.rb
234
+ - lib/punchblock/component/tropo/say.rb
235
+ - lib/punchblock/component/tropo/transfer.rb
236
+ - lib/punchblock/connection.rb
237
+ - lib/punchblock/core_ext/blather/stanza.rb
238
+ - lib/punchblock/core_ext/blather/stanza/presence.rb
239
+ - lib/punchblock/dsl.rb
240
+ - lib/punchblock/event.rb
241
+ - lib/punchblock/event/answered.rb
242
+ - lib/punchblock/event/complete.rb
243
+ - lib/punchblock/event/dtmf.rb
244
+ - lib/punchblock/event/end.rb
245
+ - lib/punchblock/event/info.rb
246
+ - lib/punchblock/event/joined.rb
247
+ - lib/punchblock/event/offer.rb
248
+ - lib/punchblock/event/ringing.rb
249
+ - lib/punchblock/event/unjoined.rb
250
+ - lib/punchblock/generic_connection.rb
251
+ - lib/punchblock/has_headers.rb
252
+ - lib/punchblock/header.rb
253
+ - lib/punchblock/media_container.rb
254
+ - lib/punchblock/media_node.rb
255
+ - lib/punchblock/protocol_error.rb
256
+ - lib/punchblock/rayo_node.rb
257
+ - lib/punchblock/ref.rb
258
+ - lib/punchblock/version.rb
259
+ - log/.gitkeep
260
+ - punchblock.gemspec
261
+ - spec/punchblock/command/accept_spec.rb
262
+ - spec/punchblock/command/answer_spec.rb
263
+ - spec/punchblock/command/dial_spec.rb
264
+ - spec/punchblock/command/hangup_spec.rb
265
+ - spec/punchblock/command/join_spec.rb
266
+ - spec/punchblock/command/mute_spec.rb
267
+ - spec/punchblock/command/redirect_spec.rb
268
+ - spec/punchblock/command/reject_spec.rb
269
+ - spec/punchblock/command/unjoin_spec.rb
270
+ - spec/punchblock/command/unmute_spec.rb
271
+ - spec/punchblock/command_node_spec.rb
272
+ - spec/punchblock/component/input_spec.rb
273
+ - spec/punchblock/component/output_spec.rb
274
+ - spec/punchblock/component/record_spec.rb
275
+ - spec/punchblock/component/tropo/ask_spec.rb
276
+ - spec/punchblock/component/tropo/conference_spec.rb
277
+ - spec/punchblock/component/tropo/say_spec.rb
278
+ - spec/punchblock/component/tropo/transfer_spec.rb
279
+ - spec/punchblock/component_spec.rb
280
+ - spec/punchblock/connection_spec.rb
281
+ - spec/punchblock/event/answered_spec.rb
282
+ - spec/punchblock/event/complete_spec.rb
283
+ - spec/punchblock/event/dtmf_spec.rb
284
+ - spec/punchblock/event/end_spec.rb
285
+ - spec/punchblock/event/info_spec.rb
286
+ - spec/punchblock/event/joined_spec.rb
287
+ - spec/punchblock/event/offer_spec.rb
288
+ - spec/punchblock/event/ringing_spec.rb
289
+ - spec/punchblock/event/unjoined_spec.rb
290
+ - spec/punchblock/header_spec.rb
291
+ - spec/punchblock/protocol_error_spec.rb
292
+ - spec/punchblock/ref_spec.rb
293
+ - spec/spec_helper.rb
294
+ has_rdoc: true
295
+ homepage: http://github.com/adhearsion/punchblock
296
+ licenses:
297
+ - MIT
298
+ post_install_message:
299
+ rdoc_options: []
300
+ require_paths:
301
+ - lib
302
+ required_ruby_version: !ruby/object:Gem::Requirement
303
+ none: false
304
+ requirements:
305
+ - - ! '>='
306
+ - !ruby/object:Gem::Version
307
+ version: '0'
308
+ required_rubygems_version: !ruby/object:Gem::Requirement
309
+ none: false
310
+ requirements:
311
+ - - ! '>='
312
+ - !ruby/object:Gem::Version
313
+ version: 1.3.7
314
+ requirements: []
315
+ rubyforge_project: punchblock
316
+ rubygems_version: 1.6.2
317
+ signing_key:
318
+ specification_version: 3
319
+ summary: Punchblock is a telephony middleware library
320
+ test_files:
321
+ - spec/punchblock/command/accept_spec.rb
322
+ - spec/punchblock/command/answer_spec.rb
323
+ - spec/punchblock/command/dial_spec.rb
324
+ - spec/punchblock/command/hangup_spec.rb
325
+ - spec/punchblock/command/join_spec.rb
326
+ - spec/punchblock/command/mute_spec.rb
327
+ - spec/punchblock/command/redirect_spec.rb
328
+ - spec/punchblock/command/reject_spec.rb
329
+ - spec/punchblock/command/unjoin_spec.rb
330
+ - spec/punchblock/command/unmute_spec.rb
331
+ - spec/punchblock/command_node_spec.rb
332
+ - spec/punchblock/component/input_spec.rb
333
+ - spec/punchblock/component/output_spec.rb
334
+ - spec/punchblock/component/record_spec.rb
335
+ - spec/punchblock/component/tropo/ask_spec.rb
336
+ - spec/punchblock/component/tropo/conference_spec.rb
337
+ - spec/punchblock/component/tropo/say_spec.rb
338
+ - spec/punchblock/component/tropo/transfer_spec.rb
339
+ - spec/punchblock/component_spec.rb
340
+ - spec/punchblock/connection_spec.rb
341
+ - spec/punchblock/event/answered_spec.rb
342
+ - spec/punchblock/event/complete_spec.rb
343
+ - spec/punchblock/event/dtmf_spec.rb
344
+ - spec/punchblock/event/end_spec.rb
345
+ - spec/punchblock/event/info_spec.rb
346
+ - spec/punchblock/event/joined_spec.rb
347
+ - spec/punchblock/event/offer_spec.rb
348
+ - spec/punchblock/event/ringing_spec.rb
349
+ - spec/punchblock/event/unjoined_spec.rb
350
+ - spec/punchblock/header_spec.rb
351
+ - spec/punchblock/protocol_error_spec.rb
352
+ - spec/punchblock/ref_spec.rb
353
+ - spec/spec_helper.rb