Class: CiscoWebex::Messaging

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

Instance Method Summary collapse

Constructor Details

#initialize(token = nil) ⇒ Messaging

initialize object with stored token



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/Messaging/Messaging.rb', line 7

def initialize(token=nil)
	if not token
		raise "Must provide API key"
	else
		@auth_token = token if token
		@my_profile =  me() rescue nil# test token and store users profile
		if @my_profile == nil
			raise "CiscoWebex::Messaging - Bearer token not valid"
		else
			@people = MessagingPeople.new(@auth_token)
			@rooms = Rooms.new(@auth_token)
			@memberships = Memberships.new(@auth_token)
			@messages = Messages.new(@auth_token)
			@teams = Teams.new(@auth_token)
			@classifications = Classifications.new(@auth_token)
			@webhooks = Webhooks.new(@auth_token)
		end
	end
end

Instance Method Details

#audit_eventsObject



81
82
83
84
85
86
87
88
89
90
# File 'lib/Messaging/Messaging.rb', line 81

def audit_events()
	case method.upcase
		when "GET" || "SEARCH" || "FIND"
			return CiscoWebex::Rest.get(@auth_token, "/v1/adminAudit/events", params, limit)

		else
			STDERR.puts("Method #{method} not found.")
			return false
	end
end

#classificationsObject



77
78
79
# File 'lib/Messaging/Messaging.rb', line 77

def classifications()
	return @classifications
end

#get(uri, params = nil, limit = 50) ⇒ Object

access to REST API



28
29
30
# File 'lib/Messaging/Messaging.rb', line 28

def get(uri, params=nil, limit=50)
	return CiscoWebex::Rest.get(@auth_token, uri, params, limit)
end

#head(uri, params = nil) ⇒ Object

access to REST API



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

def head(uri, params=nil)
	return CiscoWebex::Rest.head(@auth_token, uri, params)
end

#meObject

shortcut for getting the profile associated with the token



48
49
50
51
# File 'lib/Messaging/Messaging.rb', line 48

def me()
	return CiscoWebex::Rest.get(@auth_token, "/v1/people/me")

end

#membershipsObject



61
62
63
# File 'lib/Messaging/Messaging.rb', line 61

def memberships()
	return @memberships
end

#messagesObject



65
66
67
# File 'lib/Messaging/Messaging.rb', line 65

def messages()
	return @messages
end

#peopleObject



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

def people()
	return @people
end

#post(uri, params = nil) ⇒ Object

access to REST API



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

def post(uri, params=nil)
	return CiscoWebex::Rest.post(@auth_token, uri, params)
end

#put(uri, params = nil) ⇒ Object

access to REST API



43
44
45
# File 'lib/Messaging/Messaging.rb', line 43

def put(uri, params=nil)
	return CiscoWebex::Rest.put(@auth_token, uri, params)
end

#roomsObject



57
58
59
# File 'lib/Messaging/Messaging.rb', line 57

def rooms()
	return @rooms
end

#teamsObject



69
70
71
# File 'lib/Messaging/Messaging.rb', line 69

def teams()
	return @teams
end

#webhooksObject



73
74
75
# File 'lib/Messaging/Messaging.rb', line 73

def webhooks()
	return @webhooks
end