call_center 1.0.1 → 1.0.3
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.
- data/lib/call_center.rb +1 -0
- data/lib/call_center/test/dsl.rb +11 -2
- data/lib/call_center/test/minitest/dsl.rb +9 -2
- metadata +45 -256
- data/.document +0 -5
- data/.rvmrc +0 -1
- data/.travis.yml +0 -5
- data/Gemfile +0 -19
- data/Gemfile.lock +0 -71
- data/Guardfile +0 -5
- data/Guardfile.minitest +0 -9
- data/LICENSE +0 -176
- data/README.md +0 -212
- data/Rakefile +0 -48
- data/VERSION +0 -1
- data/call_center.gemspec +0 -110
- data/init.rb +0 -1
- data/minitest/call_center/test/minitest_test.rb +0 -42
- data/minitest/helper.rb +0 -20
- data/minitest/run.rb +0 -15
- data/test/call_center_test.rb +0 -492
- data/test/core_ext_test.rb +0 -17
- data/test/examples/call.rb +0 -65
- data/test/examples/dynamic_transition_call.rb +0 -43
- data/test/examples/legacy_call.rb +0 -26
- data/test/examples/multiple_flow_call.rb +0 -21
- data/test/examples/non_standard_call.rb +0 -12
- data/test/helper.rb +0 -30
data/test/core_ext_test.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require File.expand_path("../helper", __FILE__)
|
2
|
-
|
3
|
-
class MyObject
|
4
|
-
end
|
5
|
-
|
6
|
-
class CoreExtTest < Test::Unit::TestCase
|
7
|
-
should "use existing" do
|
8
|
-
obj = MyObject.new
|
9
|
-
$capture = nil
|
10
|
-
block = lambda { |a|
|
11
|
-
$capture = [self, a]
|
12
|
-
}
|
13
|
-
obj.instance_exec(true, &block)
|
14
|
-
|
15
|
-
assert_equal [obj, true], $capture
|
16
|
-
end
|
17
|
-
end
|
data/test/examples/call.rb
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
class Call
|
2
|
-
include CallCenter
|
3
|
-
include CommonCallMethods
|
4
|
-
|
5
|
-
call_flow :state, :initial => :initial do
|
6
|
-
actor :customer do |call, event|
|
7
|
-
"/voice/calls/flow?event=#{event}&actor=customer"
|
8
|
-
end
|
9
|
-
actor :agent do |call, event|
|
10
|
-
"/voice/calls/flow?event=#{event}&actor=agent"
|
11
|
-
end
|
12
|
-
|
13
|
-
state :initial do
|
14
|
-
response do |x, call| # To allow defining render blocks within a state
|
15
|
-
call.notify(:rendering_initial)
|
16
|
-
x.Say "Hello World"
|
17
|
-
end
|
18
|
-
|
19
|
-
event :incoming_call, :to => :voicemail, :unless => :agents_available?
|
20
|
-
event :incoming_call, :to => :routing, :if => :agents_available?
|
21
|
-
event :something_crazy_happens, :to => :uh_oh
|
22
|
-
end
|
23
|
-
|
24
|
-
state :voicemail do
|
25
|
-
response do |x| # To allow defining render blocks outside a state
|
26
|
-
notify(:rendering_voicemail)
|
27
|
-
x.Say "Hello World"
|
28
|
-
x.Record :action => customer(:voicemail_complete)
|
29
|
-
end
|
30
|
-
|
31
|
-
customer :hangs_up, :to => :voicemail_completed
|
32
|
-
end
|
33
|
-
|
34
|
-
state :routing do
|
35
|
-
customer :hangs_up, :to => :cancelled
|
36
|
-
event :start_conference, :to => :in_conference
|
37
|
-
end
|
38
|
-
|
39
|
-
state :cancelled do
|
40
|
-
after(:success, :uniq => true) { notify(:cancelled) }
|
41
|
-
|
42
|
-
customer :hangs_up, :to => same
|
43
|
-
customer :end, :to => :ended
|
44
|
-
end
|
45
|
-
|
46
|
-
response(:cancelled) do |x, call|
|
47
|
-
# Just for sake of comparison
|
48
|
-
end
|
49
|
-
|
50
|
-
state :ended do
|
51
|
-
after(:always) { notify(:after_always) }
|
52
|
-
after(:success) { notify(:after_success) }
|
53
|
-
after(:failure) { notify(:after_failure) }
|
54
|
-
|
55
|
-
after(:always, :uniq => true) { notify(:after_always_uniq) }
|
56
|
-
after(:success, :uniq => true) { |transition| notify(:after_success_uniq, transition) }
|
57
|
-
after(:failure, :uniq => true) { notify(:after_failure_uniq) }
|
58
|
-
|
59
|
-
before(:always) { notify(:before_always) }
|
60
|
-
before(:always, :uniq => true) { notify(:before_always_uniq) }
|
61
|
-
|
62
|
-
customer :end, :to => same
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
class DynamicTransitionCall
|
2
|
-
include CallCenter
|
3
|
-
include CommonCallMethods
|
4
|
-
|
5
|
-
call_flow :state, :initial => :initial do
|
6
|
-
state :initial do
|
7
|
-
response do |x|
|
8
|
-
x.Say "Hello World"
|
9
|
-
end
|
10
|
-
|
11
|
-
flow_if :agents_available? do
|
12
|
-
flow_if :via_phone? do
|
13
|
-
event :incoming_call, :to => :routing_on_phone
|
14
|
-
end
|
15
|
-
|
16
|
-
flow_unless :via_phone? do
|
17
|
-
event :incoming_call, :to => :routing_on_mobile_client, :if => :on_mobile?
|
18
|
-
event :incoming_call, :to => :routing_on_webrtc, :unless => :prefer_flash?
|
19
|
-
event :incoming_call, :to => :routing_on_client
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
flow_unless :agents_available? do
|
24
|
-
flow_unless :voicemail_full? do
|
25
|
-
event :incoming_call, :to => :voicemail
|
26
|
-
end
|
27
|
-
|
28
|
-
flow_if :voicemail_full? do
|
29
|
-
event :incoming_call, :to => :cancelled
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
state :routing_on_client do
|
35
|
-
flow_if :out_of_area? do
|
36
|
-
event :picks_up, :to => :cancelled
|
37
|
-
end
|
38
|
-
flow_unless :out_of_area? do
|
39
|
-
event :picks_up, :to => :in_conference
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,26 +0,0 @@
|
|
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
|
@@ -1,21 +0,0 @@
|
|
1
|
-
class MultipleFlowCall
|
2
|
-
include CallCenter
|
3
|
-
|
4
|
-
call_flow :status, :initial => :ready do
|
5
|
-
state :ready do
|
6
|
-
event :go, :to => :done
|
7
|
-
response do |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
|
-
response do |x|
|
17
|
-
x.Say "Hello Outgoing World"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/test/helper.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'bundler/setup'
|
2
|
-
require 'test/unit'
|
3
|
-
require 'shoulda'
|
4
|
-
require 'mocha'
|
5
|
-
require 'bourne'
|
6
|
-
|
7
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
8
|
-
require 'call_center'
|
9
|
-
|
10
|
-
require 'active_support'
|
11
|
-
require 'action_pack'
|
12
|
-
require 'action_controller'
|
13
|
-
|
14
|
-
class Test::Unit::TestCase
|
15
|
-
def response_from_page_or_rjs
|
16
|
-
HTML::Document.new(@body).root
|
17
|
-
end
|
18
|
-
|
19
|
-
def body(text, debug = false)
|
20
|
-
puts text if debug
|
21
|
-
@body = text
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
module CommonCallMethods
|
26
|
-
def agents_available?; end
|
27
|
-
def voicemail; end
|
28
|
-
def voicemail_completed; end
|
29
|
-
def routing; end
|
30
|
-
end
|