Class: CiscoWebex::AgentProfiles

Inherits:
ContactCenter show all
Defined in:
lib/CC/AgentProfiles.rb

Instance Method Summary collapse

Methods inherited from ContactCenter

#address_books, #agent_profiles, #agents, #auxiliary_codes, #captures, #dial_plans, #entry_point_mappings, #entry_points, #head, #journey, #multimedia_profiles, #my_org, #outbound_ani, #post, #put, #queues, #sites, #skill_profiles, #skills, #subscriptions, #tasks, #teams, #user_profiles, #users

Constructor Details

#initialize(token = nil, org_id = nil) ⇒ AgentProfiles

initialize object with stored token



7
8
9
10
11
12
13
14
15
# File 'lib/CC/AgentProfiles.rb', line 7

def initialize(token=nil, org_id=nil)
	if token == nil || org_id == nil
		STDERR.puts "Must provide API key for CiscoWebex::ContactCenter::AgentProfiles"
		return false
	else
		@auth_token = token if token
		@org_id =  org_id  # test token and store users profile
	end
end

Instance Method Details

#create(params) ⇒ Object



54
55
56
# File 'lib/CC/AgentProfiles.rb', line 54

def create(params)
	return CiscoWebex::RestCC.post(@auth_token, "/organization/#{@org_id}/agent-profile", params) rescue false
end

#delete(id) ⇒ Object



58
59
60
# File 'lib/CC/AgentProfiles.rb', line 58

def delete(id)
	return CiscoWebex::RestCC.delete(@auth_token, "/organization/#{@org_id}/agent-profile/#{id}") rescue false
end

#get(id, limit = 5000) ⇒ Object



21
22
23
# File 'lib/CC/AgentProfiles.rb', line 21

def get(id, limit=5000)
	return CiscoWebex::RestCC.get(@auth_token, "/organization/#{@org_id}/agent-profile/#{id}", {}, limit)['data'] rescue false
end

#list(params = {}, limit = 5000) ⇒ Object



25
26
27
# File 'lib/CC/AgentProfiles.rb', line 25

def list(params={}, limit=5000)
	return CiscoWebex::RestCC.get(@auth_token, "/organization/#{@org_id}/agent-profile", {}, limit)['data'] rescue false
end

#patch(id, params) ⇒ Object



66
67
68
# File 'lib/CC/AgentProfiles.rb', line 66

def patch(id, params)
	return CiscoWebex::RestCC.patch(@auth_token, "/organization/#{@org_id}/agent-profile/#{id}", params) rescue false
end

#save(params = {}) ⇒ Object



50
51
52
# File 'lib/CC/AgentProfiles.rb', line 50

def save(params={})
	return CiscoWebex::RestCC.post(@auth_token, "/organization/#{@org_id}/agent-profile/bulk", params) rescue false
end

#search(params = {}, limit = 5000) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/CC/AgentProfiles.rb', line 29

def search(params={}, limit=5000)
	if params.class == Hash && params.has_key?('name')
		search_param = params['name']
	elsif params.class == String
		search_param = params
	else
		STDERR.puts "Must provide name to search on"
		return false
	end

	cc_data = CiscoWebex::RestCC.get(@auth_token, "/organization/#{@org_id}/agent-profile")['data'] rescue []
	for data in cc_data['data'] do
		if search_param == cc_data['name']
			return data
		end
	end

	STDERR.puts "Agent Profile #{search_param} not found."
	return nil
end

#thisObject



17
18
19
# File 'lib/CC/AgentProfiles.rb', line 17

def this()
	puts "CiscoWebex::ContactCenter::AgentProfiles - Org:#{@org_id}"
end

#update(id, params) ⇒ Object



62
63
64
# File 'lib/CC/AgentProfiles.rb', line 62

def update(id, params)
	return CiscoWebex::RestCC.put(@auth_token, "/organization/#{@org_id}/agent-profile/#{id}", params) rescue false
end