lumberg 1.1.1 → 2.0.0.pre3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +1 -6
- data/README.md +130 -23
- data/lib/lumberg.rb +2 -0
- data/lib/lumberg/cpanel.rb +29 -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 +491 -0
- data/lib/lumberg/cpanel/file_manager.rb +146 -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/net.rb +28 -0
- data/lib/lumberg/cpanel/park.rb +58 -0
- data/lib/lumberg/cpanel/password.rb +52 -0
- data/lib/lumberg/cpanel/random_data.rb +25 -0
- data/lib/lumberg/cpanel/redirect.rb +44 -0
- data/lib/lumberg/cpanel/ssl.rb +198 -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/format_whm.rb +24 -1
- data/lib/lumberg/version.rb +1 -1
- data/lib/lumberg/whm.rb +2 -1
- data/lib/lumberg/whm/account.rb +4 -4
- data/lib/lumberg/whm/cert.rb +69 -0
- data/lib/lumberg/whm/dns.rb +28 -4
- data/lib/lumberg/whm/reseller.rb +4 -4
- data/lib/lumberg/whm/server.rb +64 -15
- data/lumberg.gemspec +4 -3
- data/spec/config_spec.rb +2 -2
- 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 +615 -0
- data/spec/cpanel/file_manager_spec.rb +73 -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_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/random_data_spec.rb +24 -0
- data/spec/cpanel/redirect_spec.rb +0 -0
- data/spec/cpanel/ssl_spec.rb +138 -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/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 +7 -1
- 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/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_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/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/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/random_data/show.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/fetchcabundle.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/gencrt.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/gencsr.yml +40 -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/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/cert/fetchsslinfo.yml +38 -0
- data/spec/vcr_cassettes/whm/cert/generatessl.yml +38 -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/server/gettweaksetting.yml +44 -0
- data/spec/vcr_cassettes/whm/server/settweaksetting.yml +44 -0
- data/spec/vcr_cassettes/whm/server/themes.yml +38 -0
- data/spec/whm/cert_spec.rb +62 -0
- data/spec/whm/server_spec.rb +79 -3
- metadata +376 -34
- data/.rvmrc +0 -49
@@ -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
|
+
|
@@ -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,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,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
|
+
|