Class: CiscoWebex::Xapi

Inherits:
Devices show all
Defined in:
lib/Devices/Xapi.rb

Instance Method Summary collapse

Methods inherited from Devices

#configurations, #devices, #head, #me, #put, #workspaces, #xapi

Constructor Details

#initialize(token = nil) ⇒ Xapi

initialize object with stored token



6
7
8
9
10
11
12
13
# File 'lib/Devices/Xapi.rb', line 6

def initialize(token=nil)
	if token == nil
		STDERR.puts "Must provide API key for CiscoWebex::Devices::XAPI"
		return false
	else
		@auth_token = token if token
	end
end

Instance Method Details

#command(command_name, params = {}) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/Devices/Xapi.rb', line 32

def command(command_name, params={})
	if params.class == Hash && params.has_key?('deviceId') && params.has_key?('arguments')
		return CiscoWebex::RestCC.post(@auth_token, "/v1/xapi/#{command_name}", params)
	else
		STDERR.puts "Error: CicoWebex::Devices::XAPI.command(): `command_name` and `body` required."
		return false
	end
end

#create(params) ⇒ Object



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

def create(params)
	STDERR.puts "Error: CicoWebex::Devices::XAPI.create(): Not implemented."
	return false
end

#delete(id) ⇒ Object



59
60
61
62
# File 'lib/Devices/Xapi.rb', line 59

def delete(id)
	STDERR.puts "Error: CicoWebex::Devices::XAPI.delete(): Not implemented."
	return false
end

#get(params, setting_name = nil) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/Devices/Xapi.rb', line 19

def get(params, setting_name=nil)
	if params.class != Hash || !( params.class == Hash && params.has_key?('deviceId') && params.has_key?('name') ) || !( params.class == String || setting_name.class == String )
		STDERR.puts "Error: CicoWebex::Devices::XAPI.get(): Must provide search paramters as Hash or `'deviceId` and `name`"
		return false
	else
		if params.class == String
			params = { "deviceId"=> params, "name"=> setting_name }
		end

		return CiscoWebex::Rest.get(@auth_token, "/v1/xpai/status", params, limit) rescue false
	end
end

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



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

def list(params={}, limit=5000)
	STDERR.puts "Error: CicoWebex::Devices::XAPI.get(): Not implemented."
	return false
end

#patch(id, params) ⇒ Object



69
70
71
72
# File 'lib/Devices/Xapi.rb', line 69

def patch(id, params)
	STDERR.puts "CiscoWebex::Devices::XAPI.patch() - Metod not implemented"
	return False
end

#post(command_name, params = {}) ⇒ Object



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

def post(command_name, params={})
	return command(command_name, params={})
end

#search(params = {}) ⇒ Object



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

def search(params={})
	return get(params)
end

#thisObject



15
16
17
# File 'lib/Devices/Xapi.rb', line 15

def this()
	puts "CiscoWebex::Devices::XAPI"
end

#update(id, params) ⇒ Object



64
65
66
67
# File 'lib/Devices/Xapi.rb', line 64

def update(id, params)
	STDERR.puts "Error: CicoWebex::Devices::XAPI.update(): Not implemented."
	return false
end