call_center 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,26 @@
1
+ class LegacyCall
2
+ include CallCenter
3
+ include CommonCallMethods
4
+
5
+ state_machine :state, :initial => :initial do
6
+ event :incoming_call do
7
+ transition :initial => :voicemail, :unless => :agents_available?
8
+ transition :initial => :routing, :if => :agents_available?
9
+ end
10
+
11
+ after_transition any => :voicemail, :do => :voicemail
12
+ after_transition any => :routing, :do => :routing
13
+
14
+ event :customer_hangs_up do
15
+ transition :voicemail => :voicemail_completed
16
+ transition :routing => :cancelled
17
+ transition :cancelled => same
18
+ end
19
+
20
+ after_transition any => :voicemail_completed, :do => :voicemail_completed
21
+
22
+ event :something_crazy_happens do
23
+ transition :initial => :uh_oh # No after transition for this one
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,21 @@
1
+ class MultipleFlowCall
2
+ include CallCenter
3
+
4
+ call_flow :status, :initial => :ready do
5
+ state :ready do
6
+ event :go, :to => :done
7
+ on_render do |call, x|
8
+ x.Say "Hello World"
9
+ end
10
+ end
11
+ end
12
+
13
+ call_flow :outgoing_status, :initial => :outgoing_ready do
14
+ state :outgoing_ready do
15
+ event :outgoing_go, :to => :outgoing_done
16
+ on_render do |call, x|
17
+ x.Say "Hello Outgoing World"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,12 @@
1
+ class NonStandardCall
2
+ include CallCenter
3
+
4
+ call_flow :status, :initial => :ready do
5
+ state :ready do
6
+ event :go, :to => :done
7
+ on_render do |call, x|
8
+ x.Say "Hello World"
9
+ end
10
+ end
11
+ end
12
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,40 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+ require 'mocha'
13
+ require 'bourne'
14
+
15
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
16
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
17
+ require 'call_center'
18
+
19
+ require 'active_support'
20
+ require 'action_pack'
21
+ require 'action_controller'
22
+ class Test::Unit::TestCase
23
+ include ActionController::Assertions::SelectorAssertions
24
+
25
+ def response_from_page_or_rjs
26
+ HTML::Document.new(@body).root
27
+ end
28
+
29
+ def body(text, debug = false)
30
+ puts text if debug
31
+ @body = text
32
+ end
33
+ end
34
+
35
+ module CommonCallMethods
36
+ def agents_available?; end
37
+ def voicemail; end
38
+ def voicemail_completed; end
39
+ def routing; end
40
+ end
metadata ADDED
@@ -0,0 +1,278 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: call_center
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 2
10
+ version: 0.0.2
11
+ platform: ruby
12
+ authors:
13
+ - Henry Hsu
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-09-21 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: builder
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: hsume2-state_machine
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ hash: 29
44
+ segments:
45
+ - 1
46
+ - 0
47
+ - 5
48
+ version: 1.0.5
49
+ type: :runtime
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: shoulda
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ type: :development
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: bundler
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ~>
72
+ - !ruby/object:Gem::Version
73
+ hash: 23
74
+ segments:
75
+ - 1
76
+ - 0
77
+ - 0
78
+ version: 1.0.0
79
+ type: :development
80
+ version_requirements: *id004
81
+ - !ruby/object:Gem::Dependency
82
+ name: jeweler
83
+ prerelease: false
84
+ requirement: &id005 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ hash: 7
90
+ segments:
91
+ - 1
92
+ - 6
93
+ - 4
94
+ version: 1.6.4
95
+ type: :development
96
+ version_requirements: *id005
97
+ - !ruby/object:Gem::Dependency
98
+ name: rcov
99
+ prerelease: false
100
+ requirement: &id006 !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ hash: 3
106
+ segments:
107
+ - 0
108
+ version: "0"
109
+ type: :development
110
+ version_requirements: *id006
111
+ - !ruby/object:Gem::Dependency
112
+ name: test-unit
113
+ prerelease: false
114
+ requirement: &id007 !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ hash: 3
120
+ segments:
121
+ - 0
122
+ version: "0"
123
+ type: :development
124
+ version_requirements: *id007
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard
127
+ prerelease: false
128
+ requirement: &id008 !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ hash: 3
134
+ segments:
135
+ - 0
136
+ version: "0"
137
+ type: :development
138
+ version_requirements: *id008
139
+ - !ruby/object:Gem::Dependency
140
+ name: guard-test
141
+ prerelease: false
142
+ requirement: &id009 !ruby/object:Gem::Requirement
143
+ none: false
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ hash: 3
148
+ segments:
149
+ - 0
150
+ version: "0"
151
+ type: :development
152
+ version_requirements: *id009
153
+ - !ruby/object:Gem::Dependency
154
+ name: actionpack
155
+ prerelease: false
156
+ requirement: &id010 !ruby/object:Gem::Requirement
157
+ none: false
158
+ requirements:
159
+ - - ~>
160
+ - !ruby/object:Gem::Version
161
+ hash: 23
162
+ segments:
163
+ - 2
164
+ - 3
165
+ - 10
166
+ version: 2.3.10
167
+ type: :development
168
+ version_requirements: *id010
169
+ - !ruby/object:Gem::Dependency
170
+ name: mocha
171
+ prerelease: false
172
+ requirement: &id011 !ruby/object:Gem::Requirement
173
+ none: false
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ hash: 3
178
+ segments:
179
+ - 0
180
+ version: "0"
181
+ type: :development
182
+ version_requirements: *id011
183
+ - !ruby/object:Gem::Dependency
184
+ name: bourne
185
+ prerelease: false
186
+ requirement: &id012 !ruby/object:Gem::Requirement
187
+ none: false
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ hash: 3
192
+ segments:
193
+ - 0
194
+ version: "0"
195
+ type: :development
196
+ version_requirements: *id012
197
+ - !ruby/object:Gem::Dependency
198
+ name: pre-commit
199
+ prerelease: false
200
+ requirement: &id013 !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ hash: 3
206
+ segments:
207
+ - 0
208
+ version: "0"
209
+ type: :development
210
+ version_requirements: *id013
211
+ description: Support for describing call center workflows
212
+ email: hhsu@zendesk.com
213
+ executables: []
214
+
215
+ extensions: []
216
+
217
+ extra_rdoc_files:
218
+ - LICENSE.txt
219
+ - README.md
220
+ files:
221
+ - .document
222
+ - .rvmrc
223
+ - Gemfile
224
+ - Gemfile.lock
225
+ - Guardfile
226
+ - LICENSE.txt
227
+ - README.md
228
+ - Rakefile
229
+ - VERSION
230
+ - call_center.gemspec
231
+ - init.rb
232
+ - lib/call_center.rb
233
+ - lib/call_center/core_ext/object_instance_exec.rb
234
+ - lib/call_center/state_machine_ext.rb
235
+ - lib/call_center/test/dsl.rb
236
+ - test/call_center_test.rb
237
+ - test/core_ext_test.rb
238
+ - test/examples/call.rb
239
+ - test/examples/legacy_call.rb
240
+ - test/examples/multiple_flow_call.rb
241
+ - test/examples/non_standard_call.rb
242
+ - test/helper.rb
243
+ has_rdoc: true
244
+ homepage: http://github.com/zendesk/call_center
245
+ licenses:
246
+ - MIT
247
+ post_install_message:
248
+ rdoc_options: []
249
+
250
+ require_paths:
251
+ - lib
252
+ required_ruby_version: !ruby/object:Gem::Requirement
253
+ none: false
254
+ requirements:
255
+ - - ">="
256
+ - !ruby/object:Gem::Version
257
+ hash: 3
258
+ segments:
259
+ - 0
260
+ version: "0"
261
+ required_rubygems_version: !ruby/object:Gem::Requirement
262
+ none: false
263
+ requirements:
264
+ - - ">="
265
+ - !ruby/object:Gem::Version
266
+ hash: 3
267
+ segments:
268
+ - 0
269
+ version: "0"
270
+ requirements: []
271
+
272
+ rubyforge_project:
273
+ rubygems_version: 1.5.3
274
+ signing_key:
275
+ specification_version: 3
276
+ summary: Support for describing call center workflows
277
+ test_files: []
278
+