lumberg 2.0.0.pre4 → 2.0.0.pre5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +49 -49
  3. data/lib/lumberg/cpanel.rb +2 -0
  4. data/lib/lumberg/cpanel/addon_domain.rb +3 -3
  5. data/lib/lumberg/cpanel/backups.rb +1 -1
  6. data/lib/lumberg/cpanel/base.rb +5 -5
  7. data/lib/lumberg/cpanel/box_trapper.rb +1 -1
  8. data/lib/lumberg/cpanel/branding.rb +5 -5
  9. data/lib/lumberg/cpanel/contact.rb +2 -2
  10. data/lib/lumberg/cpanel/cron.rb +6 -6
  11. data/lib/lumberg/cpanel/dns_lookup.rb +1 -1
  12. data/lib/lumberg/cpanel/domain_keys.rb +4 -4
  13. data/lib/lumberg/cpanel/domain_lookup.rb +4 -4
  14. data/lib/lumberg/cpanel/email.rb +40 -40
  15. data/lib/lumberg/cpanel/file_manager.rb +5 -5
  16. data/lib/lumberg/cpanel/ftp.rb +101 -0
  17. data/lib/lumberg/cpanel/gpg.rb +4 -4
  18. data/lib/lumberg/cpanel/locale.rb +1 -1
  19. data/lib/lumberg/cpanel/mime.rb +2 -2
  20. data/lib/lumberg/cpanel/mysql.rb +6 -6
  21. data/lib/lumberg/cpanel/net.rb +2 -2
  22. data/lib/lumberg/cpanel/park.rb +4 -4
  23. data/lib/lumberg/cpanel/password.rb +2 -2
  24. data/lib/lumberg/cpanel/password_strength.rb +63 -0
  25. data/lib/lumberg/cpanel/random_data.rb +1 -1
  26. data/lib/lumberg/cpanel/redirect.rb +2 -2
  27. data/lib/lumberg/cpanel/ssl.rb +23 -23
  28. data/lib/lumberg/cpanel/sub_domain.rb +4 -4
  29. data/lib/lumberg/cpanel/support.rb +2 -2
  30. data/lib/lumberg/cpanel/zone_edit.rb +8 -8
  31. data/lib/lumberg/format_whm.rb +7 -7
  32. data/lib/lumberg/version.rb +1 -1
  33. data/lib/lumberg/whm/account.rb +5 -5
  34. data/lib/lumberg/whm/cert.rb +1 -1
  35. data/lib/lumberg/whm/dns.rb +6 -6
  36. data/lib/lumberg/whm/reseller.rb +5 -5
  37. data/lib/lumberg/whm/server.rb +26 -26
  38. data/spec/cpanel/addon_domain_spec.rb +13 -13
  39. data/spec/cpanel/backups_spec.rb +3 -3
  40. data/spec/cpanel/base_spec.rb +19 -19
  41. data/spec/cpanel/box_trapper_spec.rb +3 -3
  42. data/spec/cpanel/branding_spec.rb +3 -3
  43. data/spec/cpanel/contact_spec.rb +6 -6
  44. data/spec/cpanel/cron_spec.rb +51 -51
  45. data/spec/cpanel/dns_lookup_spec.rb +4 -4
  46. data/spec/cpanel/domain_keys_spec.rb +3 -3
  47. data/spec/cpanel/domain_lookup_spec.rb +5 -5
  48. data/spec/cpanel/email_spec.rb +116 -116
  49. data/spec/cpanel/file_manager_spec.rb +11 -11
  50. data/spec/cpanel/ftp_spec.rb +71 -0
  51. data/spec/cpanel/gpg_spec.rb +3 -3
  52. data/spec/cpanel/locale_spec.rb +3 -3
  53. data/spec/cpanel/net_spec.rb +4 -4
  54. data/spec/cpanel/park_spec.rb +7 -7
  55. data/spec/cpanel/password_spec.rb +5 -5
  56. data/spec/cpanel/password_strength_spec.rb +50 -0
  57. data/spec/cpanel/random_data_spec.rb +4 -4
  58. data/spec/cpanel/ssl_spec.rb +27 -27
  59. data/spec/cpanel/sub_domain_spec.rb +8 -8
  60. data/spec/cpanel/support_spec.rb +4 -4
  61. data/spec/spec_helper.rb +1 -1
  62. data/spec/vcr_cassettes/cpanel/ftp/addftp.yml +43 -0
  63. data/spec/vcr_cassettes/cpanel/ftp/delftp.yml +43 -0
  64. data/spec/vcr_cassettes/cpanel/ftp/listftp.yml +43 -0
  65. data/spec/vcr_cassettes/cpanel/ftp/listftpsessions.yml +43 -0
  66. data/spec/vcr_cassettes/cpanel/ftp/listftpwithdisk.yml +95 -0
  67. data/spec/vcr_cassettes/cpanel/ftp/passwd.yml +43 -0
  68. data/spec/vcr_cassettes/cpanel/ftp/setquota.yml +43 -0
  69. data/spec/vcr_cassettes/cpanel/password_strength/all_required_strengths.yml +43 -0
  70. data/spec/vcr_cassettes/cpanel/password_strength/required_strength.yml +43 -0
  71. data/spec/vcr_cassettes/cpanel/password_strength/strength.yml +83 -0
  72. data/spec/whm/account_spec.rb +69 -69
  73. data/spec/whm/base_spec.rb +3 -3
  74. data/spec/whm/cert_spec.rb +24 -24
  75. data/spec/whm/dns_spec.rb +36 -36
  76. data/spec/whm/reseller_spec.rb +36 -36
  77. data/spec/whm/server_spec.rb +22 -22
  78. data/spec/whm/whm_spec.rb +8 -8
  79. metadata +29 -2
