class Ivapi::Client::Server

Attributes

server_id[R]

Public Class Methods

new(client, server_id) click to toggle source
Calls superclass method Ivapi::Client::Base::new
# File lib/ivapi/client/server.rb, line 8
def initialize(client, server_id)
  super(client)
  @server_id = server_id
end

Public Instance Methods

change(options = {}) click to toggle source

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.

# File lib/ivapi/client/server.rb, line 166
def change(options = {})
  params = options.merge(command: 'server_change', id: server_id)
  get('/json.php', params)
end
domain(domain) click to toggle source

Send command to change server hostname.

domain - The String of new server hostname.

Returns the Integer of task id.

# 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
Also aliased as: hostname
firewall(options = {}) click to toggle source

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.

# File lib/ivapi/client/server.rb, line 123
def firewall(options = {})
  params = options.merge(command: 'server_firewall', id: server_id)
  get('/json.php', params)
end
flush_iptables() click to toggle source

Send command to clean server firewall rules.

Returns the Integer of task id.

# 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) click to toggle source

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.

# 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
hostname(domain)
Alias for: domain
info()
Alias for: information
information() click to toggle source

Get information about server.

Returns the Hash of server information.

# File lib/ivapi/client/server.rb, line 16
def information
  params = { command: 'server_info', id: server_id }
  get('/json.php', params)
end
Also aliased as: info
move_ip(server_ip, target_id) click to toggle source

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.

# 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() click to toggle source

Get all available server operating systems.

Returns the Hash of available server os.

# File lib/ivapi/client/server.rb, line 58
def os
  params = { command: 'server_os', id: server_id }
  get('/json.php', params)
end
ptr(options = {}) click to toggle source

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.

# File lib/ivapi/client/server.rb, line 135
def ptr(options = {})
  params = options.merge(command: 'server_ptr', id: server_id)
  get('/json.php', params)
end
reboot() click to toggle source

Send command to reboot the server.

Returns the Integer of task id.

# 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 = {}) click to toggle source

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.

# File lib/ivapi/client/server.rb, line 79
def recreate(server_os, options = {})
  params = options.merge(
    command: 'server_recreate', id: server_id, os: server_os
  )

  get('/json.php', params)
end
reset_password(options = {}) click to toggle source

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.

# File lib/ivapi/client/server.rb, line 94
def reset_password(options = {})
  params = options.merge(command: 'server_reset_password', id: server_id)

  get('/json.php', params)
end
tasks(count, options = {}) click to toggle source

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.

# File lib/ivapi/client/server.rb, line 30
def tasks(count, options = {})
  params = options.merge(
    command: 'server_tasks', id: server_id, count: count
  )

  get('/json.php', params)
end