Class: CiscoWebex::Voicemail

Inherits:
Calling
  • Object
show all
Defined in:
lib/Calling/Voicemail.rb

Instance Method Summary collapse

Methods inherited from Calling

#call_control, #calls, #get, #head, #me, #post, #put, #voicemail

Constructor Details

#initialize(token = nil) ⇒ Voicemail

initialize object with stored token



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/Calling/Voicemail.rb', line 6

def initialize(token=nil)
	if not token
		raise "Must provide API key"
	else
		if ! token
			raise "CiscoWebex::Calling::Voicemail API Token not valid!"
		else
			@auth_token = token
		end
	end
end

Instance Method Details

#delete(id) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/Calling/Voicemail.rb', line 35

def delete(message_id=nil)
	if message_id
		return CiscoWebex::Rest.delete(@auth_token, "/v1/telephony/voiceMessages/#{message_id}")
	else
		STDERR.puts "CiscoWebex::Calling::Voicemail.delete(): Must contain `message_id`"
		return false
	end
end

#listObject



22
23
24
# File 'lib/Calling/Voicemail.rb', line 22

def list()
	return CiscoWebex::Rest.get(@auth_token, "/v1/telephony/voiceMessages")
end

#mark_read(params = {}) ⇒ Object



53
54
55
56
57
58
59
60
61
# File 'lib/Calling/Voicemail.rb', line 53

def mark_read(params={})
	params = { "messageId"=> params } if params.class == String
	if params.has_key?('messageId')
		return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/voiceMessages/markAsRead", params)
	else
		STDERR.puts "CiscoWebex::Calling::Voicemail.mark_read(): Must contain `message_id`"
		return false
	end
end

#mark_unread(params = {}) ⇒ Object



63
64
65
66
67
68
69
70
71
# File 'lib/Calling/Voicemail.rb', line 63

def mark_unread(params={})
	params = { "messageId"=> params } if params.class == String
	if params.has_key?('messageId')
		return CiscoWebex::Rest.post(@auth_token, "/v1/telephony/voiceMessages/markAsUnread", params)
	else
		STDERR.puts "CiscoWebex::Calling::Voicemail.mark_unread(): Must contain `message_id`"
		return false
	end
end

#search(params = {}) ⇒ Object



26
27
28
29
# File 'lib/Calling/Voicemail.rb', line 26

def search(params={})
	params = { "callingParty"=> params } if params.class == String
	return CiscoWebex::Toolbox.search(list(), params)
end

#summaryObject



31
32
33
# File 'lib/Calling/Voicemail.rb', line 31

def summary()
	return CiscoWebex::Rest.get(@auth_token, "/v1/telephony/voiceMessages/summary")
end

#thisObject



18
19
20
# File 'lib/Calling/Voicemail.rb', line 18

def this()
	puts "CiscoWebex::Calling::Voicemail"
end