@@ -6,7 +6,7 @@ module Lumberg
6
6
  #
7
7
  # Returns Hash API response
8
8
  def list
9
- perform_request({ :api_function => 'listgpgkeys' })
9
+ perform_request({ api_function: 'listgpgkeys' })
10
10
  end
11
11
 
12
12
  # Public: Count the number of public GPG keys installed for a user. You
@@ -14,21 +14,21 @@ module Lumberg
14
14
  #
15
15
  # Returns Hash API response
16
16
  def count
17
- perform_request({ :api_function => 'number_of_public_keys' })
17
+ perform_request({ api_function: 'number_of_public_keys' })
18
18
  end
19
19
 
20
20
  # Public: List GPG private (secret) keys associated with a user
21
21
  #
22
22
  # Returns Hash API response
23
23
  def list_private
24
- perform_request({ :api_function => 'listsecretgpgkeys' })
24
+ perform_request({ api_function: 'listsecretgpgkeys' })
25
25
  end
26
26
 
27
27
  # Public: Count the number of private GPG keys installed for a user
28
28
  #
29
29
  # Returns Hash API response
30
30
  def count_private
31
- perform_request({ :api_function => 'number_of_private_keys' })
31
+ perform_request({ api_function: 'number_of_private_keys' })
32
32
  end
33
33
  end
34
34
  end
@@ -6,7 +6,7 @@ module Lumberg
6
6
  #
7
7
  # Returns Hash API response
8
8
  def show
9
- perform_request({ :api_function => 'get_encoding' })
9
+ perform_request({ api_function: 'get_encoding' })
10
10
  end
11
11
  end
12
12
  end
@@ -12,7 +12,7 @@ module Lumberg
12
12
  #
13
13
  # Returns Hash API response
14
14
  def list(options = {})
15
- perform_request({ :api_function => 'listmime' }.merge(options))
15
+ perform_request({ api_function: 'listmime' }.merge(options))
16
16
  end
17
17
 
18
18
  # Public: List handlers associated with Apache
@@ -25,7 +25,7 @@ module Lumberg
25
25
  #
26
26
  # Returns Hash API response
27
27
  def handlers(options = {})
28
- perform_request({ :api_function => 'listhandlers' }.merge(options))
28
+ perform_request({ api_function: 'listhandlers' }.merge(options))
29
29
  end
30
30
  end
31
31
  end
@@ -11,28 +11,28 @@ module Lumberg
11
11
  #
12
12
  # Returns Hash API response
13
13
  def list(options = {})
