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, server_ip) ⇒ Object
Get server graphs.
-
#information ⇒ Object
(also: #info)
Get information about server.
-
#initialize(client, server_id) ⇒ Server
constructor
A new instance of Server.
-
#move_ip(server_ip, target_id) ⇒ Object
Moves additional IP to another server.
-
#os ⇒ Object
Get all available server operating systems.
-
#ptr(options = {}) ⇒ Object
Reverse PTR record change for additional IP.
-
#reboot ⇒ Object
Send command to reboot the server.
-
#recreate(server_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.
8 9 10 11 |
# File 'lib/ivapi/client/server.rb', line 8 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.
6 7 8 |
# File 'lib/ivapi/client/server.rb', line 6 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.
166 167 168 169 |
# File 'lib/ivapi/client/server.rb', line 166 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.
176 177 178 179 |
# File 'lib/ivapi/client/server.rb', line 176 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.
123 124 125 126 |
# File 'lib/ivapi/client/server.rb', line 123 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.
103 104 105 106 |
# File 'lib/ivapi/client/server.rb', line 103 def flush_iptables params = { command: 'server_flush_iptables', id: server_id } get('/json.php', params) end |
#graphs(width, server_ip) ⇒ Object
Get server graphs.
width - The Integer of graphs width (max: 1000, optimal: 768). server_ip - The String of ip, from which graphs can be viewed.
Returns the Hash of server graphs.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/ivapi/client/server.rb', line 44 def graphs(width, server_ip) params = { command: 'server_graphs', id: server_id, width: width, ip: server_ip } get('/json.php', params) end |
#information ⇒ Object Also known as: info
Get information about server.
Returns the Hash of server information.
16 17 18 19 |
# File 'lib/ivapi/client/server.rb', line 16 def information params = { command: 'server_info', id: server_id } get('/json.php', params) end |
#move_ip(server_ip, target_id) ⇒ Object
Moves additional IP to another server.
server_ip - The String of additional IP. target_id - The String of another server id.
Returns the Hash with information.
146 147 148 149 150 151 152 153 154 155 |
# File 'lib/ivapi/client/server.rb', line 146 def move_ip(server_ip, target_id) params = { command: 'server_move_ip', id: server_id, ip: server_ip, target_id: target_id } get('/json.php', params) end |
#os ⇒ Object
Get all available server operating systems.
Returns the Hash of available server os.
58 59 60 61 |
# File 'lib/ivapi/client/server.rb', line 58 def os params = { command: 'server_os', id: server_id } get('/json.php', params) end |
#ptr(options = {}) ⇒ Object
Reverse PTR record change for additional IP.
options - The Hash options (default: {}):
:ip - The String of additional IP.
:domain - The String of reverse PTR.
Returns the Hash of new ptr info.
135 136 137 138 |
# File 'lib/ivapi/client/server.rb', line 135 def ptr( = {}) params = .merge(command: 'server_ptr', id: server_id) get('/json.php', params) end |
#reboot ⇒ Object
Send command to reboot the server.
Returns the Integer of task id.
66 67 68 69 |
# File 'lib/ivapi/client/server.rb', line 66 def reboot params = { command: 'server_reboot', id: server_id } get('/json.php', params) end |
#recreate(server_os, options = {}) ⇒ Object
Send command to recreate the server.
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.
79 80 81 82 83 84 85 |
# File 'lib/ivapi/client/server.rb', line 79 def recreate(server_os, = {}) params = .merge( command: 'server_recreate', id: server_id, os: server_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.
94 95 96 97 98 |
# File 'lib/ivapi/client/server.rb', line 94 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.
30 31 32 33 34 35 36 |
# File 'lib/ivapi/client/server.rb', line 30 def tasks(count, = {}) params = .merge( command: 'server_tasks', id: server_id, count: count ) get('/json.php', params) end |