Class: Mu::System

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/mu/api/system.rb

Constant Summary

Constants included from Helper

Helper::ESCAPES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper

#ask, #bin2hex, #error, #escape, #format_float, #get_file_as_string_array, #make_xml, #msg, #shift, #to_boolean

Constructor Details

#initialize(host = ENV['MU_IP'], username = ENV['MU_ADMIN_USER'], password = ENV['MU_ADMIN_PASS']) ⇒ System

Returns a new instance of System.



7
8
9
10
11
12
13
14
15
16
# File 'lib/mu/api/system.rb', line 7

def initialize(host=ENV['MU_IP'], username=ENV['MU_ADMIN_USER'], password=ENV['MU_ADMIN_PASS'])
  @host = host
  @username  = username
  @password  = password
  @docroot = "/api/v5/system/"
  @cookie = ""
  @response = nil
  @http = HttpHelper.new(@host, @username, @password, @docroot)
  msg "Created System Api object to :#{@host}", Logger::DEBUG
end

Instance Attribute Details

#docrootObject

Returns the value of attribute docroot.



5
6
7
# File 'lib/mu/api/system.rb', line 5

def docroot
  @docroot
end

#hostObject

Returns the value of attribute host.



5
6
7
# File 'lib/mu/api/system.rb', line 5

def host
  @host
end

#passwordObject

Returns the value of attribute password.



5
6
7
# File 'lib/mu/api/system.rb', line 5

def password
  @password
end

#usernameObject

Returns the value of attribute username.



5
6
7
# File 'lib/mu/api/system.rb', line 5

def username
  @username
end

Instance Method Details

#restartObject

restarts the Mu system



19
20
21
22
23
# File 'lib/mu/api/system.rb', line 19

def restart
  response = @http.get("restart/")
  msg response, Logger::DEBUG
  return response
end

#statusObject

returns Mu System status



26
27
28
29
30
# File 'lib/mu/api/system.rb', line 26

def status
  response =  @http.get("status/")
  msg response, Logger::DEBUG
  return response
end

#status2Object

returns more Mu System status



33
34
35
36
37
# File 'lib/mu/api/system.rb', line 33

def status2
  response = @http.get("status2/")
  msg response, Logger::DEBUG
  return response
end