Class: Cac

Inherits:
Object
  • Object
show all
Defined in:
lib/cac.rb,
lib/cac/version.rb

Constant Summary collapse

URL =
"https://panel.cloudatcost.com/api/v1/"
VERSION =
"0.0.3"

Instance Method Summary collapse

Constructor Details

#initialize(key = '', login = '') ⇒ Cac



9
10
11
12
# File 'lib/cac.rb', line 9

def initialize(key = '',  = '')
  @key = key
  @login = 
end

Instance Method Details

#console(server) ⇒ Object



31
32
33
# File 'lib/cac.rb', line 31

def console(server)
  JSON.parse(RestClient.post("#{URL}console.php", {key: @key, login: @login, sid: server}){|response, request, result| response })
end

#power(action, server) ⇒ Object

action must be either: poweron, poweroff, reset



27
28
29
# File 'lib/cac.rb', line 27

def power(action, server)
  JSON.parse(RestClient.post("#{URL}powerop.php", {key: @key, login: @login, action: action, sid: server}){|response, request, result| response })
end

#serversObject



14
15
16
# File 'lib/cac.rb', line 14

def servers
  JSON.parse(RestClient.get("#{URL}listservers.php", {params: {key: @key, login: @login}}){|response, request, result| response })
end

#tasksObject



22
23
24
# File 'lib/cac.rb', line 22

def tasks
  JSON.parse(RestClient.get("#{URL}listtasks.php", {params: {key: @key, login: @login}}){|response, request, result| response })
end

#templatesObject



18
19
20
# File 'lib/cac.rb', line 18

def templates
  JSON.parse(RestClient.get("#{URL}listtemplates.php", {params: {key: @key, login: @login}}){|response, request, result| response })
end