Class: Ivapi::Client::Server
Instance Attribute Summary collapse
-
#server_id ⇒ Object
readonly
Returns the value of attribute server_id.
Attributes inherited from Base
Instance Method Summary collapse
-
#change(options = {}) ⇒ Object
Send command to change server plan.
-
#domain(domain) ⇒ Object
(also: #hostname)
Send command to change server hostname.
-
#firewall(options = {}) ⇒ Object
Send command to change firewall settings.
-
#flush_iptables ⇒ Object
Send command to clean server firewall rules.
-
#graphs(width, ip) ⇒ Object
Get server graphs.
-
#information ⇒ Object
(also: #info)
Get information about server.
-
#initialize(client, server_id) ⇒ Server
constructor
A new instance of Server.
-
#os ⇒ Object
Get all available server operating systems.
-
#reboot ⇒ Object
Send command to reboot the server.
-
#recreate(os, options = {}) ⇒ Object
Send command to recreate the server.
-
#reset_password(options = {}) ⇒ Object
Send command to reset server password.
-
#tasks(count, options = {}) ⇒ Object
Get server tasks.
Methods inherited from Base
Constructor Details
#initialize(client, server_id) ⇒ Server
Returns a new instance of Server.
6 7 8 9 |
# File 'lib/ivapi/client/server.rb', line 6 def initialize(client, server_id) super(client) @server_id = server_id end |
Instance Attribute Details
#server_id ⇒ Object (readonly)
Returns the value of attribute server_id.
4 5 6 |
# File 'lib/ivapi/client/server.rb', line 4 def server_id @server_id end |
Instance Method Details
#change(options = {}) ⇒ Object
Send command to change server plan.
options - The Hash options (default: {}):
:cpu - The Integer of GHz (min: 2, max: 16).
:ram - The Integer of MB (min: 2048, max: 16384).
:quota - The Integer of GB (min: 20, max: 800).
:bandwidth - The Integer of Mbps (min: 20, max: 400).
Returns the Integer of task id.
135 136 137 138 |
# File 'lib/ivapi/client/server.rb', line 135 def change( = {}) params = .merge(command: 'server_change', id: server_id) get('/json.php', params) end |
#domain(domain) ⇒ Object Also known as: hostname
Send command to change server hostname.
domain - The String of new server hostname.
Returns the Integer of task id.
145 146 147 148 |
# File 'lib/ivapi/client/server.rb', line 145 def domain(domain) params = { command: 'server_domain', id: server_id, domain: domain } get('/json.php', params) end |
#firewall(options = {}) ⇒ Object
Send command to change firewall settings.
options - The Hash options (default: {}):
:pps - The Integer of incoming ICMP, UDP, TCP joins per
second (min: 1000, max: 5000).
:pps_icmp - The Integer of ICMP packets per
second (0 or min: 10, max: 500).
:pps_udp - The Integer of UDP packets per
second (0 or min: 10, max: 500).
:pps_syn - The Integer of TCP SYN packets per second from
one IP (0 or min: 2, max: 20).
:connlimit - The Integer of collateral connections from one
IP (0 or min: 16, max: 512).
Returns the Hash of new firewall settings.
121 122 123 124 |
# File 'lib/ivapi/client/server.rb', line 121 def firewall( = {}) params = .merge(command: 'server_firewall', id: server_id) get('/json.php', params) end |
#flush_iptables ⇒ Object
Send command to clean server firewall rules.
Returns the Integer of task id.
101 102 103 104 |
# File 'lib/ivapi/client/server.rb', line 101 def flush_iptables params = { command: 'server_flush_iptables', id: server_id } get('/json.php', params) end |
#graphs(width, ip) ⇒ Object
Get server graphs.
width - The Integer number of graphs width (max: 1000, optimal: 768). ip - The String of ip, from which graphs can be viewed.
Returns the Hash of server graphs.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ivapi/client/server.rb', line 42 def graphs(width, ip) params = { command: 'server_graphs', id: server_id, width: width, ip: ip } get('/json.php', params) end |
#information ⇒ Object Also known as: info
Get information about server.
Returns the Hash of server information.
14 15 16 17 |
# File 'lib/ivapi/client/server.rb', line 14 def information params = { command: 'server_info', id: server_id } get('/json.php', params) end |
#os ⇒ Object
Get all available server operating systems.
Returns the Hash of available server os.
56 57 58 59 |
# File 'lib/ivapi/client/server.rb', line 56 def os params = { command: 'server_os', id: server_id } get('/json.php', params) end |
#reboot ⇒ Object
Send command to reboot the server.
Returns the Integer of task id.
64 65 66 67 |
# File 'lib/ivapi/client/server.rb', line 64 def reboot params = { command: 'server_reboot', id: server_id } get('/json.php', params) end |
#recreate(os, options = {}) ⇒ Object
Send command to recreate the server.
os - The String of os (operating system) id. options - The Hash options (default: {}):
:new_password - The String of new server
password (min: 8, max: 64).
Returns the Integer of task id.
77 78 79 80 81 82 83 |
# File 'lib/ivapi/client/server.rb', line 77 def recreate(os, = {}) params = .merge( command: 'server_recreate', id: server_id, os: os ) get('/json.php', params) end |
#reset_password(options = {}) ⇒ Object
Send command to reset server password.
options - The Hash options (default: {}):
:new_password - The String of new server
password (min: 8, max: 64).
Returns the Integer of task id.
92 93 94 95 96 |
# File 'lib/ivapi/client/server.rb', line 92 def reset_password( = {}) params = .merge(command: 'server_reset_password', id: server_id) get('/json.php', params) end |
#tasks(count, options = {}) ⇒ Object
Get server tasks.
count - The Integer number of results count (max: 1000). options - The Hash options (default: {}):
:task - The String of task name (optional).
:task_id - The Integer of task id (optional).
Returns the Hash of server tasks.
28 29 30 31 32 33 34 |
# File 'lib/ivapi/client/server.rb', line 28 def tasks(count, = {}) params = .merge( command: 'server_tasks', id: server_id, count: count ) get('/json.php', params) end |