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,522 @@
|
|
1
|
+
module Lumberg
|
2
|
+
module Cpanel
|
3
|
+
class Email < Base
|
4
|
+
# Public: Get info about how the main email account handles
|
5
|
+
# undeliverable mail.
|
6
|
+
#
|
7
|
+
# options - Hash options for API call params (default: {}).
|
8
|
+
#
|
9
|
+
# Returns Hash API response.
|
10
|
+
def main_discard(options = {})
|
11
|
+
perform_request(
|
12
|
+
api_function: "checkmaindiscard"
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Public: Add a forwarder.
|
17
|
+
#
|
18
|
+
# options - Hash options for API call params (default: {}):
|
19
|
+
# :domain - String forwarder domain.
|
20
|
+
# :email - String local part ("user" if "user@domain.com").
|
21
|
+
# :fwdopt - String type of forwarder. Accepted values:
|
22
|
+
# "pipe", "fwd", "system", "blackhole", "fail"
|
23
|
+
# :fwdemail - String Destination email address.
|
24
|
+
# :fwdsystem - String system account to forward to (optional). Should
|
25
|
+
# only be used if :fwdopt is set to "system".
|
26
|
+
# :failmsgs - String failure message (optional). Only used if "fwdopt"
|
27
|
+
# is set to "fail".
|
28
|
+
# :pipefwd - String path to program to pipe to (optional). Only used
|
29
|
+
# if "fwdopt" is set to "pipe"
|
30
|
+
#
|
31
|
+
# Returns Hash API response.
|
32
|
+
def add_forwarder(options = {})
|
33
|
+
perform_request({
|
34
|
+
api_function: "addforward"
|
35
|
+
}.merge(options))
|
36
|
+
end
|
37
|
+
|
38
|
+
# Public: Get list of forwarders.
|
39
|
+
#
|
40
|
+
# options - Hash options for API call params (default: {}):
|
41
|
+
# :domain - String domain for which to retrieve forwarders (optional).
|
42
|
+
# :regex - String regular expression to filter results (optional).
|
43
|
+
#
|
44
|
+
# Returns Hash API response.
|
45
|
+
def forwarders(options = {})
|
46
|
+
perform_request({
|
47
|
+
api_function: "listforwards"
|
48
|
+
}.merge(options))
|
49
|
+
end
|
50
|
+
|
51
|
+
# Public: Retrieve a list of domains that use aliases and custom
|
52
|
+
# catch-all addresses.
|
53
|
+
#
|
54
|
+
# options - Hash options for API call params (default: {}).
|
55
|
+
#
|
56
|
+
# Returns Hash API response.
|
57
|
+
def domains_with_aliases(options = {})
|
58
|
+
perform_request(
|
59
|
+
api_function: "listaliasbackups"
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Public: Add a mailing list. Uses API1 because API2 doesn't provide
|
64
|
+
# an equivalent method.
|
65
|
+
#
|
66
|
+
# options - Hash options for API call params (default: {}):
|
67
|
+
# :list - String mailing liist name.
|
68
|
+
# :password - String mailing list password.
|
69
|
+
# :domain - String mailing list domain.
|
70
|
+
#
|
71
|
+
# Returns Hash API response.
|
72
|
+
def add_mailing_list(options = {})
|
73
|
+
perform_request({
|
74
|
+
api_function: "addlist",
|
75
|
+
api_version: 1,
|
76
|
+
"arg-0" => options[:list],
|
77
|
+
"arg-1" => options[:password],
|
78
|
+
"arg-2" => options[:domain]
|
79
|
+
})
|
80
|
+
end
|
81
|
+
|
82
|
+
# Public: Get list Mailman mailing lists.
|
83
|
+
#
|
84
|
+
# options - Hash options for API call params (default: {}):
|
85
|
+
# :domain - String domain for which to retrieve mailing lists
|
86
|
+
# (optional).
|
87
|
+
# :regex - String regular expression to filter results (optional).
|
88
|
+
#
|
89
|
+
# Returns Hash API response.
|
90
|
+
def mailing_lists(options = {})
|
91
|
+
perform_request({
|
92
|
+
api_function: "listlists"
|
93
|
+
}.merge(options))
|
94
|
+
end
|
95
|
+
|
96
|
+
# Public: Get list of domains that can send/receive mail.
|
97
|
+
#
|
98
|
+
# options - Hash options for API call params (default: {}):
|
99
|
+
# :skipmain - String skip main domain by passing "1" (optional).
|
100
|
+
#
|
101
|
+
# Returns Hash API response.
|
102
|
+
def domains(options = {})
|
103
|
+
perform_request({
|
104
|
+
api_function: "listmaildomains"
|
105
|
+
}.merge(options))
|
106
|
+
end
|
107
|
+
|
108
|
+
# Public: Change values for a specific MX record
|
109
|
+
#
|
110
|
+
# options - Hash options for API call params (default: {}):
|
111
|
+
# :domain - String domain for the MX record you wish to change.
|
112
|
+
# :exchange - String name of the new exchanger.
|
113
|
+
# :oldexchange - String name of the exchanger to replace (optional).
|
114
|
+
# :oldpreference - Integer priority value of the old exchanger.
|
115
|
+
# :preference - Integer priority value for the new exchange.
|
116
|
+
# :alwaysaccept - String setting to define behavior for the exchanger.
|
117
|
+
# Accepted: "backup", "local", "secondary", "remote".
|
118
|
+
# (optional)
|
119
|
+
#
|
120
|
+
# Returns Hash API response.
|
121
|
+
def change_mx(options = {})
|
122
|
+
perform_request({ api_function: "changemx" }.merge(options))
|
123
|
+
end
|
124
|
+
|
125
|
+
# Public: Add an MX record
|
126
|
+
#
|
127
|
+
# options - Hash options for API call params (default: {}):
|
128
|
+
# :domain - String domain for the MX record you wish to change.
|
129
|
+
# :exchange - String name of the new exchanger.
|
130
|
+
# :preference - Integer priority value for the new exchange.
|
131
|
+
# :alwaysaccept - String setting to define behavior for the exchanger.
|
132
|
+
# Accepted: "backup", "local", "secondary", "remote".
|
133
|
+
# (optional)
|
134
|
+
#
|
135
|
+
# Returns Hash API response.
|
136
|
+
def add_mx(options = {})
|
137
|
+
perform_request({ api_function: "addmx" }.merge(options))
|
138
|
+
end
|
139
|
+
|
140
|
+
# Public: Get list of mail exchanger information.
|
141
|
+
#
|
142
|
+
# options - Hash options for API call params (default: {}):
|
143
|
+
# :domain - String domain for which to retrieve mail exchangers.
|
144
|
+
#
|
145
|
+
# Returns Hash API response.
|
146
|
+
def mx(options = {})
|
147
|
+
perform_request({
|
148
|
+
api_function: "listmxs"
|
149
|
+
}.merge(options))
|
150
|
+
end
|
151
|
+
|
152
|
+
# Public: Delete an MX record
|
153
|
+
#
|
154
|
+
# options - Hash options for API call params (default: {}):
|
155
|
+
# :domain - String domain for the MX record you wish to change.
|
156
|
+
# :exchange - String name of the new exchanger.
|
157
|
+
# :preference - Integer priority value for the new exchange.
|
158
|
+
#
|
159
|
+
# Returns Hash API response.
|
160
|
+
def delete_mx(options = {})
|
161
|
+
perform_request({ api_function: "delmx" }.merge(options))
|
162
|
+
end
|
163
|
+
|
164
|
+
# Public: Set a mail exchanger for a specified domain to local,
|
165
|
+
# remote, secondary, or auto
|
166
|
+
#
|
167
|
+
# options - Hash options for API call params (default: {}):
|
168
|
+
# :domain - String domain for the MX record you wish to change.
|
169
|
+
# :mxcheck - String setting to define behavior for the exchanger.
|
170
|
+
# Accepted: "auto", "local", "secondary", "remote".
|
171
|
+
#
|
172
|
+
# Returns Hash API response.
|
173
|
+
def set_mx_type(options = {})
|
174
|
+
perform_request({ api_function: "setmxcheck" }.merge(options))
|
175
|
+
end
|
176
|
+
|
177
|
+
# Public: Set mail delivery for a domain.
|
178
|
+
#
|
179
|
+
# options - Hash options for API call params (default: {}):
|
180
|
+
# :domain - String domain corresponding to the mail exchanger to set.
|
181
|
+
# :delivery - String status to set for the mail exchanger. Accepted:
|
182
|
+
# "auto", "local", "secondary", "remote".
|
183
|
+
# :user - String user of the cPanel account whose domain
|
184
|
+
# corresponds to the mail exchanger you with to set.
|
185
|
+
#
|
186
|
+
# Returns Hash API response.
|
187
|
+
def set_mail_delivery(options = {})
|
188
|
+
perform_request({
|
189
|
+
api_function: "setalwaysaccept",
|
190
|
+
mxcheck: options[:delivery]
|
191
|
+
}.merge(options))
|
192
|
+
end
|
193
|
+
|
194
|
+
# Public: Check cPanel config for local mail delivery setting.
|
195
|
+
# This function checks cPanel config, not DNS.
|
196
|
+
#
|
197
|
+
# options - Hash options for API call params (default: {}):
|
198
|
+
# :domain - String domain to check. Will return settings for all
|
199
|
+
# domains if omitted.
|
200
|
+
#
|
201
|
+
# Returns Hash API response.
|
202
|
+
def check_local_delivery(options = {})
|
203
|
+
perform_request({
|
204
|
+
api_function: "getalwaysaccept"
|
205
|
+
}.merge(options))
|
206
|
+
end
|
207
|
+
|
208
|
+
# Public: Add a new email filter. See
|
209
|
+
# http://docs.cpanel.net/twiki/bin/view/ApiDocs/Api2/ApiEmail#Email::storefilter
|
210
|
+
# for gory details.
|
211
|
+
#
|
212
|
+
# options - Hash options for API call params (default: {}). Options
|
213
|
+
# with * indicate numeric suffix corresponding to filter
|
214
|
+
# number:
|
215
|
+
# :account - String value. For user-level filters, enter email
|
216
|
+
# address. Leave empty for account-level filter. Use
|
217
|
+
# cPanel username for default address filters.
|
218
|
+
# :action* - String action taken by filter. Accepted: "deliver",
|
219
|
+
# "fail", "finish", "save", "pipe"
|
220
|
+
# :dest* - String destination for mail received by the filter.
|
221
|
+
# :filtername - String name of filter.
|
222
|
+
# :match* - String filter match type. Accepted: "is", "matches",
|
223
|
+
# "contains", "does not contain", "begins", "ends",
|
224
|
+
# "does not begin", "does not end", "does not match",
|
225
|
+
# "is above" (numeric), "is not above" (numeric),
|
226
|
+
# "is below" (numeric), "is not below" (numeric)
|
227
|
+
# :opt* - String value used to connect conditions. Accepted:
|
228
|
+
# "or", "and".
|
229
|
+
# :part* - String part of the email to apply the :match option
|
230
|
+
# to. Accepted: "$header_from:", "$header_subject:",
|
231
|
+
# "$header_to:", "$reply_address:", "$message_body",
|
232
|
+
# "$message_headers",
|
233
|
+
# 'foranyaddress $h_to",$h_cc:,$h_bcc:',
|
234
|
+
# "not delivered", "error_message",
|
235
|
+
# "$h_X-Spam-Status:",
|
236
|
+
# "$h_X-Spam-Score:", and "$h_X-Spam-Bar:". The last 3
|
237
|
+
# options require SpamAssassin to be enabled. You may
|
238
|
+
# also use "error_message" or "not delivered" which
|
239
|
+
# do not require the :match parameter.
|
240
|
+
# :val* - String value to match.
|
241
|
+
# :oldfiltername - String value. Use current filter name here and
|
242
|
+
# specify new filter name in :filtername option to
|
243
|
+
# rename filter (optional).
|
244
|
+
#
|
245
|
+
# Returns Hash API response.
|
246
|
+
def add_filter(options = {})
|
247
|
+
perform_request({
|
248
|
+
api_function: "storefilter"
|
249
|
+
}.merge(options))
|
250
|
+
end
|
251
|
+
|
252
|
+
# Public: Get a list of email filters.
|
253
|
+
#
|
254
|
+
# options - Hash options for API call params (default: {}):
|
255
|
+
# :account - String value (optional). Lists user-level filters if
|
256
|
+
# email address given. Lists user-level filters
|
257
|
+
# associated with default address if cPanel username
|
258
|
+
# given. Lists account-level filters if omitted.
|
259
|
+
# :old_style - Boolean (optional, default: false). Use deprecated
|
260
|
+
# Email::listfilters.
|
261
|
+
#
|
262
|
+
# Returns Hash API response.
|
263
|
+
def filters(options = {})
|
264
|
+
func = options.delete(:old_style) ? "listfilters" : "filterlist"
|
265
|
+
|
266
|
+
perform_request({
|
267
|
+
api_function: func
|
268
|
+
}.merge(options))
|
269
|
+
end
|
270
|
+
|
271
|
+
# Public: Add a POP account.
|
272
|
+
#
|
273
|
+
# options - Hash options for API call params (default: {}):
|
274
|
+
# :domain - String domain for the email account.
|
275
|
+
# :email - String local part of email address. "user" if
|
276
|
+
# "user@domain".
|
277
|
+
# :password - String password for email account.
|
278
|
+
# :quota - Integer disk space quota in MB, 0 for unlimited.
|
279
|
+
#
|
280
|
+
# Returns Hash API response.
|
281
|
+
def add_account(options = {})
|
282
|
+
perform_request({
|
283
|
+
api_function: "addpop"
|
284
|
+
}.merge(options))
|
285
|
+
end
|
286
|
+
|
287
|
+
# Public: Get a list of email accounts. Uses the cPanel-preferred
|
288
|
+
# API call Email::listpopswithdisk.
|
289
|
+
#
|
290
|
+
# options - Hash options for API call params (default: {}):
|
291
|
+
# :domain - String domain for which to retrieve email accounts
|
292
|
+
# (optional).
|
293
|
+
# :regex - String regular expression to filter results
|
294
|
+
# (optional).
|
295
|
+
# :nearquotaonly - String value. Set to "1" to only view accounts that
|
296
|
+
# have used >= 95% of their quota (optional).
|
297
|
+
# :no_validate - String vlaue. Set to "1" to only read data from
|
298
|
+
# account's ".cpanel/email_accounts.yaml" file. This
|
299
|
+
# parameter is "off" by default, causing the function
|
300
|
+
# to check the passwd file, quota files, etc.
|
301
|
+
# (optional).
|
302
|
+
# :style - Symbol account list style (optional,
|
303
|
+
# default: :with_disk). Accepted: :with_disk,
|
304
|
+
# :without_disk, :with_image, :single.
|
305
|
+
#
|
306
|
+
# Returns Hash API response.
|
307
|
+
def accounts(options = {})
|
308
|
+
styles = {
|
309
|
+
with_disk: "listpopswithdisk",
|
310
|
+
without_disk: "listpops",
|
311
|
+
with_image: "listpopswithimage",
|
312
|
+
single: "listpopssingle"
|
313
|
+
}
|
314
|
+
func = styles.fetch(options.delete(:style), styles[:with_disk])
|
315
|
+
|
316
|
+
perform_request({
|
317
|
+
api_function: func
|
318
|
+
}.merge(options))
|
319
|
+
end
|
320
|
+
|
321
|
+
# Public: Configure a default (catchall) email address.
|
322
|
+
#
|
323
|
+
# options - Hash options for API call params (default: {}):
|
324
|
+
# :fwdopt - String defines how unroutable mail will be handled.
|
325
|
+
# Valid values are: fail, fwd, blackhole, pipe.
|
326
|
+
# :domain - String domain to apply the rule.
|
327
|
+
# :failmsgs - String failure message for bounces (Optional).
|
328
|
+
# :fwdemail - String email address to forward to (Optional).
|
329
|
+
# :pipefwd - String program to pipe messages to (Optional).
|
330
|
+
#
|
331
|
+
# Returns Hash API response.
|
332
|
+
def set_default_address(options = {})
|
333
|
+
perform_request({
|
334
|
+
api_function: "setdefaultaddress"
|
335
|
+
}.merge(options))
|
336
|
+
end
|
337
|
+
|
338
|
+
# Public: Get default address info.
|
339
|
+
#
|
340
|
+
# options - Hash options for API call params (default: {}):
|
341
|
+
# :domain - String efault address domain.
|
342
|
+
#
|
343
|
+
# Returns Hash API response.
|
344
|
+
def default_address(options = {})
|
345
|
+
perform_request({
|
346
|
+
api_function: "listdefaultaddresses"
|
347
|
+
}.merge(options))
|
348
|
+
end
|
349
|
+
|
350
|
+
# Public: Get disk usage information for an email account.
|
351
|
+
#
|
352
|
+
# options - Hash options for API call params (default: {}):
|
353
|
+
# :domain - String value. "domain.com" if "user@domain.com"
|
354
|
+
# :login - String value. "user" if "user@domain.com".
|
355
|
+
#
|
356
|
+
# Returns Hash API response.
|
357
|
+
def disk_usage(options = {})
|
358
|
+
perform_request({
|
359
|
+
api_function: "getdiskusage"
|
360
|
+
}.merge(options))
|
361
|
+
end
|
362
|
+
|
363
|
+
# Public: Get full path to a mail folder.
|
364
|
+
#
|
365
|
+
# options - Hash options for API call params (default: {}):
|
366
|
+
# :account - String email address.
|
367
|
+
# :dir - String mail folder you wish to query for its full path
|
368
|
+
# (optional, default: "mail").
|
369
|
+
#
|
370
|
+
# Returns Hash API response.
|
371
|
+
def mail_dir(options = {})
|
372
|
+
perform_request({
|
373
|
+
api_function: "getabsbrowsedir"
|
374
|
+
}.merge(options))
|
375
|
+
end
|
376
|
+
|
377
|
+
# Public: Retrieve a list of mail dirs.
|
378
|
+
#
|
379
|
+
# options - Hash options for API call params (default: {}):
|
380
|
+
# :account - String email account (optional).
|
381
|
+
# :dir - String mail directories to display (optional).
|
382
|
+
# "default" or "mail" will list all mail dirs.
|
383
|
+
# Providing a domain will list dirs related to the
|
384
|
+
# domain.
|
385
|
+
# :showdotfiles - Boolean view hidden directories?
|
386
|
+
#
|
387
|
+
# Returns Hash API response.
|
388
|
+
def mail_dirs(options = {})
|
389
|
+
perform_request({
|
390
|
+
api_function: "browseboxes"
|
391
|
+
}.merge(options))
|
392
|
+
end
|
393
|
+
|
394
|
+
# Public: Remove an email account
|
395
|
+
#
|
396
|
+
# options - Hash options for API call params (default: {})
|
397
|
+
# :domain - String domain for which you wish to remove the email
|
398
|
+
# account
|
399
|
+
# :email - String email address you wish to remove
|
400
|
+
#
|
401
|
+
# Returns Hash API response.
|
402
|
+
def remove(options = {})
|
403
|
+
perform_request({ api_function: 'delpop' }.merge(options))
|
404
|
+
end
|
405
|
+
|
406
|
+
# Public: Modify an email account's quota.
|
407
|
+
#
|
408
|
+
# options - Hash options for API call params (default: {})
|
409
|
+
# :domain - String domain for which you wish to modify
|
410
|
+
# :email - String username of the email address you wish to modify,
|
411
|
+
# e.g: 'user' if the address is 'user@domain.com'
|
412
|
+
# :quota - Integer indicating the new disk quota value in MB. Enter 0
|
413
|
+
# for an unlimited quota
|
414
|
+
#
|
415
|
+
# Returns Hash API response.
|
416
|
+
def edit_quota(options = {})
|
417
|
+
perform_request({ api_function: 'editquota' }.merge(options))
|
418
|
+
end
|
419
|
+
|
420
|
+
# Public: Retrieve a list of character encodings supported by cPanel
|
421
|
+
#
|
422
|
+
# Returns Hash API response.
|
423
|
+
def acceptable_encodings
|
424
|
+
perform_request({ api_function: 'fetchcharmaps' })
|
425
|
+
end
|
426
|
+
|
427
|
+
# Public: Retrieve the destination for email forwarded by a domain
|
428
|
+
# forwarder
|
429
|
+
# options - Hash options for API call params (default: {})
|
430
|
+
# :domain - String domain corresponding to the forwarder whose
|
431
|
+
# destination you wish to view
|
432
|
+
#
|
433
|
+
# Returns Hash API response
|
434
|
+
def listdomainforwards(options = {})
|
435
|
+
perform_request({ api_function: "listdomainforwards" }.merge(options))
|
436
|
+
end
|
437
|
+
|
438
|
+
# Public: Retrieve a list of auto responders associated with a domain
|
439
|
+
#
|
440
|
+
# options - Hash options for API call params (default: {})
|
441
|
+
# :domain - String domain whose auto responders you wish to view
|
442
|
+
# (default: String)
|
443
|
+
# :regex - String regular expresion to filter search results (default:
|
444
|
+
# String)
|
445
|
+
#
|
446
|
+
# Returns Hash API response
|
447
|
+
def listautoresponders(options = {})
|
448
|
+
perform_request({ api_function: "listautoresponders" }.merge(options))
|
449
|
+
end
|
450
|
+
|
451
|
+
# Public: Retrieve a list of domains that use domain-level filters
|
452
|
+
#
|
453
|
+
# Returns Hash API response
|
454
|
+
def listfilterbackups
|
455
|
+
perform_request({ api_function: "listfilterbackups" })
|
456
|
+
end
|
457
|
+
|
458
|
+
# Public: Retrieve a list of email filters
|
459
|
+
#
|
460
|
+
# options - Hash options for API call params (default: {})
|
461
|
+
# :account - String parameter allows you to specify an email address or
|
462
|
+
# account username to review user-level filters. Specifying
|
463
|
+
# an email address will cause the function to retrieve user
|
464
|
+
# level filters associated with the account. Entering a
|
465
|
+
# cPanel username will cause the function to return user
|
466
|
+
# level filters associated with your account's default email
|
467
|
+
# address. If you do not specify this value, the function
|
468
|
+
# will retrieve account level filter information (default:
|
469
|
+
# String)
|
470
|
+
#
|
471
|
+
# Returns Hash API response
|
472
|
+
def filterlist(options={})
|
473
|
+
perform_request({ api_function: "filterlist" }.merge(options))
|
474
|
+
end
|
475
|
+
|
476
|
+
# Public: Test the action of account-level mail filters. You can only
|
477
|
+
# test filters for your cPanel account's main domain. This function only
|
478
|
+
# tests the body of the message. You must have access to the 'blockers'
|
479
|
+
# feature to use this function.
|
480
|
+
#
|
481
|
+
# options - Hash options for API call params (default: {})
|
482
|
+
# :message - String body of the message you wish to test
|
483
|
+
# :account - String to test old-style Cpanel filters in $home/filters.
|
484
|
+
# By not specifying this parameter, you will test your main
|
485
|
+
# domain's filters found in the /etc/vfilters/ directory (
|
486
|
+
# default: String)
|
487
|
+
#
|
488
|
+
# Returns Hash API response
|
489
|
+
def tracefilter(options={})
|
490
|
+
options[:msg] = options.delete(:message)
|
491
|
+
perform_request({ api_function: "tracefilter" }.merge(options))
|
492
|
+
end
|
493
|
+
|
494
|
+
# Public: Retrieve information about an auto responder used by a
|
495
|
+
# specified email address
|
496
|
+
#
|
497
|
+
# options - Hash options for API call params (default: {})
|
498
|
+
# :email - String email address corresponding to the auto responder
|
499
|
+
# information you wish to review
|
500
|
+
#
|
501
|
+
# Returns Hash API response
|
502
|
+
def fetchautoresponder(options={})
|
503
|
+
perform_request({ api_function: "fetchautoresponder" }.merge(options))
|
504
|
+
end
|
505
|
+
|
506
|
+
# Public: This function changes an email account's password.
|
507
|
+
#
|
508
|
+
# options - Hash options for API call params (default: {}):
|
509
|
+
# :domain - String domain for the email address for which you wish
|
510
|
+
# to change the password.
|
511
|
+
# :email - String username for the email address for
|
512
|
+
# which you wish to change the password.
|
513
|
+
# :password - String value. The desired password for the account.
|
514
|
+
#
|
515
|
+
# Returns Hash API response
|
516
|
+
def change_password(options={})
|
517
|
+
perform_request({ api_function: "passwdpop" }.merge(options))
|
518
|
+
end
|
519
|
+
end
|
520
|
+
end
|
521
|
+
end
|
522
|
+
|
@@ -0,0 +1,146 @@
|
|
1
|
+
module Lumberg
|
2
|
+
module Cpanel
|
3
|
+
# Public: This module provides access to file functions such as listing
|
4
|
+
# directories and viewing files.
|
5
|
+
class FileManager < Base
|
6
|
+
def self.api_module; "Fileman"; end
|
7
|
+
|
8
|
+
# Public: list files and attributes contained within a specified
|
9
|
+
# directory
|
10
|
+
#
|
11
|
+
# options - Hash options for API call params (default: {})
|
12
|
+
# :check_leaf - Boolean value of "1" will cause the function to add
|
13
|
+
# "isleaf" parameter to the output key, e.g: true value
|
14
|
+
# (1) indicates a directory that has no subdirectories
|
15
|
+
# (default: '')
|
16
|
+
#
|
17
|
+
# :directory - String directory that contains the files you wish to
|
18
|
+
# browse, and '/' represents your home directory.
|
19
|
+
# (default: 'your home directory')
|
20
|
+
#
|
21
|
+
# :list - A Boolean value of "1" indicates the function to look for
|
22
|
+
# keys that begin with "filepath-*". These keys are used to
|
23
|
+
# indicate specific files to list (default: '')
|
24
|
+
#
|
25
|
+
# :path - String parameter allows you to specify files you want listed
|
26
|
+
# with the output if :list is set to "1". This can be any
|
27
|
+
# number of parameters such as "filelist-A", "filelist-B", etc.
|
28
|
+
# Each of these keys indicate a file you wish to view
|
29
|
+
# (default:'')
|
30
|
+
#
|
31
|
+
# :need_mime - A Boolean value of "1" indicates that you would like the
|
32
|
+
# function to add the 'mimename' and 'mimetype' to output
|
33
|
+
# (default: '')
|
34
|
+
#
|
35
|
+
#
|
36
|
+
# :show_dot_files - A Boolean value of "1" indicates that you'd like
|
37
|
+
# the function to add dotfiles to output
|
38
|
+
# (default: '')
|
39
|
+
#
|
40
|
+
# :types - String filter allowing you to specify which file types you
|
41
|
+
# wish to view. Acceptable values include "dir", "file" and
|
42
|
+
# "special". Separate each type using a pipe (|) to add
|
43
|
+
# multiple values. (default: '')
|
44
|
+
#
|
45
|
+
# Examples
|
46
|
+
# api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
|
47
|
+
# file_manager = Lumberg::Cpanel::FileManager.new(api_args.dup)
|
48
|
+
#
|
49
|
+
# file_manager.list
|
50
|
+
#
|
51
|
+
# Returns Hash API response.
|
52
|
+
def list(options = {})
|
53
|
+
options[:dir] = options.delete(:directory)
|
54
|
+
options[:filelist] = options.delete(:list)
|
55
|
+
options[:filepath] = options.delete(:path)
|
56
|
+
options[:needmime] = options.delete(:need_mime)
|
57
|
+
options[:checkleaf] = options.delete(:check_leaf)
|
58
|
+
options[:showdotfiles] = options.delete(:show_dot_files)
|
59
|
+
|
60
|
+
perform_request({ api_function: 'listfiles' }.merge(options))
|
61
|
+
end
|
62
|
+
|
63
|
+
# Public: View a file within your home directory. This function also
|
64
|
+
# display additional information about the file such as the contents of a
|
65
|
+
# tarball, a link to an image and more
|
66
|
+
#
|
67
|
+
# options - Hash options for API call params (default: {})
|
68
|
+
# :directory - String directory in which the file is located. Path must
|
69
|
+
# be relative to user's home, e.g: 'public_html/files/'
|
70
|
+
# (default: '')
|
71
|
+
# :file - String path to the file you wish to view
|
72
|
+
#
|
73
|
+
# Returns Hash API response.
|
74
|
+
def show(options = {})
|
75
|
+
options[:dir] = options.delete(:directory)
|
76
|
+
|
77
|
+
perform_request({ api_function: 'viewfile' }.merge(options))
|
78
|
+
end
|
79
|
+
|
80
|
+
# Public: Retrieve information about specific files
|
81
|
+
#
|
82
|
+
# options - Hash options for API call params (default: {})
|
83
|
+
# :directory - String directory whose files you wish to review, (e.g:
|
84
|
+
# /home/user/public_html/files). (default: 'your home')
|
85
|
+
#
|
86
|
+
# :file - String name of the file whose statistics you wish to review.
|
87
|
+
# You may define multiple files by separating each value with a
|
88
|
+
# pipe, e.g: 'file1|file2|file3'
|
89
|
+
#
|
90
|
+
# Returns Hash API response.
|
91
|
+
def stat(options = {})
|
92
|
+
options[:dir] = options.delete(:directory)
|
93
|
+
|
94
|
+
perform_request({ api_function: 'statfiles' }.merge(options))
|
95
|
+
end
|
96
|
+
|
97
|
+
# Public: Retrieve disk usage statistics about your account.
|
98
|
+
#
|
99
|
+
# Returns Hash API response.
|
100
|
+
def disk_usage
|
101
|
+
perform_request({ api_function: 'getdiskinfo' })
|
102
|
+
end
|
103
|
+
|
104
|
+
# Public: Perform an operation on a file or group of files. You can use
|
105
|
+
# this function to copy, move, rename, chmod, extract and compress, link
|
106
|
+
# and unlink, and trash files and directories.
|
107
|
+
#
|
108
|
+
# options - Hash options for API call params (default: {})
|
109
|
+
# :name - String naming the operation to perform. Acceptable values
|
110
|
+
# include 'copy', 'move', 'rename', 'chmod', 'extract',
|
111
|
+
# 'compress', 'link', 'unlink', and 'trash' (move to .trash
|
112
|
+
# directory)
|
113
|
+
# :source_files - String files on which you wish to perform the
|
114
|
+
# operation. You can include multiple files by
|
115
|
+
# separating each file with a comma (,). Do not add
|
116
|
+
# spaces.
|
117
|
+
# :destination_files - String list of destination filenames. If
|
118
|
+
# multiple sourcefiles are listed with multiple
|
119
|
+
# destination files ('destfiles'), the function
|
120
|
+
# attempts to handle each transaction on a 1-to-1
|
121
|
+
# basis. If only 1 file is specified in
|
122
|
+
# 'sourcefiles', it will be moved, or copied, or
|
123
|
+
# etc. to the first directory listed.
|
124
|
+
# :decode_uri - Boolean value. Entering '1' will cause the function to
|
125
|
+
# decode the URI-encoded variables :source_files and
|
126
|
+
# :destination_files
|
127
|
+
# :metadata - String parameter which contains any added values required
|
128
|
+
# by the named operation. When using 'compress', tihs would
|
129
|
+
# be the archive type. Acceptable values for the compress
|
130
|
+
# operation include: tar, gz, bz2, zip, tar.gz and tar.bz2.
|
131
|
+
# The chmod operation requires octal octal permissions like
|
132
|
+
# 0755 or 0700.
|
133
|
+
#
|
134
|
+
# Returns Hash API response
|
135
|
+
def operate(options={})
|
136
|
+
options[:op] = options.delete(:name)
|
137
|
+
options[:doubledecode] = options.delete(:decode_uri)
|
138
|
+
options[:sourcefiles] = options.delete(:source_files)
|
139
|
+
options[:destfiles] = options.delete(:destination_files)
|
140
|
+
|
141
|
+
perform_request({ api_function: "fileop" }.merge(options))
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|