lumberg 2.0.0.pre4 → 2.0.0.pre5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +49 -49
- data/lib/lumberg/cpanel.rb +2 -0
- data/lib/lumberg/cpanel/addon_domain.rb +3 -3
- data/lib/lumberg/cpanel/backups.rb +1 -1
- data/lib/lumberg/cpanel/base.rb +5 -5
- data/lib/lumberg/cpanel/box_trapper.rb +1 -1
- data/lib/lumberg/cpanel/branding.rb +5 -5
- data/lib/lumberg/cpanel/contact.rb +2 -2
- data/lib/lumberg/cpanel/cron.rb +6 -6
- data/lib/lumberg/cpanel/dns_lookup.rb +1 -1
- data/lib/lumberg/cpanel/domain_keys.rb +4 -4
- data/lib/lumberg/cpanel/domain_lookup.rb +4 -4
- data/lib/lumberg/cpanel/email.rb +40 -40
- data/lib/lumberg/cpanel/file_manager.rb +5 -5
- data/lib/lumberg/cpanel/ftp.rb +101 -0
- data/lib/lumberg/cpanel/gpg.rb +4 -4
- data/lib/lumberg/cpanel/locale.rb +1 -1
- data/lib/lumberg/cpanel/mime.rb +2 -2
- data/lib/lumberg/cpanel/mysql.rb +6 -6
- data/lib/lumberg/cpanel/net.rb +2 -2
- data/lib/lumberg/cpanel/park.rb +4 -4
- data/lib/lumberg/cpanel/password.rb +2 -2
- data/lib/lumberg/cpanel/password_strength.rb +63 -0
- data/lib/lumberg/cpanel/random_data.rb +1 -1
- data/lib/lumberg/cpanel/redirect.rb +2 -2
- data/lib/lumberg/cpanel/ssl.rb +23 -23
- data/lib/lumberg/cpanel/sub_domain.rb +4 -4
- data/lib/lumberg/cpanel/support.rb +2 -2
- data/lib/lumberg/cpanel/zone_edit.rb +8 -8
- data/lib/lumberg/format_whm.rb +7 -7
- data/lib/lumberg/version.rb +1 -1
- data/lib/lumberg/whm/account.rb +5 -5
- data/lib/lumberg/whm/cert.rb +1 -1
- data/lib/lumberg/whm/dns.rb +6 -6
- data/lib/lumberg/whm/reseller.rb +5 -5
- data/lib/lumberg/whm/server.rb +26 -26
- data/spec/cpanel/addon_domain_spec.rb +13 -13
- data/spec/cpanel/backups_spec.rb +3 -3
- data/spec/cpanel/base_spec.rb +19 -19
- data/spec/cpanel/box_trapper_spec.rb +3 -3
- data/spec/cpanel/branding_spec.rb +3 -3
- data/spec/cpanel/contact_spec.rb +6 -6
- data/spec/cpanel/cron_spec.rb +51 -51
- data/spec/cpanel/dns_lookup_spec.rb +4 -4
- data/spec/cpanel/domain_keys_spec.rb +3 -3
- data/spec/cpanel/domain_lookup_spec.rb +5 -5
- data/spec/cpanel/email_spec.rb +116 -116
- data/spec/cpanel/file_manager_spec.rb +11 -11
- data/spec/cpanel/ftp_spec.rb +71 -0
- data/spec/cpanel/gpg_spec.rb +3 -3
- data/spec/cpanel/locale_spec.rb +3 -3
- data/spec/cpanel/net_spec.rb +4 -4
- data/spec/cpanel/park_spec.rb +7 -7
- data/spec/cpanel/password_spec.rb +5 -5
- data/spec/cpanel/password_strength_spec.rb +50 -0
- data/spec/cpanel/random_data_spec.rb +4 -4
- data/spec/cpanel/ssl_spec.rb +27 -27
- data/spec/cpanel/sub_domain_spec.rb +8 -8
- data/spec/cpanel/support_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -1
- 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/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/whm/account_spec.rb +69 -69
- data/spec/whm/base_spec.rb +3 -3
- data/spec/whm/cert_spec.rb +24 -24
- data/spec/whm/dns_spec.rb +36 -36
- data/spec/whm/reseller_spec.rb +36 -36
- data/spec/whm/server_spec.rb +22 -22
- data/spec/whm/whm_spec.rb +8 -8
- metadata +29 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 852542026317752bc04944c381f01bd47bd7aac3
|
4
|
+
data.tar.gz: 54205352af91ff3517f4dcc4dafc731e5b896455
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94ee04c10241649fabb4704b89088d874a85ce1292ccbb2cfff7e9d387e99782a56ae3626a279a0379cb031ebcec017e24ebce627785d1f3c6d7469a88462b1e
|
7
|
+
data.tar.gz: 6f4680fbf24f2a0fc8a7e6561c59da38c15bc3000c97e186acd18dfa7873a0f64d8ab449dce0f9b619389cf74fd568b5e9907263cb616073c324380f5b563240
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ beta-ish. Please report any issues you find. :)
|
|
7
7
|
|
8
8
|
[RDoc](http://rdoc.info/github/site5/lumberg/master/frames)
|
9
9
|
|
10
|
-
Confirmed to work with ruby 1.
|
10
|
+
Confirmed to work with ruby 1.9.3, 2.0.0 and JRuby 1.9 mode on
|
11
11
|
cPanel 11.28+
|
12
12
|
|
13
13
|
[Build Status]: http://travis-ci.org/site5/lumberg
|
@@ -26,8 +26,8 @@ Create a server object and connect to WHM using your host and hash:
|
|
26
26
|
```ruby
|
27
27
|
require 'lumberg'
|
28
28
|
server = Lumberg::Whm::Server.new(
|
29
|
-
:
|
30
|
-
:
|
29
|
+
host: WHM_HOST,
|
30
|
+
hash: WHM_HASH
|
31
31
|
)
|
32
32
|
```
|
33
33
|
|
@@ -35,9 +35,9 @@ If you are using HTTP Basic Authentication with a username/password:
|
|
35
35
|
|
36
36
|
```ruby
|
37
37
|
server = Lumberg::Whm::Server.new(
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
38
|
+
host: WHM_HOST,
|
39
|
+
user: USERNAME,
|
40
|
+
hash: 'my_password'
|
41
41
|
)
|
42
42
|
```
|
43
43
|
|
@@ -78,29 +78,29 @@ Here's an example of what the returned data looks like for a single account
|
|
78
78
|
pp result[:params][:acct].first
|
79
79
|
|
80
80
|
{
|
81
|
-
:
|
82
|
-
:
|
83
|
-
:
|
84
|
-
:
|
85
|
-
:
|
86
|
-
:
|
87
|
-
:
|
88
|
-
:
|
89
|
-
:
|
90
|
-
:
|
91
|
-
:
|
92
|
-
:
|
93
|
-
:
|
94
|
-
:
|
95
|
-
:
|
96
|
-
:
|
97
|
-
:
|
98
|
-
:
|
99
|
-
:
|
100
|
-
:
|
101
|
-
:
|
102
|
-
:
|
103
|
-
:
|
81
|
+
startdate: false,
|
82
|
+
plan: "default",
|
83
|
+
suspended: false,
|
84
|
+
theme: "x3",
|
85
|
+
shell: "/usr/local/cpanel/bin/jailshell",
|
86
|
+
maxpop: "unlimited",
|
87
|
+
maxlst: "unlimited",
|
88
|
+
maxaddons: "*unknown*",
|
89
|
+
suspendtime: nil,
|
90
|
+
ip: false,
|
91
|
+
maxsub: "unlimited",
|
92
|
+
domain: "bob.com",
|
93
|
+
maxsql: "unlimited",
|
94
|
+
partition: "home",
|
95
|
+
maxftp: "unlimited",
|
96
|
+
user: "bob",
|
97
|
+
suspendreason: "not suspended",
|
98
|
+
unix_startdate: false,
|
99
|
+
diskused: false,
|
100
|
+
maxparked: "*unknown*",
|
101
|
+
email: "*unknown*",
|
102
|
+
disklimit: "unlimited",
|
103
|
+
owner: "root"
|
104
104
|
}
|
105
105
|
```
|
106
106
|
|
@@ -111,9 +111,9 @@ Creating a new account requires only a username, domain, and password.
|
|
111
111
|
|
112
112
|
```ruby
|
113
113
|
result = server.account.create(
|
114
|
-
:
|
115
|
-
:
|
116
|
-
:
|
114
|
+
username: 'newuser',
|
115
|
+
domain: 'newuser.com',
|
116
|
+
password: 'password'
|
117
117
|
)
|
118
118
|
|
119
119
|
if result[:success]
|
@@ -126,7 +126,7 @@ Account Creation Ok
|
|
126
126
|
You can list all accounts or search for a specific account.
|
127
127
|
|
128
128
|
```ruby
|
129
|
-
result = server.account.list(:
|
129
|
+
result = server.account.list(search: 'new', searchtype: 'user')
|
130
130
|
acct = result[:params][:acct].first
|
131
131
|
p "Found user '#{acct[:user]}' with domain '#{acct[:domain]}'"
|
132
132
|
|
@@ -137,7 +137,7 @@ Found user 'newuser' with domain 'newuser.com'
|
|
137
137
|
Suspending an account is simple and the reason for suspension is optional.
|
138
138
|
|
139
139
|
```ruby
|
140
|
-
result = server.account.suspend(:
|
140
|
+
result = server.account.suspend(username: 'newuser', reason: 'bad user')
|
141
141
|
p "user was suspended successfully" if result[:success]
|
142
142
|
|
143
143
|
user was suspended successfully
|
@@ -147,7 +147,7 @@ We can look at the account list again to see the reason for the user's
|
|
147
147
|
suspension.
|
148
148
|
|
149
149
|
```ruby
|
150
|
-
result = server.account.list(:
|
150
|
+
result = server.account.list(search: 'new', searchtype: 'user')
|
151
151
|
acct = result[:params][:acct].first
|
152
152
|
p "user '#{acct[:user]}' was suspended with reason '#{acct[:suspendreason]}'"
|
153
153
|
|
@@ -157,7 +157,7 @@ user 'newuser' was suspended with reason 'bad user'
|
|
157
157
|
Finally, we remove the user and delete their account.
|
158
158
|
|
159
159
|
```ruby
|
160
|
-
result = server.account.remove(:
|
160
|
+
result = server.account.remove(username: 'newuser')
|
161
161
|
p result[:message]
|
162
162
|
|
163
163
|
newuser account removed
|
@@ -171,13 +171,13 @@ so first we create a user account and then we can create that user as a reseller
|
|
171
171
|
|
172
172
|
```ruby
|
173
173
|
result = server.account.create(
|
174
|
-
:
|
175
|
-
:
|
176
|
-
:
|
174
|
+
username: 'rtest',
|
175
|
+
domain: 'resellerexample.com',
|
176
|
+
password: 'password'
|
177
177
|
)
|
178
178
|
|
179
179
|
if result[:success]
|
180
|
-
result = server.reseller.create(:
|
180
|
+
result = server.reseller.create(username: 'rtest', makeowner: true)
|
181
181
|
p "created reseller rtest" if result[:success]
|
182
182
|
end
|
183
183
|
|
@@ -197,7 +197,7 @@ Suspending a reseller is pretty straightforward. It's optional to provide a
|
|
197
197
|
reason for the suspension.
|
198
198
|
|
199
199
|
```ruby
|
200
|
-
result = server.reseller.suspend(:
|
200
|
+
result = server.reseller.suspend(username: 'rtest', reason: 'bad user')
|
201
201
|
p "reseller was suspended successfully" if result[:success]
|
202
202
|
|
203
203
|
user was suspended successfully
|
@@ -207,7 +207,7 @@ Deleting the reseller removes the reseller status from the user account. To
|
|
207
207
|
also delete the user account, set the `:terminatereseller` argument.
|
208
208
|
|
209
209
|
```ruby
|
210
|
-
result = server.reseller.terminate(:
|
210
|
+
result = server.reseller.terminate(reseller: 'rtest', terminatereseller: true)
|
211
211
|
p result[:message]
|
212
212
|
|
213
213
|
Account Terminations Complete
|
@@ -227,8 +227,8 @@ Lumberg::Cpanel](#extending-lumbergcpanel) for details on how you can help.
|
|
227
227
|
```ruby
|
228
228
|
# Create an interface object for cPanel API Email module
|
229
229
|
email = Lumberg::Cpanel::Email.new(
|
230
|
-
:
|
231
|
-
:
|
230
|
+
server: server, # An instance of Lumberg::Server
|
231
|
+
api_username: "jerry" # User whose cPanel we'll be interacting with
|
232
232
|
)
|
233
233
|
|
234
234
|
# Get a list of email accounts
|
@@ -237,10 +237,10 @@ email.accounts[:params][:data] #=> Array of info hashes for each email account
|
|
237
237
|
# Add an email forwarder to forward mail for my-forwarder@domain.com to
|
238
238
|
# dest@other-domain.com
|
239
239
|
email.add_forwarder(
|
240
|
-
:
|
241
|
-
:
|
242
|
-
:
|
243
|
-
:
|
240
|
+
domain: "domain.com",
|
241
|
+
email: "my-forwarder",
|
242
|
+
fwdopt: "fwd",
|
243
|
+
fwdemail: "dest@other-domain.com"
|
244
244
|
)
|
245
245
|
|
246
246
|
```
|
@@ -309,7 +309,7 @@ email.add_forwarder(
|
|
309
309
|
# Returns Hash API response.
|
310
310
|
def list_sprites(options = {})
|
311
311
|
perform_request({
|
312
|
-
:
|
312
|
+
api_function: "spritelist"
|
313
313
|
}.merge(options))
|
314
314
|
end
|
315
315
|
end
|
data/lib/lumberg/cpanel.rb
CHANGED
@@ -14,6 +14,7 @@ module Lumberg
|
|
14
14
|
require "lumberg/cpanel/dns_lookup"
|
15
15
|
require "lumberg/cpanel/domain_lookup"
|
16
16
|
require "lumberg/cpanel/password"
|
17
|
+
require "lumberg/cpanel/password_strength"
|
17
18
|
require "lumberg/cpanel/file_manager"
|
18
19
|
require "lumberg/cpanel/zone_edit"
|
19
20
|
require "lumberg/cpanel/support"
|
@@ -25,5 +26,6 @@ module Lumberg
|
|
25
26
|
require "lumberg/cpanel/locale"
|
26
27
|
require "lumberg/cpanel/mysql"
|
27
28
|
require "lumberg/cpanel/domain_keys"
|
29
|
+
require "lumberg/cpanel/ftp"
|
28
30
|
end
|
29
31
|
end
|
@@ -13,7 +13,7 @@ module Lumberg
|
|
13
13
|
# Returns Hash API response.
|
14
14
|
def remove(options = {})
|
15
15
|
perform_request({
|
16
|
-
:
|
16
|
+
api_function: "deladdondomain"
|
17
17
|
}.merge(options))
|
18
18
|
end
|
19
19
|
|
@@ -28,7 +28,7 @@ module Lumberg
|
|
28
28
|
# Returns Hash API response.
|
29
29
|
def add(options = {})
|
30
30
|
perform_request({
|
31
|
-
:
|
31
|
+
api_function: "addaddondomain"
|
32
32
|
}.merge(options))
|
33
33
|
end
|
34
34
|
|
@@ -41,7 +41,7 @@ module Lumberg
|
|
41
41
|
# Returns Hash API response.
|
42
42
|
def list(options={})
|
43
43
|
perform_request({
|
44
|
-
:
|
44
|
+
api_function: "listaddondomains"
|
45
45
|
}.merge(options))
|
46
46
|
end
|
47
47
|
end
|
data/lib/lumberg/cpanel/base.rb
CHANGED
@@ -42,11 +42,11 @@ module Lumberg
|
|
42
42
|
|
43
43
|
api_module = options.delete(:api_module) || self.class.api_module
|
44
44
|
params = {
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
45
|
+
response_key: options.delete(:response_key) || "cpanelresult",
|
46
|
+
cpanel_jsonapi_user: options.delete(:api_username),
|
47
|
+
cpanel_jsonapi_module: api_module,
|
48
|
+
cpanel_jsonapi_func: options.delete(:api_function),
|
49
|
+
cpanel_jsonapi_apiversion: options.delete(:api_version) || 2,
|
50
50
|
}.merge(options)
|
51
51
|
|
52
52
|
server.perform_request("cpanel", params)
|
@@ -16,7 +16,7 @@ module Lumberg
|
|
16
16
|
# Returns Hash API response.
|
17
17
|
def list_pkgs(options = {})
|
18
18
|
perform_request({
|
19
|
-
:
|
19
|
+
api_function: "showpkgs"
|
20
20
|
}.merge(options))
|
21
21
|
end
|
22
22
|
|
@@ -43,7 +43,7 @@ module Lumberg
|
|
43
43
|
# Returns Hash API response.
|
44
44
|
def list_sprites(options = {})
|
45
45
|
perform_request({
|
46
|
-
:
|
46
|
+
api_function: "spritelist"
|
47
47
|
}.merge(options))
|
48
48
|
end
|
49
49
|
|
@@ -59,7 +59,7 @@ module Lumberg
|
|
59
59
|
# Returns Hash API response.
|
60
60
|
def list_icons(options = {})
|
61
61
|
perform_request({
|
62
|
-
:
|
62
|
+
api_function: "applist"
|
63
63
|
}.merge(options))
|
64
64
|
end
|
65
65
|
|
@@ -70,7 +70,7 @@ module Lumberg
|
|
70
70
|
# Returns Hash API response.
|
71
71
|
def list_object_types(options = {})
|
72
72
|
perform_request({
|
73
|
-
:
|
73
|
+
api_function: "listobjecttypes"
|
74
74
|
}.merge(options))
|
75
75
|
end
|
76
76
|
|
@@ -81,7 +81,7 @@ module Lumberg
|
|
81
81
|
# Returns Hash API response.
|
82
82
|
def list_image_types(options = {})
|
83
83
|
perform_request({
|
84
|
-
:
|
84
|
+
api_function: "listimgtypes"
|
85
85
|
}.merge(options))
|
86
86
|
end
|
87
87
|
end
|
@@ -8,7 +8,7 @@ module Lumberg
|
|
8
8
|
#
|
9
9
|
# Returns Hash API response
|
10
10
|
def show
|
11
|
-
perform_request({ :
|
11
|
+
perform_request({ api_function: 'displaycontactinfo' })
|
12
12
|
end
|
13
13
|
|
14
14
|
# Public: Updates the user's contact info and settings for email
|
@@ -31,7 +31,7 @@ module Lumberg
|
|
31
31
|
options[:notify_disk_limit] = options.delete(:disk_quota)
|
32
32
|
options[:notify_bandwidth_limit] = options.delete(:bandwidth)
|
33
33
|
options[:notify_email_quota_limit] = options.delete(:email_quota)
|
34
|
-
perform_request({ :
|
34
|
+
perform_request({ api_function: 'savecontactinfo' }.merge(options))
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
data/lib/lumberg/cpanel/cron.rb
CHANGED
@@ -9,7 +9,7 @@ module Lumberg
|
|
9
9
|
# Returns Hash API response.
|
10
10
|
def set_email(options = {})
|
11
11
|
perform_request({
|
12
|
-
:
|
12
|
+
api_function: "set_email"
|
13
13
|
}.merge(options))
|
14
14
|
end
|
15
15
|
|
@@ -20,7 +20,7 @@ module Lumberg
|
|
20
20
|
# Returns Hash API response.
|
21
21
|
def email(options = {})
|
22
22
|
perform_request({
|
23
|
-
:
|
23
|
+
api_function: "get_email"
|
24
24
|
}.merge(options))
|
25
25
|
end
|
26
26
|
|
@@ -31,7 +31,7 @@ module Lumberg
|
|
31
31
|
# Returns Hash API response.
|
32
32
|
def list(options = {})
|
33
33
|
perform_request({
|
34
|
-
:
|
34
|
+
api_function: "listcron"
|
35
35
|
}.merge(options))
|
36
36
|
end
|
37
37
|
|
@@ -48,7 +48,7 @@ module Lumberg
|
|
48
48
|
# Returns Hash API response.
|
49
49
|
def add(options = {})
|
50
50
|
perform_request({
|
51
|
-
:
|
51
|
+
api_function: "add_line"
|
52
52
|
}.merge(options))
|
53
53
|
end
|
54
54
|
|
@@ -60,7 +60,7 @@ module Lumberg
|
|
60
60
|
# Returns Hash API response.
|
61
61
|
def remove(options = {})
|
62
62
|
perform_request({
|
63
|
-
:
|
63
|
+
api_function: "remove_line"
|
64
64
|
}.merge(options))
|
65
65
|
end
|
66
66
|
|
@@ -81,7 +81,7 @@ module Lumberg
|
|
81
81
|
# Returns Hash API response.
|
82
82
|
def edit(options = {})
|
83
83
|
perform_request({
|
84
|
-
:
|
84
|
+
api_function: "edit_line"
|
85
85
|
}.merge(options))
|
86
86
|
end
|
87
87
|
end
|
@@ -8,28 +8,28 @@ module Lumberg
|
|
8
8
|
#
|
9
9
|
# Returns Hash API response
|
10
10
|
def add
|
11
|
-
perform_request({ :
|
11
|
+
perform_request({ api_function: "install" })
|
12
12
|
end
|
13
13
|
|
14
14
|
# Public: Remove DomainKeys corresponding to your domain
|
15
15
|
#
|
16
16
|
# Returns Hash API response
|
17
17
|
def remove
|
18
|
-
perform_request({ :
|
18
|
+
perform_request({ api_function: "uninstall" })
|
19
19
|
end
|
20
20
|
|
21
21
|
# Public: Check to see if your domain has DomainKeys installed
|
22
22
|
#
|
23
23
|
# Returns Hash API response
|
24
24
|
def installed
|
25
|
-
perform_request({ :
|
25
|
+
perform_request({ api_function: "installed" })
|
26
26
|
end
|
27
27
|
|
28
28
|
# Public: Check to see if DomainKeys are available on the server
|
29
29
|
#
|
30
30
|
# Returns Hash API response
|
31
31
|
def available
|
32
|
-
perform_request({ :
|
32
|
+
perform_request({ api_function: "available" })
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|