Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
cPanel connection wrapper for Ruby
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.document
.gitignore
Gemfile
Gemfile.lock
LICENSE
README.rdoc
Rakefile
VERSION
cpanel.gemspec

README.rdoc

cpanel

Join the chat at
https://gitter.im/voxxit/cpanel

cPanel connection wrapper for Ruby.

Example Usage

You will first need to build the basic class for the remote server calls you wish to implement. I wrote the plugin to be extremely barebones, so you could implement what you deemed necessary to stay lean:

require 'cpanel'

class CpanelServer  
  attr_reader :server

  def initialize(url, key, user = 'root')    
    @server = Cpanel::Server.new({
      :url => url,
      :key => key,
      :user => user
    })
  end

  def change_password(user, new_password)
    server.request("passwd", {
      :user => user,
      :pass => new_password
    })
  end
end

server = CpanelServer.new("https://server.com:2086", "API_KEY_HERE")
server.change_password("myuser12", "s3cur3p@55")

All API calls can be performed using JSON or XML. You can set this in the initialization, if you'd like:

def initialize(url, key, connection_type = "json")
  @server = Cpanel::Server.new({
    :url => url,
    :key => key,
    :api => connection_type
  })
end

For a list of current API commands, go here:

docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/XmlApi

Bug/feature requests

Please insert all bug and feature requests into the GitHub Issues tracker:

github.com/voxxit/cpanel/issues

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. If you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright © 2010 Josh Delsman. See LICENSE for details.

Something went wrong with that request. Please try again.