14
- perform_request({ :api_function => 'listdbs' }.merge(options))
14
+ perform_request({ api_function: 'listdbs' }.merge(options))
15
15
  end
16
16
 
17
17
  # Public: List all of the MySQL users available to a cPanel account
18
18
  #
19
19
  # Returns Hash API response
20
20
  def accounts
21
- perform_request({ :api_function => 'listusers' })
21
+ perform_request({ api_function: 'listusers' })
22
22
  end
23
23
 
24
24
  # Public: Retrieve a list of remote MySQL connection hosts
25
25
  #
26
26
  # Returns Hash API response
27
27
  def remote_hosts
28
- perform_request({ :api_function => 'listhosts' })
28
+ perform_request({ api_function: 'listhosts' })
29
29
  end
30
30
 
31
31
  # Public: Retrieve a list of existing database backups
32
32
  #
33
33
  # Returns Hash API response
34
34
  def backups
35
- perform_request({ :api_function => 'listdbsbackup' })
35
+ perform_request({ api_function: 'listdbsbackup' })
36
36
  end
37
37
 
38
38
  # Public: List users who can access a particular database
@@ -44,7 +44,7 @@ module Lumberg
44
44
  #
45
45
  # Returns Hash API response
46
46
  def usernames_for_db(options = {})
47
- perform_request({ :api_function => 'listusersindb' })
47
+ perform_request({ api_function: 'listusersindb' })
48
48
  end
49
49
 
50
50
  # Public: Retrieve a list of permissions that correspond to a specific
@@ -57,7 +57,7 @@ module Lumberg
57
57
  #
58
58
  # Returns Hash API response
59
59
  def permissions(options = {})
60
- perform_request({ :api_function => 'userdbprivs' }.merge(options))
60
+ perform_request({ api_function: 'userdbprivs' }.merge(options))
61
61
  end
62
62
  end
63
63
  end
@@ -7,7 +7,7 @@ module Lumberg
7
7
  #
8
8
  # Returns Hash API response
9
9
  def traceroute
10
- perform_request({ :api_function => 'traceroute' })
10
+ perform_request({ api_function: 'traceroute' })
11
11
  end
12
12
 
13
13
  # Public: Performs an A record DNS query for the hostname presented via
@@ -20,7 +20,7 @@ module Lumberg
20
20
  #
21
21
  # Returns Hash API response
22
22
  def query_hostname(options = {})
23
- perform_request({ :api_function => 'dnszone' }.merge(options))
23
+ perform_request({ api_function: 'dnszone' }.merge(options))
24
24
  end
25
25
  end
26
26
  end
@@ -11,7 +11,7 @@ module Lumberg
11
11
  # Returns Hash API response.
12
12
  def add(options = {})
13
13
  perform_request({
14
- :api_function => "park"
14
+ api_function: "park"
15
15
  }.merge(options))
16
16
  end
17
17
 
@@ -23,7 +23,7 @@ module Lumberg
23
23
  # Returns Hash API response.
24
24
  def remove(options = {})
25
25
  perform_request({
26
- :api_function => "unpark"
26
+ api_function: "unpark"
27
27
  }.merge(options))
28
28
  end
29
29
 
@@ -36,7 +36,7 @@ module Lumberg
36
36
  # Returns Hash API response.
37
37
  def list(options = {})
38
38
  perform_request({
39
- :api_function => "listparkeddomains"
39
+ api_function: "listparkeddomains"
40
40
  }.merge(options))
41
41
  end
42
42
 
@@ -49,7 +49,7 @@ module Lumberg
49
49
  # Returns Hash API response.
50
50
  def list_addon_domains(options = {})
51
51
  perform_request({
52
- :api_function => "listaddondomains"
52
+ api_function: "listaddondomains"
53
53
  }.merge(options))
54
54
  end
55
55
 
@@ -19,7 +19,7 @@ module Lumberg
19
19
  #
20
20
  # Returns Hash API response.
21
21
  def modify(options = {})
22
- perform_request({ :api_function => 'change_password' }.merge(options))
22
+ perform_request({ api_function: 'change_password' }.merge(options))
23
23
  end
24
24
 
