Project

cpanel

0.01
No release in over 3 years
Low commit activity in last 3 years
cPanel connection wrapper for Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

cpanel¶ ↑

<img src=“https://badges.gitter.im/Join%20Chat.svg” alt=“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 © 2010 Josh Delsman. See LICENSE for details.