Class: CiscoWebex::Devices

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

Direct Known Subclasses

Configurations, Endpoints, Workspaces, Xapi

Instance Method Summary collapse

Constructor Details

#initialize(token = nil) ⇒ Devices

initialize object with stored token



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

def initialize(token=nil)
	if not token
		raise "Must provide API key"
	else
		@auth_token = token if token
		@org_id =  me()['orgId'] rescue nil# test token and store users profile
		if @org_id == nil
			raise "CiscoWebex::Messaging - Bearer token not valid"
		else
			@devices = Endpoints.new(@auth_token)
			@workspaces = Workspaces.new(@auth_token)
			@xapi = Xapi.new(@auth_token)
			@configurations = Configurations.new(@auth_token)
		end
	end
end

Instance Method Details

#configurationsObject



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

def configurations()
	return @configurations
end

#devicesObject



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

def devices()
	return @devices
end

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

access to REST API



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

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



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

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

#meObject

shortcut for getting the profile associated with the token



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

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

end

#post(uri, params = nil) ⇒ Object

access to REST API



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

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

#put(uri, params = nil) ⇒ Object

access to REST API



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

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

#workspacesObject



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

def workspaces()
	return @workspaces
end

#xapiObject



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

def xapi()
	return @xapi
end