Class: CiscoWebex::Messages

Inherits:
Messaging show all
Defined in:
lib/Messaging/Messages.rb

Direct Known Subclasses

Attachments

Defined Under Namespace

Classes: Attachments

Instance Method Summary collapse

Methods inherited from Messaging

#audit_events, #classifications, #head, #me, #memberships, #messages, #people, #post, #put, #rooms, #teams, #webhooks

Constructor Details

#initialize(token = nil) ⇒ Messages

initialize object with stored token



6
7
8
9
10
11
12
13
14
# File 'lib/Messaging/Messages.rb', line 6

def initialize(token=nil)
	if token == nil
		STDERR.puts "Must provide API key for CiscoWebex::Messaging::Messages"
		return false
	else
		@auth_token = token if token
		@attachments = Attachments.new(@auth_token)
	end
end

Instance Method Details

#attachmentsObject



63
64
65
# File 'lib/Messaging/Messages.rb', line 63

def attachments()
	return @attachments
end

#create(params) ⇒ Object



46
47
48
# File 'lib/Messaging/Messages.rb', line 46

def create(params)
	return CiscoWebex::Rest.post(@auth_token, "/v1/messages", params) rescue false
end

#delete(id) ⇒ Object



50
51
52
# File 'lib/Messaging/Messages.rb', line 50

def delete(id)
	return CiscoWebex::Rest.delete(@auth_token, "/v1/messages", id) rescue false
end

#get(id) ⇒ Object



33
34
35
# File 'lib/Messaging/Messages.rb', line 33

def get(id)
	return CiscoWebex::Rest.get(@auth_token, "/v1/messages/#{id}", {}, limit) rescue false
end

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



37
38
39
# File 'lib/Messaging/Messages.rb', line 37

def list(params={}, limit=5000)
	return CiscoWebex::Rest.get(@auth_token, "/v1/messages", params, limit) rescue false
end

#patch(params, id = nil) ⇒ Object



58
59
60
61
# File 'lib/Messaging/Messages.rb', line 58

def patch(params, id=nil)
	STDERR.puts "CiscoWebex::Messaging::Messages.patch() - Metod not implemented"
	return false
end

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



41
42
43
44
# File 'lib/Messaging/Messages.rb', line 41

def search(params={}, limit=5000)
	params = { "roomId"=> params } if params.class == String
	return list(params, limit)				
end

#templateObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/Messaging/Messages.rb', line 20

def template()
	return { 	
				"roomId"=>"", 
				"parentId"=>"", 
				"toPersonId"=>"", 
				"toPersonEmail"=>"", 
				"text"=>"", 
				"markdown"=>"", 
				"files"=>[], 
				"attachments"=>[]
			}
end

#thisObject



16
17
18
# File 'lib/Messaging/Messages.rb', line 16

def this()
	puts "CiscoWebex::Messaging::Messages"
end

#update(params) ⇒ Object



54
55
56
# File 'lib/Messaging/Messages.rb', line 54

def update(params)
	return CiscoWebex::Rest.put(@auth_token, "/v1/messages", params) rescue false
end