-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest_fancyhands-ruby.rb
More file actions
61 lines (52 loc) · 1.64 KB
/
test_fancyhands-ruby.rb
File metadata and controls
61 lines (52 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
require 'fancyhands'
Fancy = FancyHands::V1::Client.new("YOUR API KEY", "YOUR API SECRET")
standard_request = Fancy.Standard.post("ruby test", "from ruby", 2.50)
puts "Created request, loading it again"
reloaded_standard_request = Fancy.Standard.get(standard_request["key"])
puts "Loaded " + reloaded_standard_request["title"] + " (" + reloaded_standard_request["uniq"] + ")"
puts Fancy.Echo.post({ :somedata => "here's yer data" })
# create a custom request
c = Fancy.Custom.post("From ruby", "some description", 1.0, nil, {})
# reload it
puts Fancy.Custom.get(c["key"])
# load all custom requests...
puts Fancy.Custom.get()
r = Fancy.Standard.post("A new standard request", "some description", 1.0, nil)
k = r["key"]
Fancy.Message.post(k, "A messgae on the new stnadard request")
puts Fancy.Standard.get(k)
conversation = {
:id => "sample_conversation",
:data => nil,
:name => "Sample Conversation",
:version => 1.1,
:scripts => [
{
:id => "start",
:steps => [
{
:name => "time",
:prompt => "What time is it?",
:note => "The recording will tell you a time. What time is it?",
:type => "text",
:options => []
},
{
:name => "transfer",
:type => "logic_control",
:note => "",
:prompt => "OK, transferring you now.",
:options => [
{
:name => "Trasnsfer",
:result => "-- Transfer Call --"
}
]
}
],
:transfer_number => "815-455-3440"
}
]
}
r = Fancy.Call.post("646-330-0181", conversation)
puts "Created call!"