lumberg 1.0.1 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +1 -1
- data/README.md +184 -70
- data/Rakefile +3 -1
- data/lib/lumberg/config.rb +19 -0
- data/lib/lumberg/cpanel/addon_domain.rb +50 -0
- data/lib/lumberg/cpanel/backups.rb +16 -0
- data/lib/lumberg/cpanel/base.rb +56 -0
- data/lib/lumberg/cpanel/box_trapper.rb +18 -0
- data/lib/lumberg/cpanel/branding.rb +89 -0
- data/lib/lumberg/cpanel/contact.rb +38 -0
- data/lib/lumberg/cpanel/cron.rb +89 -0
- data/lib/lumberg/cpanel/dns_lookup.rb +23 -0
- data/lib/lumberg/cpanel/domain_keys.rb +37 -0
- data/lib/lumberg/cpanel/domain_lookup.rb +71 -0
- data/lib/lumberg/cpanel/email.rb +522 -0
- data/lib/lumberg/cpanel/file_manager.rb +146 -0
- data/lib/lumberg/cpanel/ftp.rb +101 -0
- data/lib/lumberg/cpanel/gpg.rb +36 -0
- data/lib/lumberg/cpanel/locale.rb +15 -0
- data/lib/lumberg/cpanel/mime.rb +34 -0
- data/lib/lumberg/cpanel/mysql.rb +66 -0
- data/lib/lumberg/cpanel/mysql_db.rb +190 -0
- data/lib/lumberg/cpanel/net.rb +28 -0
- data/lib/lumberg/cpanel/park.rb +58 -0
- data/lib/lumberg/cpanel/password.rb +52 -0
- data/lib/lumberg/cpanel/password_strength.rb +63 -0
- data/lib/lumberg/cpanel/random_data.rb +25 -0
- data/lib/lumberg/cpanel/redirect.rb +44 -0
- data/lib/lumberg/cpanel/ssl.rb +220 -0
- data/lib/lumberg/cpanel/sub_domain.rb +61 -0
- data/lib/lumberg/cpanel/support.rb +29 -0
- data/lib/lumberg/cpanel/zone_edit.rb +134 -0
- data/lib/lumberg/cpanel.rb +32 -0
- data/lib/lumberg/format_whm.rb +162 -0
- data/lib/lumberg/version.rb +1 -1
- data/lib/lumberg/whm/account.rb +29 -106
- data/lib/lumberg/whm/base.rb +3 -7
- data/lib/lumberg/whm/cert.rb +88 -0
- data/lib/lumberg/whm/dns.rb +49 -77
- data/lib/lumberg/whm/reseller.rb +25 -118
- data/lib/lumberg/whm/server.rb +163 -222
- data/lib/lumberg/whm/transfer_tool.rb +165 -0
- data/lib/lumberg/whm.rb +11 -9
- data/lib/lumberg/whostmgr/base.rb +13 -0
- data/lib/lumberg/whostmgr/ssl.rb +57 -0
- data/lib/lumberg/whostmgr.rb +6 -0
- data/lib/lumberg.rb +35 -8
- data/spec/config_spec.rb +28 -0
- data/spec/cpanel/addon_domain_spec.rb +84 -0
- data/spec/cpanel/backups_spec.rb +22 -0
- data/spec/cpanel/base_spec.rb +128 -0
- data/spec/cpanel/box_trapper_spec.rb +22 -0
- data/spec/cpanel/branding_spec.rb +46 -0
- data/spec/cpanel/contact_spec.rb +50 -0
- data/spec/cpanel/cron_spec.rb +161 -0
- data/spec/cpanel/dns_lookup_spec.rb +22 -0
- data/spec/cpanel/domain_keys_spec.rb +46 -0
- data/spec/cpanel/domain_lookup_spec.rb +77 -0
- data/spec/cpanel/email_spec.rb +639 -0
- data/spec/cpanel/file_manager_spec.rb +73 -0
- data/spec/cpanel/ftp_spec.rb +71 -0
- data/spec/cpanel/gpg_spec.rb +48 -0
- data/spec/cpanel/locale_spec.rb +23 -0
- data/spec/cpanel/mime_spec.rb +0 -0
- data/spec/cpanel/mysql_db_spec.rb +119 -0
- data/spec/cpanel/mysql_spec.rb +0 -0
- data/spec/cpanel/net_spec.rb +30 -0
- data/spec/cpanel/park_spec.rb +94 -0
- data/spec/cpanel/password_spec.rb +35 -0
- data/spec/cpanel/password_strength_spec.rb +50 -0
- data/spec/cpanel/random_data_spec.rb +24 -0
- data/spec/cpanel/redirect_spec.rb +0 -0
- data/spec/cpanel/ssl_spec.rb +158 -0
- data/spec/cpanel/sub_domain_spec.rb +72 -0
- data/spec/cpanel/support_spec.rb +38 -0
- data/spec/cpanel/zone_edit_spec.rb +0 -0
- data/spec/format_whm_spec.rb +53 -0
- data/spec/sample_certs/cpanel.crt +28 -0
- data/spec/sample_certs/cpanel.key +28 -0
- data/spec/sample_certs/main.crt +27 -0
- data/spec/sample_certs/sample.crt +26 -0
- data/spec/sample_certs/sample.key +27 -0
- data/spec/spec_helper.rb +10 -3
- data/spec/support/cpanel_matchers.rb +17 -0
- data/spec/vcr_cassettes/cpanel/addon_domain/add.yml +77 -0
- data/spec/vcr_cassettes/cpanel/addon_domain/list.yml +77 -0
- data/spec/vcr_cassettes/cpanel/addon_domain/remove.yml +77 -0
- data/spec/vcr_cassettes/cpanel/backups/list.yml +40 -0
- data/spec/vcr_cassettes/cpanel/box_trapper/list.yml +40 -0
- data/spec/vcr_cassettes/cpanel/branding/list_icons.yml +40 -0
- data/spec/vcr_cassettes/cpanel/branding/list_image_types.yml +40 -0
- data/spec/vcr_cassettes/cpanel/branding/list_object_types.yml +40 -0
- data/spec/vcr_cassettes/cpanel/branding/list_pkgs.yml +40 -0
- data/spec/vcr_cassettes/cpanel/branding/list_sprites.yml +40 -0
- data/spec/vcr_cassettes/cpanel/contact/show.yml +40 -0
- data/spec/vcr_cassettes/cpanel/contact/update.yml +40 -0
- data/spec/vcr_cassettes/cpanel/cron/add.yml +77 -0
- data/spec/vcr_cassettes/cpanel/cron/edit.yml +114 -0
- data/spec/vcr_cassettes/cpanel/cron/email.yml +77 -0
- data/spec/vcr_cassettes/cpanel/cron/list.yml +77 -0
- data/spec/vcr_cassettes/cpanel/cron/remove.yml +151 -0
- data/spec/vcr_cassettes/cpanel/cron/set_email.yml +77 -0
- data/spec/vcr_cassettes/cpanel/dns_lookup/name_to_ip.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_keys/add.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_keys/available.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_keys/installed.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_keys/remove.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_lookup/count.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_lookup/docroot.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_lookup/docroots.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_lookup/document_root.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_lookup/document_roots.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_lookup/list.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/acceptable_encodings.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/accounts.yml +188 -0
- data/spec/vcr_cassettes/cpanel/email/add_account.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/add_filter.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/add_forwarder.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/add_mailing_list.yml +73 -0
- data/spec/vcr_cassettes/cpanel/email/add_mx.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/change_mx.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/change_password.yml +43 -0
- data/spec/vcr_cassettes/cpanel/email/check_local_delivery_local.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/check_local_delivery_remote.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/default_address.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/delete_mx.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/disk_usage.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/domains.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/domains_with_aliases.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/edit_quota.yml +112 -0
- data/spec/vcr_cassettes/cpanel/email/filters.yml +114 -0
- data/spec/vcr_cassettes/cpanel/email/forwarders.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/mail_dir.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/mail_dirs.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/mailing_lists.yml +73 -0
- data/spec/vcr_cassettes/cpanel/email/main_discard.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/mx.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/remove.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/set_default_address.yml +43 -0
- data/spec/vcr_cassettes/cpanel/email/set_mail_delivery_local.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/set_mail_delivery_remote.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/set_mx_type.yml +40 -0
- data/spec/vcr_cassettes/cpanel/file_manager/disk_usage.yml +38 -0
- data/spec/vcr_cassettes/cpanel/file_manager/list.yml +38 -0
- data/spec/vcr_cassettes/cpanel/file_manager/operate.yml +77 -0
- data/spec/vcr_cassettes/cpanel/file_manager/show.yml +40 -0
- data/spec/vcr_cassettes/cpanel/file_manager/stat.yml +38 -0
- data/spec/vcr_cassettes/cpanel/ftp/addftp.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/delftp.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/listftp.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/listftpsessions.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/listftpwithdisk.yml +95 -0
- data/spec/vcr_cassettes/cpanel/ftp/passwd.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/setquota.yml +43 -0
- data/spec/vcr_cassettes/cpanel/gpg/count.yml +40 -0
- data/spec/vcr_cassettes/cpanel/gpg/count_private.yml +40 -0
- data/spec/vcr_cassettes/cpanel/gpg/list.yml +40 -0
- data/spec/vcr_cassettes/cpanel/gpg/list_private.yml +40 -0
- data/spec/vcr_cassettes/cpanel/locale/show.yml +40 -0
- data/spec/vcr_cassettes/cpanel/mysql_db/add_db.yml +42 -0
- data/spec/vcr_cassettes/cpanel/mysql_db/add_host.yml +42 -0
- data/spec/vcr_cassettes/cpanel/mysql_db/add_user.yml +42 -0
- data/spec/vcr_cassettes/cpanel/mysql_db/add_user_db.yml +42 -0
- data/spec/vcr_cassettes/cpanel/mysql_db/check_db.yml +42 -0
- data/spec/vcr_cassettes/cpanel/mysql_db/del_db.yml +42 -0
- data/spec/vcr_cassettes/cpanel/mysql_db/del_host.yml +42 -0
- data/spec/vcr_cassettes/cpanel/mysql_db/del_user.yml +42 -0
- data/spec/vcr_cassettes/cpanel/mysql_db/del_user_db.yml +42 -0
- data/spec/vcr_cassettes/cpanel/mysql_db/init_cache.yml +42 -0
- data/spec/vcr_cassettes/cpanel/mysql_db/number_of_dbs.yml +42 -0
- data/spec/vcr_cassettes/cpanel/mysql_db/repair_db.yml +42 -0
- data/spec/vcr_cassettes/cpanel/mysql_db/update_privs.yml +42 -0
- data/spec/vcr_cassettes/cpanel/net/query_hostname.yml +40 -0
- data/spec/vcr_cassettes/cpanel/net/traceroute.yml +40 -0
- data/spec/vcr_cassettes/cpanel/park/add.yml +77 -0
- data/spec/vcr_cassettes/cpanel/park/list.yml +77 -0
- data/spec/vcr_cassettes/cpanel/park/list_addon_domains.yml +77 -0
- data/spec/vcr_cassettes/cpanel/park/remove.yml +77 -0
- data/spec/vcr_cassettes/cpanel/password/digest_authentication.yml +77 -0
- data/spec/vcr_cassettes/cpanel/password/modify.yml +77 -0
- data/spec/vcr_cassettes/cpanel/password_strength/all_required_strengths.yml +43 -0
- data/spec/vcr_cassettes/cpanel/password_strength/required_strength.yml +43 -0
- data/spec/vcr_cassettes/cpanel/password_strength/strength.yml +83 -0
- data/spec/vcr_cassettes/cpanel/random_data/show.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/fetchcabundle.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/gencrt.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ssl/gencsr.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ssl/genkey.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/installssl.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/listcrts.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/listcsrs.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/listkeys.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/listsslitems.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/remove.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ssl/showcrt.yml +38 -0
- data/spec/vcr_cassettes/cpanel/ssl/showcsr.yml +38 -0
- data/spec/vcr_cassettes/cpanel/ssl/showkey.yml +38 -0
- data/spec/vcr_cassettes/cpanel/ssl/uploadcrt.yml +40 -0
- data/spec/vcr_cassettes/cpanel/sub_domain/add.yml +77 -0
- data/spec/vcr_cassettes/cpanel/sub_domain/list.yml +77 -0
- data/spec/vcr_cassettes/cpanel/sub_domain/remove.yml +77 -0
- data/spec/vcr_cassettes/cpanel/support/contactable.yml +40 -0
- data/spec/vcr_cassettes/whm/account/accountsummary.yml +41 -29
- data/spec/vcr_cassettes/whm/account/changepackage.yml +73 -43
- data/spec/vcr_cassettes/whm/account/createacct.yml +101 -31
- data/spec/vcr_cassettes/whm/account/domainuserdata.yml +43 -29
- data/spec/vcr_cassettes/whm/account/editquota.yml +78 -57
- data/spec/vcr_cassettes/whm/account/limitbw.yml +79 -57
- data/spec/vcr_cassettes/whm/account/listaccts.yml +195 -100
- data/spec/vcr_cassettes/whm/account/listsuspended.yml +41 -29
- data/spec/vcr_cassettes/whm/account/modifyacct.yml +61 -42
- data/spec/vcr_cassettes/whm/account/myprivs.yml +41 -29
- data/spec/vcr_cassettes/whm/account/passwd.yml +44 -29
- data/spec/vcr_cassettes/whm/account/removeacct.yml +134 -57
- data/spec/vcr_cassettes/whm/account/restoreaccount.yml +310 -135
- data/spec/vcr_cassettes/whm/account/setsiteip.yml +166 -127
- data/spec/vcr_cassettes/whm/account/suspend.yml +75 -43
- data/spec/vcr_cassettes/whm/account/unsuspend.yml +46 -29
- data/spec/vcr_cassettes/whm/cert/fetch_ssl_vhosts.yml +44 -0
- data/spec/vcr_cassettes/whm/cert/fetchsslinfo.yml +38 -0
- data/spec/vcr_cassettes/whm/cert/generatessl.yml +94 -0
- data/spec/vcr_cassettes/whm/cert/installssl.yml +38 -0
- data/spec/vcr_cassettes/whm/cert/listcrts.yml +38 -0
- data/spec/vcr_cassettes/whm/dns/adddns.yml +61 -43
- data/spec/vcr_cassettes/whm/dns/addzonerecord.yml +42 -29
- data/spec/vcr_cassettes/whm/dns/dumpzone.yml +44 -29
- data/spec/vcr_cassettes/whm/dns/editzonerecord.yml +61 -43
- data/spec/vcr_cassettes/whm/dns/getzonerecord.yml +60 -43
- data/spec/vcr_cassettes/whm/dns/killdns.yml +42 -29
- data/spec/vcr_cassettes/whm/dns/listmxs.yml +23 -15
- data/spec/vcr_cassettes/whm/dns/listzones.yml +22 -15
- data/spec/vcr_cassettes/whm/dns/lookupnsip.yml +40 -29
- data/spec/vcr_cassettes/whm/dns/removezonerecord.yml +61 -43
- data/spec/vcr_cassettes/whm/dns/resetzone.yml +42 -29
- data/spec/vcr_cassettes/whm/dns/resolvedomainname.yml +40 -29
- data/spec/vcr_cassettes/whm/dns/savemxs.yml +23 -15
- data/spec/vcr_cassettes/whm/reseller/acctcounts.yml +41 -29
- data/spec/vcr_cassettes/whm/reseller/listacls.yml +22 -15
- data/spec/vcr_cassettes/whm/reseller/listresellers.yml +22 -15
- data/spec/vcr_cassettes/whm/reseller/resellerstats.yml +42 -29
- data/spec/vcr_cassettes/whm/reseller/saveacllist.yml +76 -57
- data/spec/vcr_cassettes/whm/reseller/setacls.yml +40 -29
- data/spec/vcr_cassettes/whm/reseller/setresellerips.yml +42 -28
- data/spec/vcr_cassettes/whm/reseller/setresellerlimits.yml +41 -29
- data/spec/vcr_cassettes/whm/reseller/setresellermainip.yml +59 -43
- data/spec/vcr_cassettes/whm/reseller/setresellernameservers.yml +58 -43
- data/spec/vcr_cassettes/whm/reseller/setresellerpackagelimit.yml +61 -43
- data/spec/vcr_cassettes/whm/reseller/setupreseller.yml +41 -29
- data/spec/vcr_cassettes/whm/reseller/suspendreseller.yml +75 -44
- data/spec/vcr_cassettes/whm/reseller/terminatereseller.yml +83 -46
- data/spec/vcr_cassettes/whm/reseller/unsetupreseller.yml +41 -29
- data/spec/vcr_cassettes/whm/reseller/unsuspendreseller.yml +46 -29
- data/spec/vcr_cassettes/whm/server/addip.yml +24 -15
- data/spec/vcr_cassettes/whm/server/applist.yml +22 -15
- data/spec/vcr_cassettes/whm/server/delip.yml +23 -15
- data/spec/vcr_cassettes/whm/server/disk_usage.yml +45 -0
- data/spec/vcr_cassettes/whm/server/edit_hook.yml +44 -0
- data/spec/vcr_cassettes/whm/server/gethostname.yml +22 -15
- data/spec/vcr_cassettes/whm/server/getlanglist.yml +22 -15
- data/spec/vcr_cassettes/whm/server/gettweaksetting.yml +44 -0
- data/spec/vcr_cassettes/whm/server/list_hooks.yml +44 -0
- data/spec/vcr_cassettes/whm/server/listips.yml +22 -15
- data/spec/vcr_cassettes/whm/server/loadavg.yml +26 -19
- data/spec/vcr_cassettes/whm/server/lookup_nameserver_ip.yml +44 -0
- data/spec/vcr_cassettes/whm/server/my_function.yml +59 -43
- data/spec/vcr_cassettes/whm/server/nvget.yml +22 -15
- data/spec/vcr_cassettes/whm/server/nvset.yml +22 -15
- data/spec/vcr_cassettes/whm/server/reboot.yml +22 -15
- data/spec/vcr_cassettes/whm/server/sethostname.yml +24 -15
- data/spec/vcr_cassettes/whm/server/setresolvers.yml +23 -15
- data/spec/vcr_cassettes/whm/server/settweaksetting.yml +44 -0
- data/spec/vcr_cassettes/whm/server/showbw.yml +22 -15
- data/spec/vcr_cassettes/whm/server/systemloadavg.yml +40 -29
- data/spec/vcr_cassettes/whm/server/themes.yml +38 -0
- data/spec/vcr_cassettes/whm/server/version.yml +22 -15
- data/spec/vcr_cassettes/whm/transfer_tool/check.yml +44 -0
- data/spec/vcr_cassettes/whm/transfer_tool/create.yml +72 -0
- data/spec/vcr_cassettes/whm/transfer_tool/enqueue.yml +44 -0
- data/spec/vcr_cassettes/whm/transfer_tool/pause.yml +44 -0
- data/spec/vcr_cassettes/whm/transfer_tool/show_log.yml +44 -0
- data/spec/vcr_cassettes/whm/transfer_tool/start.yml +44 -0
- data/spec/vcr_cassettes/whm/transfer_tool/status.yml +44 -0
- data/spec/vcr_cassettes/whm/transfer_tool/validate_user.yml +44 -0
- data/spec/vcr_cassettes/whostmgr/ssl/create.yml +219 -0
- data/spec/vcr_cassettes/whostmgr/ssl/remove.yml +172 -0
- data/spec/vcr_cassettes/whostmgr/ssl/remove_data.yml +179 -0
- data/spec/whm/account_spec.rb +90 -249
- data/spec/whm/base_spec.rb +3 -7
- data/spec/whm/cert_spec.rb +110 -0
- data/spec/whm/dns_spec.rb +37 -155
- data/spec/whm/reseller_spec.rb +46 -114
- data/spec/whm/server_spec.rb +142 -156
- data/spec/whm/transfer_tool_spec.rb +172 -0
- data/spec/whm/whm_spec.rb +8 -8
- data/spec/whostmgr/ssl_spec.rb +55 -0
- metadata +528 -108
- data/.gitignore +0 -10
- data/.rspec +0 -2
- data/.rvmrc +0 -49
- data/.travis.yml +0 -11
- data/lib/lumberg/whm/args.rb +0 -113
- data/lib/net_http_hacked.rb +0 -42
- data/lumberg.gemspec +0 -28
- data/spec/vcr_cassettes/whm/server/response_type.yml +0 -85
- data/spec/whm/args_spec.rb +0 -179
@@ -0,0 +1,101 @@
|
|
1
|
+
module Lumberg
|
2
|
+
module Cpanel
|
3
|
+
class Ftp < Base
|
4
|
+
def self.api_module; "Ftp"; end
|
5
|
+
|
6
|
+
# Public: List FTP accounts associated with the authenticated user's account
|
7
|
+
#
|
8
|
+
# options - Hash options for API call params (default: {}):
|
9
|
+
# :include_acct_types - specify which FTP account types to include
|
10
|
+
# :skip_acct_types - specify which FTP account types to exclude
|
11
|
+
#
|
12
|
+
# Returns Hash API response.
|
13
|
+
def list_ftp(options = {})
|
14
|
+
perform_request({
|
15
|
+
api_function: "listftp"
|
16
|
+
}.merge(options))
|
17
|
+
end
|
18
|
+
|
19
|
+
# Public: Retrieve a list of FTP sessions associated with the account
|
20
|
+
#
|
21
|
+
# Returns Hash API response.
|
22
|
+
def list_ftp_sessions(options = {})
|
23
|
+
perform_request({
|
24
|
+
api_function: "listftpsessions"
|
25
|
+
}.merge(options))
|
26
|
+
end
|
27
|
+
|
28
|
+
# Public: Generate a list of FTP accounts associated with a cPanel account
|
29
|
+
# The list will contain each account's disk information
|
30
|
+
#
|
31
|
+
# options - Hash options for API call params (default: {}):
|
32
|
+
# :dirhtml - prepend the 'dir' return variable with a URL
|
33
|
+
# :include_acct_types - specify which FTP account types to include
|
34
|
+
# :skip_acct_types - specify which FTP account types to exclude
|
35
|
+
#
|
36
|
+
# Returns Hash API response.
|
37
|
+
def list_ftp_with_disk(options = {})
|
38
|
+
perform_request({
|
39
|
+
api_function: "listftpwithdisk"
|
40
|
+
}.merge(options))
|
41
|
+
end
|
42
|
+
|
43
|
+
# Public: Change an FTP account's password
|
44
|
+
#
|
45
|
+
# options - Hash options for API call params (default: {}):
|
46
|
+
# :user - The username portion of the FTP account
|
47
|
+
# :pass - The new password for the FTP account
|
48
|
+
#
|
49
|
+
# Returns Hash API response.
|
50
|
+
def passwd(options = {})
|
51
|
+
perform_request({
|
52
|
+
api_function: "passwd"
|
53
|
+
}.merge(options))
|
54
|
+
end
|
55
|
+
|
56
|
+
# Public: Add a new FTP account
|
57
|
+
#
|
58
|
+
# options - Hash options for API call params (default: {}):
|
59
|
+
# :user - The username portion of the new FTP account, without the domain
|
60
|
+
# :pass - The password for the new FTP account
|
61
|
+
# :quota - The new FTP account's quota. The default, 0, indicates that
|
62
|
+
# the account will not use a quota.
|
63
|
+
# :homedir - The path to the FTP account's root directory. This value
|
64
|
+
# should be relative to the account's home directory
|
65
|
+
#
|
66
|
+
# Returns Hash API response.
|
67
|
+
def add_ftp(options = {})
|
68
|
+
perform_request({
|
69
|
+
api_function: "addftp"
|
70
|
+
}.merge(options))
|
71
|
+
end
|
72
|
+
|
73
|
+
# Public: Change an FTP account's quota
|
74
|
+
#
|
75
|
+
# options - Hash options for API call params (default: {}):
|
76
|
+
# :user - The username portion of the FTP account
|
77
|
+
# :quota - The new quota (in megabytes) for the FTP account
|
78
|
+
#
|
79
|
+
# Returns Hash API response.
|
80
|
+
def set_quota(options = {})
|
81
|
+
perform_request({
|
82
|
+
api_function: "setquota"
|
83
|
+
}.merge(options))
|
84
|
+
end
|
85
|
+
|
86
|
+
# Public: Delete an FTP account
|
87
|
+
#
|
88
|
+
# options - Hash options for API call params (default: {}):
|
89
|
+
# :user - The name of the account to be removed
|
90
|
+
# :destroy - A boolean value that indicates whether or not the FTP account's
|
91
|
+
# home directory should also be deleted
|
92
|
+
#
|
93
|
+
# Returns Hash API response.
|
94
|
+
def del_ftp(options = {})
|
95
|
+
perform_request({
|
96
|
+
api_function: "delftp"
|
97
|
+
}.merge(options))
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Lumberg
|
2
|
+
module Cpanel
|
3
|
+
# Public: Allows users to create and manage GnuPG keys
|
4
|
+
class Gpg < Base
|
5
|
+
# Public: List public GPG keys installed for the user
|
6
|
+
#
|
7
|
+
# Returns Hash API response
|
8
|
+
def list
|
9
|
+
perform_request({ api_function: 'listgpgkeys' })
|
10
|
+
end
|
11
|
+
|
12
|
+
# Public: Count the number of public GPG keys installed for a user. You
|
13
|
+
# must have access to the 'gpg' feature to use this function.
|
14
|
+
#
|
15
|
+
# Returns Hash API response
|
16
|
+
def count
|
17
|
+
perform_request({ api_function: 'number_of_public_keys' })
|
18
|
+
end
|
19
|
+
|
20
|
+
# Public: List GPG private (secret) keys associated with a user
|
21
|
+
#
|
22
|
+
# Returns Hash API response
|
23
|
+
def list_private
|
24
|
+
perform_request({ api_function: 'listsecretgpgkeys' })
|
25
|
+
end
|
26
|
+
|
27
|
+
# Public: Count the number of private GPG keys installed for a user
|
28
|
+
#
|
29
|
+
# Returns Hash API response
|
30
|
+
def count_private
|
31
|
+
perform_request({ api_function: 'number_of_private_keys' })
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Lumberg
|
2
|
+
module Cpanel
|
3
|
+
# Public: Allows access into cPanel's language system
|
4
|
+
class Locale < Base
|
5
|
+
# Public: Retrieve a user's character set encoding
|
6
|
+
#
|
7
|
+
# Returns Hash API response
|
8
|
+
def show
|
9
|
+
perform_request({ api_function: 'get_encoding' })
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Lumberg
|
2
|
+
module Cpanel
|
3
|
+
# Public: Allows users to list mime types and handlers
|
4
|
+
class Mime < Base
|
5
|
+
# Public: List mime types associated with Apache
|
6
|
+
#
|
7
|
+
# options - Hash options for API call params (default: {})
|
8
|
+
# :system - String parameter allows you to specify whether or not to
|
9
|
+
# only return system wide mime types (default: '')
|
10
|
+
# :user - String parameter allows you to specify whether or not to
|
11
|
+
# only return user defined mime types (default: '')
|
12
|
+
#
|
13
|
+
# Returns Hash API response
|
14
|
+
def list(options = {})
|
15
|
+
perform_request({ api_function: 'listmime' }.merge(options))
|
16
|
+
end
|
17
|
+
|
18
|
+
# Public: List handlers associated with Apache
|
19
|
+
#
|
20
|
+
# options - Hash options for API call params (default: {})
|
21
|
+
# :system - String parameter allows you to specify whether or not to
|
22
|
+
# only return system wide handlers (default: '')
|
23
|
+
# :user - String parameter allows you to specify whether or not to
|
24
|
+
# only return user defined handlers (default: '')
|
25
|
+
#
|
26
|
+
# Returns Hash API response
|
27
|
+
def handlers(options = {})
|
28
|
+
perform_request({ api_function: 'listhandlers' }.merge(options))
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Lumberg
|
2
|
+
module Cpanel
|
3
|
+
# Public: Allows you to access information about an account's MySQL users,
|
4
|
+
# databases, and permissions
|
5
|
+
class Mysql < Base
|
6
|
+
def self.api_module; "MysqlFE"; end
|
7
|
+
# Public: Retrieve a list of databases that belong to username
|
8
|
+
#
|
9
|
+
# options - Hash options for API call params (default: {})
|
10
|
+
# :regex - String regular expression to filter results (optional)
|
11
|
+
#
|
12
|
+
# Returns Hash API response
|
13
|
+
def list(options = {})
|
14
|
+
perform_request({ api_function: 'listdbs' }.merge(options))
|
15
|
+
end
|
16
|
+
|
17
|
+
# Public: List all of the MySQL users available to a cPanel account
|
18
|
+
#
|
19
|
+
# Returns Hash API response
|
20
|
+
def accounts
|
21
|
+
perform_request({ api_function: 'listusers' })
|
22
|
+
end
|
23
|
+
|
24
|
+
# Public: Retrieve a list of remote MySQL connection hosts
|
25
|
+
#
|
26
|
+
# Returns Hash API response
|
27
|
+
def remote_hosts
|
28
|
+
perform_request({ api_function: 'listhosts' })
|
29
|
+
end
|
30
|
+
|
31
|
+
# Public: Retrieve a list of existing database backups
|
32
|
+
#
|
33
|
+
# Returns Hash API response
|
34
|
+
def backups
|
35
|
+
perform_request({ api_function: 'listdbsbackup' })
|
36
|
+
end
|
37
|
+
|
38
|
+
# Public: List users who can access a particular database
|
39
|
+
#
|
40
|
+
# options - Hash options for API call params (default: {})
|
41
|
+
# :db - String name of the database whose users you wish to review. Be
|
42
|
+
# sure to use Cpanel convention's full mysql database name, e.g:
|
43
|
+
# cpanelaccount_databasename
|
44
|
+
#
|
45
|
+
# Returns Hash API response
|
46
|
+
def usernames_for_db(options = {})
|
47
|
+
perform_request({ api_function: 'listusersindb' })
|
48
|
+
end
|
49
|
+
|
50
|
+
# Public: Retrieve a list of permissions that correspond to a specific
|
51
|
+
# user and database
|
52
|
+
#
|
53
|
+
# options - Hash options for API call params (default: {})
|
54
|
+
# :db - String database that corresponds to th user whose permission
|
55
|
+
# you wish to view
|
56
|
+
# :username - String user whose permissions you wish to view
|
57
|
+
#
|
58
|
+
# Returns Hash API response
|
59
|
+
def permissions(options = {})
|
60
|
+
perform_request({ api_function: 'userdbprivs' }.merge(options))
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
|
@@ -0,0 +1,190 @@
|
|
1
|
+
module Lumberg
|
2
|
+
module Cpanel
|
3
|
+
# Public: Allows you to manage MySQL Databases, users and other related settings.
|
4
|
+
class MysqlDb < Base
|
5
|
+
def self.api_module; "Mysql"; end
|
6
|
+
|
7
|
+
# Public: Add a new MySQL database to a cPanel account.
|
8
|
+
#
|
9
|
+
# options - Hash options for API call params (default: {}).
|
10
|
+
# :dbname - String name of the MySQL database to add.
|
11
|
+
#
|
12
|
+
# Returns Hash API response.
|
13
|
+
def add_db(options = {})
|
14
|
+
perform_request({
|
15
|
+
api_function: 'adddb',
|
16
|
+
'arg-0' => options.delete(:dbname)
|
17
|
+
}.merge(default_options(options)))
|
18
|
+
end
|
19
|
+
|
20
|
+
# Public: Create a new MySQL user.
|
21
|
+
#
|
22
|
+
# options - Hash options for API call params (default: {}).
|
23
|
+
# :username - String MySQL user to create.
|
24
|
+
# :password - String password for the new MySQL user.
|
25
|
+
#
|
26
|
+
# Returns Hash API respone.
|
27
|
+
def add_user(options = {})
|
28
|
+
perform_request({
|
29
|
+
api_function: 'adduser',
|
30
|
+
'arg-0' => options.delete(:username),
|
31
|
+
'arg-1' => options.delete(:password)
|
32
|
+
}.merge(default_options(options)))
|
33
|
+
end
|
34
|
+
|
35
|
+
# Public: Grant a user permission to access a cPanel account's database.
|
36
|
+
#
|
37
|
+
# options - Hash options for API call params (default: {})
|
38
|
+
# :dbname - String name of the database to allow the user to access.
|
39
|
+
# :dbuser - String MySQL user who should be given access to the database.
|
40
|
+
# :perms_list - A space-separated String containing a list of permissions
|
41
|
+
# to grant to the user
|
42
|
+
# (e.g. "all" or "alter drop create delete insert update lock" )
|
43
|
+
#
|
44
|
+
# Returns Hash API respone.
|
45
|
+
def add_user_db(options = {})
|
46
|
+
perform_request({
|
47
|
+
api_function: 'adduserdb',
|
48
|
+
'arg-0' => options.delete(:dbname),
|
49
|
+
'arg-1' => options.delete(:dbuser),
|
50
|
+
'arg-2' => options.delete(:perms_list)
|
51
|
+
}.merge(default_options(options)))
|
52
|
+
end
|
53
|
+
|
54
|
+
# Public: Retrieve the number of database users an account has created.
|
55
|
+
#
|
56
|
+
# Returns Hash API response.
|
57
|
+
def number_of_dbs(options = {})
|
58
|
+
perform_request({
|
59
|
+
api_function: 'number_of_dbs'
|
60
|
+
}.merge(default_options(options)))
|
61
|
+
end
|
62
|
+
|
63
|
+
# Public: Run a MySQL database check.
|
64
|
+
#
|
65
|
+
# options - Hash options for API call params (default: {}).
|
66
|
+
# :dbname - String name of the MySQL database to check.
|
67
|
+
#
|
68
|
+
# Returns Hash API response.
|
69
|
+
def check_db(options = {})
|
70
|
+
perform_request({
|
71
|
+
api_function: 'checkdb',
|
72
|
+
'arg-0' => options.delete(:dbname)
|
73
|
+
}.merge(default_options(options)))
|
74
|
+
end
|
75
|
+
|
76
|
+
# Public: Run a MySQL database repair.
|
77
|
+
#
|
78
|
+
# options - Hash options for API call params (default: {}).
|
79
|
+
# :dbname - String name of the MySQL database to repair.
|
80
|
+
#
|
81
|
+
# Returns Hash API response.
|
82
|
+
def repair_db(options = {})
|
83
|
+
perform_request({
|
84
|
+
api_function: 'repairdb',
|
85
|
+
'arg-0' => options.delete(:dbname)
|
86
|
+
}.merge(default_options(options)))
|
87
|
+
end
|
88
|
+
|
89
|
+
# Public: Force an update of MySQL privileges and passwords.
|
90
|
+
#
|
91
|
+
# options - Hash options for API call params (default: {})
|
92
|
+
#
|
93
|
+
# Returns Hash API response.
|
94
|
+
def update_privs(options = {})
|
95
|
+
perform_request({
|
96
|
+
api_function: 'updateprivs'
|
97
|
+
}.merge(default_options(options)))
|
98
|
+
end
|
99
|
+
|
100
|
+
# Public: Refresh the cache of MySQL information. This includes users,
|
101
|
+
# databases, routines and other related information.
|
102
|
+
#
|
103
|
+
# options - Hash options for API call params (default: {})
|
104
|
+
#
|
105
|
+
# Returns Hash API response.
|
106
|
+
def init_cache(options = {})
|
107
|
+
perform_request({
|
108
|
+
api_function: 'initcache'
|
109
|
+
}.merge(default_options(options)))
|
110
|
+
end
|
111
|
+
|
112
|
+
# Public: Disallow a MySQL user from accessing a database.
|
113
|
+
#
|
114
|
+
# options - Hash options for API call params (default: {})
|
115
|
+
# :dbname - String MySQL database from which to remove the user's permissions.
|
116
|
+
# :dbuser - String name of the MySQL user to remove.
|
117
|
+
#
|
118
|
+
# Returns Hash API response.
|
119
|
+
def del_user_db(options = {})
|
120
|
+
perform_request({
|
121
|
+
api_function: 'deluserdb',
|
122
|
+
'arg-0' => options.delete(:dbname),
|
123
|
+
'arg-1' => options.delete(:dbuser)
|
124
|
+
}.merge(default_options(options)))
|
125
|
+
end
|
126
|
+
|
127
|
+
# Public: Remove a user from MySQL.
|
128
|
+
#
|
129
|
+
# options - Hash options for API call params (default: {})
|
130
|
+
# :dbuser - String name of the MySQL user to remove.
|
131
|
+
# This value must be prefixed with the cPanel username.
|
132
|
+
# (e.g. cpuser_dbuser)
|
133
|
+
#
|
134
|
+
# Returns Hash API response.
|
135
|
+
def del_user(options = {})
|
136
|
+
perform_request({
|
137
|
+
api_function: 'deluser',
|
138
|
+
'arg-0' => options.delete(:dbuser)
|
139
|
+
}.merge(default_options(options)))
|
140
|
+
end
|
141
|
+
|
142
|
+
# Public: Remove a database from MySQL.
|
143
|
+
#
|
144
|
+
# options - Hash options for API call params (default: {}).
|
145
|
+
# :dbname - String name of the MySQL database to remove.
|
146
|
+
# This value must be prefixed with the cPanel username
|
147
|
+
# (e.g., cpuser_dbname).
|
148
|
+
#
|
149
|
+
# Returns Hash API response.
|
150
|
+
def del_db(options = {})
|
151
|
+
perform_request({
|
152
|
+
api_function: 'deldb',
|
153
|
+
'arg-0' => options.delete(:dbname)
|
154
|
+
}.merge(default_options(options)))
|
155
|
+
end
|
156
|
+
|
157
|
+
# Public: Authorize a remote host to access a cPanel account's MySQL users.
|
158
|
+
#
|
159
|
+
# options - Hash options for API call params (default: {})
|
160
|
+
# :hostname - String IP address or hostname that should be provided access.
|
161
|
+
#
|
162
|
+
# Returns Hash API response.
|
163
|
+
def add_host(options = {})
|
164
|
+
perform_request({
|
165
|
+
api_function: 'addhost',
|
166
|
+
'arg-0' => options.delete(:hostname)
|
167
|
+
}.merge(default_options(options)))
|
168
|
+
end
|
169
|
+
|
170
|
+
# Public: Remove host access permissions from MySQL.
|
171
|
+
#
|
172
|
+
# options - Hash options for API call params (default: {})
|
173
|
+
# :host - String IP address or hostname that should be provided access.
|
174
|
+
#
|
175
|
+
# Returns Hash API response.
|
176
|
+
def del_host(options = {})
|
177
|
+
perform_request({
|
178
|
+
api_function: 'delhost',
|
179
|
+
'arg-0' => options.delete(:host)
|
180
|
+
}.merge(default_options(options)))
|
181
|
+
end
|
182
|
+
|
183
|
+
private
|
184
|
+
|
185
|
+
def default_options(options)
|
186
|
+
{ api_version: 1, response_key: 'data' }.merge(options)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Lumberg
|
2
|
+
module Cpanel
|
3
|
+
# Public: Allows users to access networking functions
|
4
|
+
class Net < Base
|
5
|
+
# Public: Perform a traceroute back to your local IP address while
|
6
|
+
# displaying packet speed at each hop in milliseconds.
|
7
|
+
#
|
8
|
+
# Returns Hash API response
|
9
|
+
def traceroute
|
10
|
+
perform_request({ api_function: 'traceroute' })
|
11
|
+
end
|
12
|
+
|
13
|
+
# Public: Performs an A record DNS query for the hostname presented via
|
14
|
+
# the 'host' variable, with a 60 second timeout. If more than one A record
|
15
|
+
# exists for a given FQDN, all will be returned.
|
16
|
+
#
|
17
|
+
# options - Hash options for API call params (default: {})
|
18
|
+
# :host - String fully qualified domain name, either host.domain.com or
|
19
|
+
# domain.com
|
20
|
+
#
|
21
|
+
# Returns Hash API response
|
22
|
+
def query_hostname(options = {})
|
23
|
+
perform_request({ api_function: 'dnszone' }.merge(options))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Lumberg
|
2
|
+
module Cpanel
|
3
|
+
class Park < Base
|
4
|
+
# Public: Add a parked domain.
|
5
|
+
#
|
6
|
+
# options - Hash options for API call params (default: {}):
|
7
|
+
# :domain - String domain to park.
|
8
|
+
# :topdomain - String domain to park on top of (optional, default:
|
9
|
+
# account primary domain).
|
10
|
+
#
|
11
|
+
# Returns Hash API response.
|
12
|
+
def add(options = {})
|
13
|
+
perform_request({
|
14
|
+
api_function: "park"
|
15
|
+
}.merge(options))
|
16
|
+
end
|
17
|
+
|
18
|
+
# Public: Remove a parked domain.
|
19
|
+
#
|
20
|
+
# options - Hash options for API call params (default: {}):
|
21
|
+
# :domain - String parked domain to remove.
|
22
|
+
#
|
23
|
+
# Returns Hash API response.
|
24
|
+
def remove(options = {})
|
25
|
+
perform_request({
|
26
|
+
api_function: "unpark"
|
27
|
+
}.merge(options))
|
28
|
+
end
|
29
|
+
|
30
|
+
# Public: Get a list of parked domains.
|
31
|
+
#
|
32
|
+
# options - Hash options for API call params (default: {}):
|
33
|
+
# :regex - String regular expression to filter search results
|
34
|
+
# (optional).
|
35
|
+
#
|
36
|
+
# Returns Hash API response.
|
37
|
+
def list(options = {})
|
38
|
+
perform_request({
|
39
|
+
api_function: "listparkeddomains"
|
40
|
+
}.merge(options))
|
41
|
+
end
|
42
|
+
|
43
|
+
# Public: Get a list addon domains.
|
44
|
+
#
|
45
|
+
# options - Hash options for API call params (default: {}):
|
46
|
+
# :regex - String regular expresion to filter search results
|
47
|
+
# (optional).
|
48
|
+
#
|
49
|
+
# Returns Hash API response.
|
50
|
+
def list_addon_domains(options = {})
|
51
|
+
perform_request({
|
52
|
+
api_function: "listaddondomains"
|
53
|
+
}.merge(options))
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Lumberg
|
2
|
+
module Cpanel
|
3
|
+
# Public: The Passwd module allows users to change their cPanel account's
|
4
|
+
# password.
|
5
|
+
class Password < Base
|
6
|
+
def self.api_module; "Passwd"; end
|
7
|
+
|
8
|
+
# Public: Change a cPanel account's password.
|
9
|
+
#
|
10
|
+
# options - Hash options for API call params (default: {})
|
11
|
+
# :newpass - String new password for the Cpanel account
|
12
|
+
# :oldpass - String old password for the Cpanel account
|
13
|
+
#
|
14
|
+
# Examples
|
15
|
+
# api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
|
16
|
+
# password = Lumberg::Cpanel::Password.new(api_args.dup)
|
17
|
+
#
|
18
|
+
# password.modify(new: "", old: "")
|
19
|
+
#
|
20
|
+
# Returns Hash API response.
|
21
|
+
def modify(options = {})
|
22
|
+
perform_request({ api_function: 'change_password' }.merge(options))
|
23
|
+
end
|
24
|
+
|
25
|
+
# Public: Enables or disables Digest Authentication for an account.
|
26
|
+
# Windows Vista(R), Windows(R) 7, and Windows(R) 8 require Digest
|
27
|
+
# Authentication support to be enabled in order to access your
|
28
|
+
# Web Disk over a clear text, unencrypted connection. If the
|
29
|
+
# server has a SSL certificate signed by a recognized certificate
|
30
|
+
# authority and you are able to make an SSL connection over port
|
31
|
+
# 2078, you do not need to enable this.
|
32
|
+
#
|
33
|
+
# options - Hash options for API call params (default: {})
|
34
|
+
# :password - String current password for your account
|
35
|
+
# :enable - Boolean value indicating if Digest Authentication should
|
36
|
+
# be enabled or disabled for the web disk user.
|
37
|
+
#
|
38
|
+
# Examples
|
39
|
+
# api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
|
40
|
+
# password = Lumberg::Cpanel::Password.new(api_args.dup)
|
41
|
+
#
|
42
|
+
# password.digest_authentication(password: "", enable: true)
|
43
|
+
#
|
44
|
+
# Returns Hash API response.
|
45
|
+
def digest_authentication(options = {})
|
46
|
+
options[:enabledigest] = options.delete([:enable]) ? 1 : 0
|
47
|
+
perform_request({ api_function: 'set_digest_auth' }.merge(options))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Lumberg
|
2
|
+
module Cpanel
|
3
|
+
# Public: This module provides access to cPanel's password scoring system.
|
4
|
+
class PasswordStrength < Base
|
5
|
+
def self.api_module; "PasswdStrength"; end
|
6
|
+
|
7
|
+
# Public: Retrieve the strength of a specified password. This API call
|
8
|
+
# is only available in cPanel & WHM 11.32.
|
9
|
+
#
|
10
|
+
# options - Hash options for API call params (default: {})
|
11
|
+
# :password - String password to test strength
|
12
|
+
#
|
13
|
+
# Examples
|
14
|
+
# api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
|
15
|
+
# passwd_strength = Lumberg::Cpanel::PasswordStrength.new(api_args.dup)
|
16
|
+
#
|
17
|
+
# passwd_strength.strength(password: "weakpass")
|
18
|
+
#
|
19
|
+
# Returns Hash API response.
|
20
|
+
def strength(options = {})
|
21
|
+
perform_request(options.merge(api_function: 'get_password_strength'))
|
22
|
+
end
|
23
|
+
|
24
|
+
# Public: Return the required password strength for a specific
|
25
|
+
# application.
|
26
|
+
#
|
27
|
+
# options - Hash options for API call params (default: {})
|
28
|
+
# :app - String The application corresponding to the password strength
|
29
|
+
# you would like to retrieve. Accepted values include 'htaccess',
|
30
|
+
# 'passwd', 'ftp', 'createacct', 'bandmin', 'cpaddons', 'pop',
|
31
|
+
# 'sshkey', 'postgres', 'webdisk', and 'mysql'.
|
32
|
+
#
|
33
|
+
# Examples
|
34
|
+
# api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
|
35
|
+
# password_strength = Lumberg::Cpanel::PasswordStrength.new(api_args.dup)
|
36
|
+
#
|
37
|
+
# password_strength.required_strength(app: 'htaccess')
|
38
|
+
#
|
39
|
+
# Returns Hash API response.
|
40
|
+
def required_strength(options = {})
|
41
|
+
perform_request(options.merge(api_function: 'get_required_strength'))
|
42
|
+
end
|
43
|
+
|
44
|
+
# Public: Return password strength settings set in WHM's 'Main >>
|
45
|
+
# Security Center >> Password Strength Configuration' section.
|
46
|
+
# If this requirement is in place, this function will return
|
47
|
+
# all password strength requirements on a per-application basis.
|
48
|
+
#
|
49
|
+
# options - Hash options for API call params (default: {})
|
50
|
+
#
|
51
|
+
# Examples
|
52
|
+
# api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
|
53
|
+
# password_strength = Lumberg::Cpanel::PasswordStrength.new(api_args.dup)
|
54
|
+
#
|
55
|
+
# password_strength.all_required_strengths
|
56
|
+
#
|
57
|
+
# Returns Hash API response.
|
58
|
+
def all_required_strengths(options = {})
|
59
|
+
perform_request(options.merge(api_function: 'appstrengths'))
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Lumberg
|
2
|
+
module Cpanel
|
3
|
+
# Public: Allows you to create random data
|
4
|
+
class RandomData < Base
|
5
|
+
def self.api_module; "Rand" ; end
|
6
|
+
|
7
|
+
# Public: Retrieve a random string
|
8
|
+
#
|
9
|
+
# options - Hash options for API call params (default: {})
|
10
|
+
# :length - Integer length of the random string you wish to receive
|
11
|
+
#
|
12
|
+
# Examples
|
13
|
+
# api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
|
14
|
+
# random_data = Lumberg::Cpanel::RandomData.new(api_args.dup)
|
15
|
+
#
|
16
|
+
# random_data.show
|
17
|
+
#
|
18
|
+
# Returns Hash API response
|
19
|
+
def show(options = {})
|
20
|
+
perform_request({ api_function: 'getranddata' }.merge(options))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|