25
25
  # Public: Enables or disables Digest Authentication for an account.
@@ -44,7 +44,7 @@ module Lumberg
44
44
  # Returns Hash API response.
45
45
  def digest_authentication(options = {})
46
46
  options[:enabledigest] = options.delete([:enable]) ? 1 : 0
47
- perform_request({ :api_function => 'set_digest_auth' }.merge(options))
47
+ perform_request({ api_function: 'set_digest_auth' }.merge(options))
48
48
  end
49
49
  end
50
50
  end
@@ -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
@@ -17,7 +17,7 @@ module Lumberg
17
17
  #
18
18
  # Returns Hash API response
19
19
  def show(options = {})
20
- perform_request({ :api_function => 'getranddata' }.merge(options))
20
+ perform_request({ api_function: 'getranddata' }.merge(options))
21
21
  end
22
22
  end
23
23
  end
@@ -14,7 +14,7 @@ module Lumberg
14
14
  #
15
15
  # Returns Hash API response
16
16
  def list(options = {})
17
- perform_request({ :api_function => 'listredirects' }.merge(options))
17
+ perform_request({ api_function: 'listredirects' }.merge(options))
18
18
  end
19
19
 
20
20
  # Public: This function returns either the domain name entered or '** All
@@ -35,7 +35,7 @@ module Lumberg
35
35
  "#{self.class.name}##{__method__} cannot accept both `:url` and `:domain`"
36
36
  end
37
37
  function = options[:domain].present? ? 'redirectname' : 'redirecturlname'
38
- perform_request({ :api_function => function }.merge(options))
38
+ perform_request({ api_function: function }.merge(options))
39
39
  end
40
40
  end
41
41
  end
@@ -15,7 +15,7 @@ module Lumberg
15
15
  # Returns Hash API response.
16
16
  def installssl(options = {})
17
17
  perform_request({
18
- :api_function => "installssl"
18
+ api_function: "installssl"
19
19
  }.merge(options))
20
20
  end
21
21
 
@@ -26,7 +26,7 @@ module Lumberg
26
26
  # Returns Hash API response.
27
27
  def listcsrs(options = {})
28
28
  perform_request({
29
- :api_function => "listcsrs",
29
+ api_function: "listcsrs",
30
30
  }.merge(options))
31
31
  end
32
32
 
@@ -39,10 +39,10 @@ module Lumberg
39
39
  # Returns Hash API response.
40
40
  def showcsr(options = {})
41
41
  perform_request({
42
- :api_function => "showcsr",
43
- :api_version => 1,
44
- :user => options[:user],
45
- :response_key => "data",
42
+ api_function: "showcsr",
43
+ api_version: 1,
44
+ user: options[:user],
45
+ response_key: "data",
46
46
  "arg-0" => options[:domain],
47
47
  "arg-1" => options[:textmode]
48
48
  })
@@ -57,10 +57,10 @@ module Lumberg
57
57
  # Returns Hash API response.
58
58
  def showkey(options = {})
59
59
  perform_request({
60
- :api_function => "showkey",
61
- :api_version => 1,
62
- :user => options[:user],
63
- :response_key => "data",
60
+ api_function: "showkey",
61
+ api_version: 1,
62
+ user: options[:user],
63
+ response_key: "data",
64
64
  "arg-0" => options[:domain],
65
65
  "arg-1" => options[:textmode]
66
66
  })
@@ -73,10 +73,10 @@ module Lumberg
73
73
  # Returns Hash API response.
74
74
  def showcrt(options = {})
75
75
  perform_request({
76
- :api_function => "showcrt",
77
- :api_version => 1,
78
- :user => options[:user],
79
- :response_key => "data",
76
+ api_function: "showcrt",
77
+ api_version: 1,
78
+ user: options[:user],
79
+ response_key: "data",
80
80
  "arg-0" => options[:domain],
81
81
  "arg-1" => options[:textmode]
82
82
  })
@@ -89,7 +89,7 @@ module Lumberg
89
89
  # Returns Hash API response.
90
90
  def listcrts(options = {})
91
91
  perform_request({
92
- :api_function => "listcrts",
92
+ api_function: "listcrts",
93
93
  }.merge(options))
