Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Latest commit

 

History

History
45 lines (32 loc) · 926 Bytes

README.md

File metadata and controls

45 lines (32 loc) · 926 Bytes

Plesk for Ruby

A library to help with accessing the Plesk API.

Installation

Add the gem to your Gemfile.

gem 'plesk-ruby', '~> 1.0', :require => 'plesk'

Usage

require 'plesk'

client = Plesk::Client.new('mypleskhost.atech.io', 'admin', 'password')

# If you're not running port 8443
client.options[:port] = 8123

# If you don't want to verify the SSL certificate
client.options[:verify_ssl] = false

# Make a request
xml = client.request('customer', 'get') do
  filter do
    id 1
  end

  dataset do
    gen_info
    stat
  end
end

# Do something with the result
puts xml.xpath('//result/data/gen_info/pname').first&.content

# Catch errrors by rescuing the following exceptions
Plesk::Client::Error              #=> All errors
Plesk::Client::RequestError       #=> Request errors (parser errors etc...)
Plesk::Client::ActionError        #=> Action errors (resource not found etc...)