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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8729386fae62f1240d8ca35e0b2440a5c13fd121
4
- data.tar.gz: 0da476df19735bf334e8addb63f6507e1946a6be
3
+ metadata.gz: 852542026317752bc04944c381f01bd47bd7aac3
4
+ data.tar.gz: 54205352af91ff3517f4dcc4dafc731e5b896455
5
5
  SHA512:
6
- metadata.gz: 48a7cf27c6d95dd99e2fe3553f8c91fe12a96a58996c38f0058997131798d55b5c317876a255d04059d586b36386a35cf3ba1749529766bfadf7f209681be0b7
7
- data.tar.gz: ec675a24333fa0ba2b7e6070959c57eb7663a4df9b7a351818ecb5a165e50f7a20ce5e0a53a6818cddefaacc819e99d8f2eb0ce9b7d2f18656948d7becef927c
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.8.7, 1.9.2, REE and JRuby 1.6.0 on
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
- :host => WHM_HOST,
30
- :hash => WHM_HASH
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
- :host => WHM_HOST,
39
- :user => USERNAME,
40
- :hash => 'my_password'
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
- :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"
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
- :username => 'newuser',
115
- :domain => 'newuser.com',
116
- :password => 'password'
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(:search => 'new', :searchtype => 'user')
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(:username => 'newuser', :reason => 'bad user')
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(:search => 'new', :searchtype => 'user')
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(:username => 'newuser')
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
- :username => 'rtest',
175
- :domain => 'resellerexample.com',
176
- :password => 'password'
174
+ username: 'rtest',
175
+ domain: 'resellerexample.com',
176
+ password: 'password'
177
177
  )
178
178
 
179
179
  if result[:success]
180
- result = server.reseller.create(:username => 'rtest', :makeowner => true)
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(:username => 'rtest', :reason => 'bad user')
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(:reseller => 'rtest', :terminatereseller => true)
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
- :server => server, # An instance of Lumberg::Server
231
- :api_username => "jerry" # User whose cPanel we'll be interacting with
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
- :domain => "domain.com",
241
- :email => "my-forwarder",
242
- :fwdopt => "fwd",
243
- :fwdemail => "dest@other-domain.com"
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
- :api_function => "spritelist"
312
+ api_function: "spritelist"
313
313
  }.merge(options))
314
314
  end
315
315
  end
@@ -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
- :api_function => "deladdondomain"
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
- :api_function => "addaddondomain"
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
- :api_function => "listaddondomains"
44
+ api_function: "listaddondomains"
45
45
  }.merge(options))
46
46
  end
47
47
  end
@@ -8,7 +8,7 @@ module Lumberg
8
8
  # Returns Hash API response.
9
9
  def list(options = {})
10
10
  perform_request({
11
- :api_function => "listfullbackups"
11
+ api_function: "listfullbackups"
12
12
  }.merge(options))
13
13
  end
14
14
  end
@@ -42,11 +42,11 @@ module Lumberg
42
42
 
43
43
  api_module = options.delete(:api_module) || self.class.api_module
44
44
  params = {
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,
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)
@@ -10,7 +10,7 @@ module Lumberg
10
10
  # Returns Hash API response.
11
11
  def list(options = {})
12
12
  perform_request({
13
- :api_function => "accountmanagelist"
13
+ api_function: "accountmanagelist"
14
14
  }.merge(options))
15
15
  end
16
16
  end
@@ -16,7 +16,7 @@ module Lumberg
16
16
  # Returns Hash API response.
17
17
  def list_pkgs(options = {})
18
18
  perform_request({
19
- :api_function => "showpkgs"
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
- :api_function => "spritelist"
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
- :api_function => "applist"
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
- :api_function => "listobjecttypes"
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
- :api_function => "listimgtypes"
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({ :api_function => 'displaycontactinfo' })
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({ :api_function => 'savecontactinfo' }.merge(options))
34
+ perform_request({ api_function: 'savecontactinfo' }.merge(options))
35
35
  end
36
36
  end
37
37
  end
@@ -9,7 +9,7 @@ module Lumberg
9
9
  # Returns Hash API response.
10
10
  def set_email(options = {})
11
11
  perform_request({
12
- :api_function => "set_email"
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
- :api_function => "get_email"
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
- :api_function => "listcron"
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
- :api_function => "add_line"
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
- :api_function => "remove_line"
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
- :api_function => "edit_line"
84
+ api_function: "edit_line"
85
85
  }.merge(options))
86
86
  end
87
87
  end
@@ -16,7 +16,7 @@ module Lumberg
16
16
  #
17
17
  # Returns Hash API response.
18
18
  def name_to_ip(options = {})
19
- perform_request({ :api_function => 'name2ip' }.merge(options))
19
+ perform_request({ api_function: 'name2ip' }.merge(options))
20
20
  end
21
21
  end
22
22
  end
@@ -8,28 +8,28 @@ module Lumberg
8
8
  #
9
9
  # Returns Hash API response
10
10
  def add
11
- perform_request({ :api_function => "install" })
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({ :api_function => "uninstall" })
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({ :api_function => "installed" })
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({ :api_function => "available" })
32
+ perform_request({ api_function: "available" })
33
33
  end
34
34
  end
35
35
  end