94
94
  end
95
95
 
@@ -100,7 +100,7 @@ module Lumberg
100
100
  # Returns Hash API response.
101
101
  def listkeys(options = {})
102
102
  perform_request({
103
- :api_function => "listkeys",
103
+ api_function: "listkeys",
104
104
  }.merge(options))
105
105
  end
106
106
 
@@ -112,7 +112,7 @@ module Lumberg
112
112
  # Returns Hash API response.
113
113
  def fetchcabundle(options = {})
114
114
  perform_request({
115
- :api_function => "fetchcabundle",
115
+ api_function: "fetchcabundle",
116
116
  }.merge(options))
117
117
  end
118
118
 
@@ -126,7 +126,7 @@ module Lumberg
126
126
  # Returns Hash API response.
127
127
  def listsslitems(options = {})
128
128
  perform_request({
129
- :api_function => "listsslitems",
129
+ api_function: "listsslitems",
130
130
  }.merge(options))
131
131
  end
132
132
 
@@ -149,8 +149,8 @@ module Lumberg
149
149
  options[:companydivision] = options.delete(:company_division)
150
150
 
151
151
  perform_request({
152
- :api_function => "gencsr",
153
- :response_key => "cpanelresult",
152
+ api_function: "gencsr",
153
+ response_key: "cpanelresult",
154
154
  }.merge(options))
155
155
  end
156
156
 
@@ -172,7 +172,7 @@ module Lumberg
172
172
  options[:companydivision] = options.delete(:company_division)
173
173
 
174
174
  perform_request({
175
- :api_function => "gencrt",
175
+ api_function: "gencrt",
176
176
  }.merge(options))
177
177
  end
178
178
 
@@ -186,7 +186,7 @@ module Lumberg
186
186
  # Returns Hash API response.
187
187
  def genkey(options = {})
188
188
  perform_request({
189
- :api_function => "genkey",
189
+ api_function: "genkey",
190
190
  }.merge(options))
191
191
  end
192
192
 
@@ -198,7 +198,7 @@ module Lumberg
198
198
  # Returns Hash API response.
199
199
  def uploadcrt(options = {})
200
200
  perform_request({
201
- :api_function => "uploadcrt",
201
+ api_function: "uploadcrt",
202
202
  }.merge(options))
203
203
  end
204
204
  end
@@ -15,7 +15,7 @@ module Lumberg
15
15
  # Returns Hash API response.
16
16
  def add(options = {})
17
17
  perform_request({
18
- :api_function => "addsubdomain"
18
+ api_function: "addsubdomain"
19
19
  }.merge(options))
20
20
  end
21
21
 
@@ -27,7 +27,7 @@ module Lumberg
27
27
  # Returns Hash API response.
28
28
  def remove(options = {})
29
29
  perform_request({
30
- :api_function => "delsubdomain"
30
+ api_function: "delsubdomain"
31
31
  }.merge(options))
32
32
  end
33
33
 
@@ -39,7 +39,7 @@ module Lumberg
39
39
  # Returns Hash API response.
40
40
  def list(options = {})
41
41
  perform_request({
42
- :api_function => "listsubdomains"
42
+ api_function: "listsubdomains"
43
43
  }.merge(options))
44
44
  end
45
45
 
@@ -53,7 +53,7 @@ module Lumberg
53
53
  # Returns Hash API response
54
54
  def modify(options = {})
55
55
  perform_request({
56
- :api_function => "changedocroot"
56
+ api_function: "changedocroot"
57
57
  }.merge(options))
58
58
  end
59
59
  end
@@ -13,7 +13,7 @@ module Lumberg
13
13
  # Returns Hash API response.
14
14
  def open_ticket(options = {})
15
15
  perform_request({
16
- :api_function => "sendcontact"
16
+ api_function: "sendcontact"
17
17
  }.merge(options))
18
18
  end
19
19
 
@@ -22,7 +22,7 @@ module Lumberg
22
22
  #
23
23
  # Returns Hash API response
24
24
  def contactable
25
- perform_request({ :api_function => "isenabled" })
25
+ perform_request({ api_function: "isenabled" })
26
26
  end
27
27
  end
28
28
  end