CiscoWebex 0.0.4
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.
- checksums.yaml +7 -0
- data/lib/Admin/Admin.rb +84 -0
- data/lib/Admin/AuditEvents.rb +70 -0
- data/lib/Admin/Authorizations.rb +52 -0
- data/lib/Admin/Licenses.rb +50 -0
- data/lib/Admin/Organizations.rb +52 -0
- data/lib/Admin/People.rb +81 -0
- data/lib/Admin/ResourceGroups.rb +118 -0
- data/lib/Admin/Roles.rb +60 -0
- data/lib/Admin.rb +11 -0
- data/lib/CC/AddressBooks.rb +55 -0
- data/lib/CC/AgentProfiles.rb +71 -0
- data/lib/CC/Agents.rb +67 -0
- data/lib/CC/AuxiliaryCodes.rb +55 -0
- data/lib/CC/CC.rb +157 -0
- data/lib/CC/Captures.rb +30 -0
- data/lib/CC/DialPlans.rb +56 -0
- data/lib/CC/EntryPointMappings.rb +56 -0
- data/lib/CC/EntryPoints.rb +55 -0
- data/lib/CC/Journey/Actions.rb +41 -0
- data/lib/CC/Journey/Aliases.rb +28 -0
- data/lib/CC/Journey/Events.rb +37 -0
- data/lib/CC/Journey/Identities.rb +41 -0
- data/lib/CC/Journey/Journey.rb +84 -0
- data/lib/CC/Journey/ProfileViews.rb +24 -0
- data/lib/CC/Journey/Report.rb +24 -0
- data/lib/CC/Journey/Reports.rb +24 -0
- data/lib/CC/Journey/Streams.rb +41 -0
- data/lib/CC/Journey/Views.rb +80 -0
- data/lib/CC/Journey.rb +9 -0
- data/lib/CC/MultimediaProfiles.rb +52 -0
- data/lib/CC/OutboundANI.rb +56 -0
- data/lib/CC/Queues.rb +64 -0
- data/lib/CC/Sites.rb +51 -0
- data/lib/CC/SkillProfiles.rb +55 -0
- data/lib/CC/Skills.rb +55 -0
- data/lib/CC/Subscriptions.rb +55 -0
- data/lib/CC/Tasks.rb +37 -0
- data/lib/CC/Teams.rb +55 -0
- data/lib/CC/UserProfiles.rb +56 -0
- data/lib/CC/Users.rb +57 -0
- data/lib/CC.rb +26 -0
- data/lib/Calling/CallControl.rb +210 -0
- data/lib/Calling/Calling.rb +64 -0
- data/lib/Calling/Calls.rb +44 -0
- data/lib/Calling/Locations.rb +50 -0
- data/lib/Calling/Voicemail.rb +73 -0
- data/lib/Calling.rb +9 -0
- data/lib/CiscoWebex.rb +32 -0
- data/lib/Devices/Configurations.rb +52 -0
- data/lib/Devices/Devices.rb +66 -0
- data/lib/Devices/Endpoints.rb +51 -0
- data/lib/Devices/Workspaces.rb +51 -0
- data/lib/Devices/Xapi.rb +75 -0
- data/lib/Devices.rb +7 -0
- data/lib/Meetings/ControlStatus.rb +53 -0
- data/lib/Meetings/Invitees.rb +52 -0
- data/lib/Meetings/Meetings.rb +91 -0
- data/lib/Meetings/Participants.rb +52 -0
- data/lib/Meetings/Qualities.rb +55 -0
- data/lib/Meetings/Registrations.rb +116 -0
- data/lib/Meetings/SessionTypes.rb +57 -0
- data/lib/Meetings/Templates.rb +57 -0
- data/lib/Meetings/Transcripts.rb +98 -0
- data/lib/Meetings/WebexMeetings.rb +108 -0
- data/lib/Meetings.rb +13 -0
- data/lib/Messaging/Attachements.rb +60 -0
- data/lib/Messaging/Classifications.rb +64 -0
- data/lib/Messaging/Events.rb +60 -0
- data/lib/Messaging/Memberships.rb +59 -0
- data/lib/Messaging/Messages.rb +126 -0
- data/lib/Messaging/Messaging.rb +92 -0
- data/lib/Messaging/People.rb +81 -0
- data/lib/Messaging/Rooms.rb +121 -0
- data/lib/Messaging/Teams.rb +117 -0
- data/lib/Messaging/Webhooks.rb +63 -0
- data/lib/Messaging.rb +13 -0
- data/lib/REST/Rest.rb +213 -0
- data/lib/REST/RestCC.rb +242 -0
- data/lib/Toolbox/Toolbox.rb +78 -0
- data/lib/bersion.rb +3 -0
- metadata +122 -0
data/lib/CC/Tasks.rb
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module CiscoWebex
|
|
2
|
+
class Tasks < ContactCenter
|
|
3
|
+
@auth_token = nil
|
|
4
|
+
@org_id = nil
|
|
5
|
+
|
|
6
|
+
# initialize object with stored token
|
|
7
|
+
def initialize(token=nil, org_id=nil)
|
|
8
|
+
if token == nil || org_id == nil
|
|
9
|
+
STDERR.puts "Must provide API key for CiscoWebex::ContactCenter::Task"
|
|
10
|
+
return false
|
|
11
|
+
else
|
|
12
|
+
@auth_token = token if token
|
|
13
|
+
@org_id = org_id
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def this()
|
|
18
|
+
puts "CiscoWebex::ContactCenter::Task - Org:#{@org_id}"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def list(params={}, limit=5000)
|
|
22
|
+
params['from'] = CiscoWebex::Toolbox:WebexTime.shift("now", -86400, "CC") if ! params.has_key?('from')
|
|
23
|
+
return CiscoWebex::RestCC.get(@auth_token, "/v1/tasks", {}, limit)['data'] rescue false
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def search(params={})
|
|
27
|
+
params = { "id"=> params } if params.class == String
|
|
28
|
+
return CiscoWebex::Toolbox.search(list(), params)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def get(id=nil)
|
|
32
|
+
params = { "id"=> id } if id
|
|
33
|
+
return CiscoWebex::Toolbox.search(search(), params)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
data/lib/CC/Teams.rb
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module CiscoWebex
|
|
2
|
+
class CCTeams < ContactCenter
|
|
3
|
+
@auth_token = nil
|
|
4
|
+
@org_id = nil
|
|
5
|
+
|
|
6
|
+
# initialize object with stored token
|
|
7
|
+
def initialize(token=nil, org_id=nil)
|
|
8
|
+
if token == nil || org_id == nil
|
|
9
|
+
STDERR.puts "Must provide API key for CiscoWebex::ContactCenter::Team"
|
|
10
|
+
return false
|
|
11
|
+
else
|
|
12
|
+
@auth_token = token if token
|
|
13
|
+
@org_id = org_id # test token and store users profile
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def this()
|
|
18
|
+
puts "CiscoWebex::ContactCenter::Team - Org:#{@org_id}"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def get(id, limit=5000)
|
|
22
|
+
return CiscoWebex::RestCC.get(@auth_token, "/organization/#{@org_id}/team/#{id}", {}, limit)['data'] rescue false
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def list(params={}, limit=5000)
|
|
26
|
+
return CiscoWebex::RestCC.get(@auth_token, "/organization/#{@org_id}/team", {}, limit)['data'] rescue false
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def search(params={})
|
|
30
|
+
params = { "name"=> params } if params.class == String
|
|
31
|
+
return CiscoWebex::Toolbox.search(list(), params)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def save(params={})
|
|
35
|
+
return CiscoWebex::RestCC.post(@auth_token, "/organization/#{@org_id}/team/bulk", params) rescue false
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def create(params)
|
|
39
|
+
return CiscoWebex::RestCC.post(@auth_token, "/organization/#{@org_id}/team", params) rescue false
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def delete(id)
|
|
43
|
+
return CiscoWebex::RestCC.delete(@auth_token, "/organization/#{@org_id}/team/#{id}") rescue false
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def update(id, params)
|
|
47
|
+
return CiscoWebex::RestCC.put(@auth_token, "/organization/#{@org_id}/team/#{id}", params) rescue false
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def patch(id, params)
|
|
51
|
+
return CiscoWebex::RestCC.patch(@auth_token, "/organization/#{@org_id}/team/#{id}", params) rescue false
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
module CiscoWebex
|
|
2
|
+
class UserProfiles < ContactCenter
|
|
3
|
+
@auth_token = nil
|
|
4
|
+
@org_id = nil
|
|
5
|
+
|
|
6
|
+
# initialize object with stored token
|
|
7
|
+
def initialize(token=nil, org_id=nil)
|
|
8
|
+
if token == nil || org_id == nil
|
|
9
|
+
STDERR.puts "Must provide API key for CiscoWebex::ContactCenter::User"
|
|
10
|
+
return false
|
|
11
|
+
else
|
|
12
|
+
@auth_token = token if token
|
|
13
|
+
@org_id = org_id # test token and store users profile
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def this()
|
|
19
|
+
puts "CiscoWebex::ContactCenter::UserProfile - Org:#{@org_id}"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def get(id, limit=5000)
|
|
23
|
+
return CiscoWebex::RestCC.get(@auth_token, "/organization/#{@org_id}/user-profile/#{id}", {}, limit)['data'] rescue false
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def list(params={}, limit=5000)
|
|
27
|
+
return CiscoWebex::RestCC.get(@auth_token, "/organization/#{@org_id}/user-profile", {}, limit)['data'] rescue false
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def search(params={})
|
|
31
|
+
params = { "name"=> params } if params.class == String
|
|
32
|
+
return CiscoWebex::Toolbox.search(list(), params)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def save(params={})
|
|
36
|
+
return CiscoWebex::RestCC.post(@auth_token, "/organization/#{@org_id}/user-profile/bulk", params) rescue false
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def create(params)
|
|
40
|
+
return CiscoWebex::RestCC.post(@auth_token, "/organization/#{@org_id}/user-profile", params) rescue false
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def delete(id)
|
|
44
|
+
return CiscoWebex::RestCC.delete(@auth_token, "/organization/#{@org_id}/user-profile/#{id}") rescue false
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def update(id, params)
|
|
48
|
+
return CiscoWebex::RestCC.put(@auth_token, "/organization/#{@org_id}/user-profile/#{id}", params) rescue false
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def patch(id, params)
|
|
52
|
+
return CiscoWebex::RestCC.patch(@auth_token, "/organization/#{@org_id}/user-profile/#{id}", params) rescue false
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
data/lib/CC/Users.rb
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
module CiscoWebex
|
|
2
|
+
class Users < ContactCenter
|
|
3
|
+
@auth_token = nil
|
|
4
|
+
@org_id = nil
|
|
5
|
+
|
|
6
|
+
# initialize object with stored token
|
|
7
|
+
def initialize(token=nil, org_id=nil)
|
|
8
|
+
if token == nil || org_id == nil
|
|
9
|
+
STDERR.puts "Must provide API key for CiscoWebex::ContactCenter::User"
|
|
10
|
+
return false
|
|
11
|
+
else
|
|
12
|
+
@auth_token = token if token
|
|
13
|
+
@org_id = org_id # test token and store users profile
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def this()
|
|
18
|
+
puts "CiscoWebex::ContactCenter::User - Org:#{@org_id}"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def get(id, limit=5000)
|
|
22
|
+
return CiscoWebex::RestCC.get(@auth_token, "/organization/#{@org_id}/user/#{id}", {}, limit)['data'] rescue false
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def list(params={}, limit=5000)
|
|
26
|
+
return CiscoWebex::RestCC.get(@auth_token, "/organization/#{@org_id}/user", {}, limit)['data'] rescue false
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def search(params={})
|
|
30
|
+
params = { "email"=> params } if params.class == String && params.include('@')
|
|
31
|
+
params = { "firstName"=> params.split(" ")[0], "lastName"=> params.split(" ")[1] } if params.class == String && params.include(' ')
|
|
32
|
+
params = { "lastName"=> params } if params.class == String
|
|
33
|
+
return CiscoWebex::Toolbox.search(list(), params)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def save(params={})
|
|
37
|
+
return CiscoWebex::RestCC.post(@auth_token, "/organization/#{@org_id}/user/bulk", params) rescue false
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def create(params)
|
|
41
|
+
return CiscoWebex::RestCC.post(@auth_token, "/organization/#{@org_id}/user", params) rescue false
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def delete(id)
|
|
45
|
+
return CiscoWebex::RestCC.delete(@auth_token, "/organization/#{@org_id}/user/#{id}") rescue false
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def update(id, params)
|
|
49
|
+
return CiscoWebex::RestCC.put(@auth_token, "/organization/#{@org_id}/user/#{id}", params) rescue false
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def patch(id, params)
|
|
53
|
+
return CiscoWebex::RestCC.patch(@auth_token, "/organization/#{@org_id}/user/#{id}", params) rescue false
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
data/lib/CC.rb
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# load CC
|
|
2
|
+
|
|
3
|
+
# Documentation from https://developer.webex-cx.com/documentation
|
|
4
|
+
|
|
5
|
+
require_relative './CC/CC.rb'
|
|
6
|
+
require_relative './CC/Users.rb'
|
|
7
|
+
require_relative './CC/Teams.rb'
|
|
8
|
+
require_relative './CC/Skills.rb'
|
|
9
|
+
require_relative './CC/Sites.rb'
|
|
10
|
+
require_relative './CC/Tasks.rb'
|
|
11
|
+
require_relative './CC/Agents.rb'
|
|
12
|
+
require_relative './CC/Captures.rb'
|
|
13
|
+
require_relative './CC/Subscriptions.rb'
|
|
14
|
+
require_relative './CC/SkillProfiles.rb'
|
|
15
|
+
require_relative './CC/EntryPoints.rb'
|
|
16
|
+
require_relative './CC/Queues.rb'
|
|
17
|
+
require_relative './CC/MultimediaProfiles.rb'
|
|
18
|
+
require_relative './CC/UserProfiles.rb'
|
|
19
|
+
require_relative './CC/AddressBooks.rb'
|
|
20
|
+
require_relative './CC/AgentProfiles.rb'
|
|
21
|
+
require_relative './CC/AuxiliaryCodes.rb'
|
|
22
|
+
require_relative './CC/DialPlans.rb'
|
|
23
|
+
require_relative './CC/EntryPointMappings.rb'
|
|
24
|
+
require_relative './CC/OutboundANI.rb'
|
|
25
|
+
require_relative './CC/Journey.rb'
|
|
26
|
+
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
module CiscoWebex
|
|
2
|
+
class EndpointControl < Calling
|
|
3
|
+
@auth_token = nil
|
|
4
|
+
|
|
5
|
+
# initialize object with stored token
|
|
6
|
+
def initialize(token=nil)
|
|
7
|
+
if not token
|
|
8
|
+
raise "Must provide API key"
|
|
9
|
+
else
|
|
10
|
+
if ! token
|
|
11
|
+
raise "CiscoWebex::Calling::EndpointControl API Token not valid!"
|
|
12
|
+
else
|
|
13
|
+
@auth_token = token
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def this()
|
|
19
|
+
puts "CiscoWebex::Calling::EndpointControl"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def dial(params={})
|
|
23
|
+
params = { "destination"=> params } if params.class == String
|
|
24
|
+
if params.class == Hash && params.has_key?('destination')
|
|
25
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/dial", params)
|
|
26
|
+
else
|
|
27
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.dial(): Must contain `destination`."
|
|
28
|
+
return False
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def dtmf(params={}, dtmf=nil)
|
|
33
|
+
if params.class == String
|
|
34
|
+
params = { "callId"=> params, "dtmf"=> dtmf}
|
|
35
|
+
end
|
|
36
|
+
if params.class == Hash && params.has_key?('callId') && params.has_key?('dtmf') && params['dtmf'] =~ /[\,0-9\*#ABCD]*/
|
|
37
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/transmitDTMF", params)
|
|
38
|
+
else
|
|
39
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.dtmf(): Must contain `callId` and `dtmf`."
|
|
40
|
+
return False
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def answer(params={})
|
|
45
|
+
params = { "callId"=> params } if params.class == String
|
|
46
|
+
if params.class == Hash && params.has_key?('callId')
|
|
47
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/answer", params)
|
|
48
|
+
else
|
|
49
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.answer(): Must contain `callId`."
|
|
50
|
+
return False
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def reject(params={})
|
|
55
|
+
params = { "callId"=> params } if params.class == String
|
|
56
|
+
if params.class == Hash && params.has_key?('callId')
|
|
57
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/reject", params)
|
|
58
|
+
else
|
|
59
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.reject(): Must contain `callId`."
|
|
60
|
+
return False
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def push(params={})
|
|
65
|
+
params = { "callId"=> params } if params.class == String
|
|
66
|
+
if params.class == Hash && params.has_key?('callId')
|
|
67
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/push", params)
|
|
68
|
+
else
|
|
69
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.push(): Must contain `callId`."
|
|
70
|
+
return False
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def pickup(params={})
|
|
75
|
+
params = { "target"=> params } if params.class == String
|
|
76
|
+
if params.class == Hash && params.has_key?('target')
|
|
77
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/pickup", params)
|
|
78
|
+
else
|
|
79
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.pickup(): Must contain `target`."
|
|
80
|
+
return False
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def barge(params={})
|
|
85
|
+
params = { "target"=> params } if params.class == String
|
|
86
|
+
if params.class == Hash && params.has_key?('target')
|
|
87
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/bargeIn", params)
|
|
88
|
+
else
|
|
89
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.barge(): Must contain `target`."
|
|
90
|
+
return False
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def hangup(params={})
|
|
95
|
+
params = { "callId"=> params } if params.class == String
|
|
96
|
+
if params.class == Hash && params.has_key?('callId')
|
|
97
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/hangup", params)
|
|
98
|
+
else
|
|
99
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.hangup(): Must contain `callId`."
|
|
100
|
+
return False
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def hold(params={})
|
|
105
|
+
params = { "callId"=> params } if params.class == String
|
|
106
|
+
if params.class == Hash && params.has_key?('callId')
|
|
107
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/hold", params)
|
|
108
|
+
else
|
|
109
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.hold(): Must contain `callId`."
|
|
110
|
+
return False
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def resume(params={})
|
|
115
|
+
params = { "callId"=> params } if params.class == String
|
|
116
|
+
if params.class == Hash && params.has_key?('callId')
|
|
117
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/resume", params)
|
|
118
|
+
else
|
|
119
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.resume(): Must contain `callId`."
|
|
120
|
+
return False
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def park(params={}, destination=nil, is_group_park=false)
|
|
125
|
+
if params.class == String
|
|
126
|
+
params = { "callId"=> params, "destination"=> destination, "isGroupPark"=>is_group_park }
|
|
127
|
+
end
|
|
128
|
+
if params.class == Hash && params.has_key?('callId') && ( params['destination'] || params['isGroupPark'] )
|
|
129
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/park", params)
|
|
130
|
+
else
|
|
131
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.park(): Must contain `callId` and `destination` and `is_group_park`."
|
|
132
|
+
return False
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def retrieve(params={})
|
|
137
|
+
params = { "destination"=> params } if params.class == String
|
|
138
|
+
if params.class == Hash && params.has_key?('destination')
|
|
139
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/retrieve", params)
|
|
140
|
+
else
|
|
141
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.retrieve(): Must contain `destination`."
|
|
142
|
+
return False
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def divert(params={}, destination=nil, to_voicemail=false)
|
|
147
|
+
if params.class == String
|
|
148
|
+
params = { "callId"=> params, "destination"=> destination, "toVoicemail"=>to_voicemail }
|
|
149
|
+
end
|
|
150
|
+
if params.class == Hash && params.has_key?('callId') && ( params['destination'] || params['toVoicemail'] )
|
|
151
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/divert", params)
|
|
152
|
+
else
|
|
153
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.divert(): Must contain `callId` and `destination` or `to_voicemail`."
|
|
154
|
+
return False
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def transfer(params={}, callid_2=nil, destination=nil)
|
|
159
|
+
if params.class == String
|
|
160
|
+
params = { "callId1"=> params, "callId2"=> callid_2, "destination"=> destination }
|
|
161
|
+
end
|
|
162
|
+
if params.class == Hash && params.has_key?('callId1') && params.has_key?('callId2') &¶ms.has_key?('destination')
|
|
163
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/transfer", params)
|
|
164
|
+
else
|
|
165
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.transfer(): Must contain `callid_1` and `callid_2` and `destination`."
|
|
166
|
+
return False
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def start_recording(params={})
|
|
171
|
+
params = { "callId"=> params } if params.class == String
|
|
172
|
+
if params.class == Hash && params.has_key?('callId')
|
|
173
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/startRecording", params)
|
|
174
|
+
else
|
|
175
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.start_recording(): Must contain callId."
|
|
176
|
+
return False
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def stop_recording(params={})
|
|
181
|
+
params = { "callId"=> params } if params.class == String
|
|
182
|
+
if params.class == Hash && params.has_key?('callId')
|
|
183
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/stopRecording", params)
|
|
184
|
+
else
|
|
185
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.stop_recording(): Must contain callId."
|
|
186
|
+
return False
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def pause_recording(params={})
|
|
191
|
+
params = { "callId"=> params } if params.class == String
|
|
192
|
+
if params.class == Hash && params.has_key?('callId')
|
|
193
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/pauseRecording", params)
|
|
194
|
+
else
|
|
195
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.pause_recording(): Must contain callId."
|
|
196
|
+
return False
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
def resume_recording(params={})
|
|
201
|
+
params = { "callId"=> params } if params.class == String
|
|
202
|
+
if params.class == Hash && params.has_key?('callId')
|
|
203
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/calls/resumeRecording", params)
|
|
204
|
+
else
|
|
205
|
+
STDERR.puts "CiscoWebex::Calling::EndpointControl.resume_recording(): Must contain callId."
|
|
206
|
+
return False
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
module CiscoWebex
|
|
2
|
+
class Calling
|
|
3
|
+
@auth_token = nil
|
|
4
|
+
@my_profile = nil
|
|
5
|
+
|
|
6
|
+
# initialize object with stored token
|
|
7
|
+
def initialize(token=nil)
|
|
8
|
+
if not token
|
|
9
|
+
raise "Must provide API key"
|
|
10
|
+
else
|
|
11
|
+
@auth_token = token if token
|
|
12
|
+
@my_profile = me() # test token and store users profile
|
|
13
|
+
if ! @my_profile
|
|
14
|
+
raise "CiscoWebex::Calling API Token not valid!"
|
|
15
|
+
else
|
|
16
|
+
# initiate all class methods
|
|
17
|
+
@call_control = CallControl.new(@auth_token)
|
|
18
|
+
@calls = Calls.new(@auth_token)
|
|
19
|
+
@voicemail = Voicemail.new(@auth_token)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def this()
|
|
25
|
+
puts "CiscoWebex::Calling"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# access to REST API
|
|
29
|
+
def get(uri, params=nil, limit=50000)
|
|
30
|
+
return CiscoWebex::Rest.get(@auth_token, uri, params, limit)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# access to REST API
|
|
34
|
+
def head(uri, params=nil)
|
|
35
|
+
return CiscoWebex::Rest.head(@auth_token, uri, params)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# access to REST API
|
|
39
|
+
def post(uri, params=nil)
|
|
40
|
+
return CiscoWebex::Rest.post(@auth_token, uri, params)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# access to REST API
|
|
44
|
+
def put(uri, params=nil)
|
|
45
|
+
return CiscoWebex::Rest.put(@auth_token, uri, params)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def me()
|
|
49
|
+
return CiscoWebex::Rest.get(@auth_token, "/v1/people/me")
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def calls()
|
|
53
|
+
return @calls
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def voicemail()
|
|
57
|
+
return @voicemail
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def call_control()
|
|
61
|
+
return @call_control
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module CiscoWebex
|
|
2
|
+
class Calls < Calling
|
|
3
|
+
@auth_token = nil
|
|
4
|
+
|
|
5
|
+
# initialize object with stored token
|
|
6
|
+
def initialize(token=nil)
|
|
7
|
+
if not token
|
|
8
|
+
raise "Must provide API key"
|
|
9
|
+
else
|
|
10
|
+
if ! token
|
|
11
|
+
raise "CiscoWebex::Calling::Calls API Token not valid!"
|
|
12
|
+
else
|
|
13
|
+
@auth_token = token
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def this()
|
|
19
|
+
puts "CiscoWebex::Calling::Calls"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def list()
|
|
23
|
+
return CiscoWebex::Rest.get(@auth_token, "/v1/telephony/calls")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def get(call_id=nil)
|
|
27
|
+
if call_id
|
|
28
|
+
return CiscoWebex::Rest.get(@auth_token, "/v1/telephony/calls/#{call_id}")
|
|
29
|
+
else
|
|
30
|
+
STDERR.puts "CiscoWebex::Calling::Calls.get(): Must caontain `call_id`"
|
|
31
|
+
return false
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def search(params={})
|
|
36
|
+
params = { "personality"=> params } if params.class == String
|
|
37
|
+
return CiscoWebex::Toolbox.search(list(), params)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def history(params=[])
|
|
41
|
+
return CiscoWebex::Rest.get(@auth_token, "/v1/telephony/history?#{",".join(params)}")
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
module CiscoWebex
|
|
2
|
+
class Locations < Calling
|
|
3
|
+
@base_uri = "/v1/locations"
|
|
4
|
+
@auth_token = nil
|
|
5
|
+
|
|
6
|
+
# initialize object with stored token
|
|
7
|
+
def initialize(token=nil)
|
|
8
|
+
if token == nil
|
|
9
|
+
STDERR.puts "Must provide API key for CiscoWebex::Calling::Locations"
|
|
10
|
+
return false
|
|
11
|
+
else
|
|
12
|
+
@auth_token = token if token
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def this()
|
|
17
|
+
puts "CiscoWebex::Calling::Locations"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def get(id)
|
|
21
|
+
return CiscoWebex::Rest.get(@auth_token, "#{@base_uri}/#{id}", {}, limit).data rescue false
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def list(params={}, limit=5000)
|
|
25
|
+
return CiscoWebex::Rest.get(@auth_token, @base_uri, params, limit).data rescue false
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def search(params={}, limit=5000)
|
|
29
|
+
return CiscoWebex::Rest.get(@auth_token, @base_uri, params, limit).data rescue false
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def create(params)
|
|
33
|
+
return CiscoWebex::Rest.post(@auth_token, @base_uri, params) rescue false
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def delete(id)
|
|
37
|
+
return CiscoWebex::Rest.delete(@auth_token, "#{@base_uri}/#{id}") rescue false
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def update(id, params)
|
|
41
|
+
return CiscoWebex::Rest.put(@auth_token, "#{@base_uri}/#{id}", params) rescue false
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def patch(id, params)
|
|
45
|
+
STDERR.puts "CiscoWebex::Calling::Locations.patch() - Metod not implemented"
|
|
46
|
+
return False
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
module CiscoWebex
|
|
2
|
+
class Voicemail < Calling
|
|
3
|
+
@auth_token = nil
|
|
4
|
+
|
|
5
|
+
# initialize object with stored token
|
|
6
|
+
def initialize(token=nil)
|
|
7
|
+
if not token
|
|
8
|
+
raise "Must provide API key"
|
|
9
|
+
else
|
|
10
|
+
if ! token
|
|
11
|
+
raise "CiscoWebex::Calling::Voicemail API Token not valid!"
|
|
12
|
+
else
|
|
13
|
+
@auth_token = token
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def this()
|
|
19
|
+
puts "CiscoWebex::Calling::Voicemail"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def list()
|
|
23
|
+
return CiscoWebex::Rest.get(@auth_token, "/v1/telephony/voiceMessages")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def search(params={})
|
|
27
|
+
params = { "callingParty"=> params } if params.class == String
|
|
28
|
+
return CiscoWebex::Toolbox.search(list(), params)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def summary()
|
|
32
|
+
return CiscoWebex::Rest.get(@auth_token, "/v1/telephony/voiceMessages/summary")
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def delete(message_id=nil)
|
|
36
|
+
if message_id
|
|
37
|
+
return CiscoWebex::Rest.delete(@auth_token, "/v1/telephony/voiceMessages/#{message_id}")
|
|
38
|
+
else
|
|
39
|
+
STDERR.puts "CiscoWebex::Calling::Voicemail.delete(): Must contain `message_id`"
|
|
40
|
+
return false
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def delete(message_id=nil)
|
|
45
|
+
if message_id
|
|
46
|
+
return CiscoWebex::Rest.delete(@auth_token, "/v1/telephony/voiceMessages/#{message_id}")
|
|
47
|
+
else
|
|
48
|
+
STDERR.puts "CiscoWebex::Calling::Voicemail.delete(): Must contain `message_id`"
|
|
49
|
+
return false
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def mark_read(params={})
|
|
54
|
+
params = { "messageId"=> params } if params.class == String
|
|
55
|
+
if params.has_key?('messageId')
|
|
56
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/voiceMessages/markAsRead", params)
|
|
57
|
+
else
|
|
58
|
+
STDERR.puts "CiscoWebex::Calling::Voicemail.mark_read(): Must contain `message_id`"
|
|
59
|
+
return false
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def mark_unread(params={})
|
|
64
|
+
params = { "messageId"=> params } if params.class == String
|
|
65
|
+
if params.has_key?('messageId')
|
|
66
|
+
return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/voiceMessages/markAsUnread", params)
|
|
67
|
+
else
|
|
68
|
+
STDERR.puts "CiscoWebex::Calling::Voicemail.mark_unread(): Must contain `message_id`"
|
|
69
|
+
return false
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
data/lib/Calling.rb
ADDED