Class: CiscoWebex::Admin

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

Constant Summary collapse

BASE_URL =

template = WebexTeamsTemplates()

"https://webexapis.com"

Instance Method Summary collapse

Constructor Details

#initialize(token = nil) ⇒ Admin

initialize object with stored token



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

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::Admin - Bearer token not valid"
		else
			@people = People.new(@auth_token)
			@licenses = Licenses.new(@auth_token)
			@organizations = Organizations.new(@auth_token)
			@resource_groups = ResourceGroups.new(@auth_token)
			@roles = Roles.new(@auth_token)
			@audit_events = AuditEvents.new(@auth_token)
			@authorizations = Authorizations.new(@auth_token, @my_profile['orgId'])
		end
	end
end

Instance Method Details

#audit_eventsObject



60
61
62
# File 'lib/Admin/Admin.rb', line 60

def audit_events()
	return @audit_events
end

#authorizationsObject



80
81
82
# File 'lib/Admin/Admin.rb', line 80

def authorizations()
	return @authorizations
end

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

access to REST API



30
31
32
# File 'lib/Admin/Admin.rb', line 30

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



35
36
37
# File 'lib/Admin/Admin.rb', line 35

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

#licensesObject



64
65
66
# File 'lib/Admin/Admin.rb', line 64

def licenses()
	return @licenses
end

#meObject

shortcut for getting the profile associated with the token



50
51
52
53
# File 'lib/Admin/Admin.rb', line 50

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

end

#organizationsObject



68
69
70
# File 'lib/Admin/Admin.rb', line 68

def organizations()
	return @organizations
end

#peopleObject

start sub classes



56
57
58
# File 'lib/Admin/Admin.rb', line 56

def people()
	return @people
end

#post(uri, params = nil) ⇒ Object

access to REST API



40
41
42
# File 'lib/Admin/Admin.rb', line 40

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

#put(uri, params = nil) ⇒ Object

access to REST API



45
46
47
# File 'lib/Admin/Admin.rb', line 45

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

#resource_groupsObject



72
73
74
# File 'lib/Admin/Admin.rb', line 72

def resource_groups()
	return @resource_groups
end

#rolesObject



76
77
78
# File 'lib/Admin/Admin.rb', line 76

def roles()
	return @roles
end