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
@@ -13,7 +13,7 @@ module Lumberg
13
13
  #
14
14
  # Returns Hash API response.
15
15
  def list
16
- perform_request({ :api_function => 'getbasedomains' })
16
+ perform_request({ api_function: 'getbasedomains' })
17
17
  end
18
18
 
19
19
  # Public: Retrieve the absolute and relative paths to a specific domain's
@@ -34,7 +34,7 @@ module Lumberg
34
34
  #
35
35
  # Returns Hash API response.
36
36
  def document_root(options = {})
37
- perform_request({ :api_function => 'getdocroot' }.merge(options))
37
+ perform_request({ api_function: 'getdocroot' }.merge(options))
38
38
  end
39
39
  alias :docroot :document_root
40
40
 
@@ -48,7 +48,7 @@ module Lumberg
48
48
  #
49
49
  # Returns Hash API response.
50
50
  def document_roots
51
- perform_request({ :api_function => 'getdocroots' })
51
+ perform_request({ api_function: 'getdocroots' })
52
52
  end
53
53
  alias :docroots :document_roots
54
54
 
@@ -63,7 +63,7 @@ module Lumberg
63
63
  #
64
64
  # Returns Hash API response.
65
65
  def count
66
- perform_request({ :api_function => 'countbasedomains' })
66
+ perform_request({ api_function: 'countbasedomains' })
67
67
  end
68
68
  end
69
69
  end
@@ -9,7 +9,7 @@ module Lumberg
9
9
  # Returns Hash API response.
10
10
  def main_discard(options = {})
11
11
  perform_request(
12
- :api_function => "checkmaindiscard"
12
+ api_function: "checkmaindiscard"
13
13
  )
14
14
  end
15
15
 
@@ -31,7 +31,7 @@ module Lumberg
31
31
  # Returns Hash API response.
32
32
  def add_forwarder(options = {})
33
33
  perform_request({
34
- :api_function => "addforward"
34
+ api_function: "addforward"
35
35
  }.merge(options))
36
36
  end
37
37
 
@@ -44,7 +44,7 @@ module Lumberg
44
44
  # Returns Hash API response.
45
45
  def forwarders(options = {})
46
46
  perform_request({
47
- :api_function => "listforwards"
47
+ api_function: "listforwards"
48
48
  }.merge(options))
49
49
  end
50
50
 
@@ -56,7 +56,7 @@ module Lumberg
56
56
  # Returns Hash API response.
57
57
  def domains_with_aliases(options = {})
58
58
  perform_request(
59
- :api_function => "listaliasbackups"
59
+ api_function: "listaliasbackups"
60
60
  )
61
61
  end
62
62
 
@@ -71,11 +71,11 @@ module Lumberg
71
71
  # Returns Hash API response.
72
72
  def add_mailing_list(options = {})
73
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]
74
+ api_function: "addlist",
75
+ api_version: 1,
76
+ "arg-0" => options[:list],
77
+ "arg-1" => options[:password],
78
+ "arg-2" => options[:domain]
79
79
  })
80
80
  end
81
81
 
@@ -89,7 +89,7 @@ module Lumberg
89
89
  # Returns Hash API response.
90
90
  def mailing_lists(options = {})
91
91
  perform_request({
92
- :api_function => "listlists"
92
+ api_function: "listlists"
93
93
  }.merge(options))
94
94
  end
95
95
 
@@ -101,7 +101,7 @@ module Lumberg
101
101
  # Returns Hash API response.
102
102
  def domains(options = {})
103
103
  perform_request({
104
- :api_function => "listmaildomains"
104
+ api_function: "listmaildomains"
105
105
  }.merge(options))
106
106
  end
107
107
 
@@ -119,7 +119,7 @@ module Lumberg
119
119
  #
120
120
  # Returns Hash API response.
121
121
  def change_mx(options = {})
122
- perform_request({ :api_function => "changemx" }.merge(options))
122
+ perform_request({ api_function: "changemx" }.merge(options))
123
123
  end
124
124
 
125
125
  # Public: Add an MX record
@@ -134,7 +134,7 @@ module Lumberg
134
134
  #
135
135
  # Returns Hash API response.
136
136
  def add_mx(options = {})
137
- perform_request({ :api_function => "addmx" }.merge(options))
137
+ perform_request({ api_function: "addmx" }.merge(options))
138
138
  end
139
139
 
140
140
  # Public: Get list of mail exchanger information.
@@ -145,7 +145,7 @@ module Lumberg
145
145
  # Returns Hash API response.
146
146
  def mx(options = {})
147
147
  perform_request({
148
- :api_function => "listmxs"
148
+ api_function: "listmxs"
149
149
  }.merge(options))
150
150
  end
151
151
 
@@ -158,7 +158,7 @@ module Lumberg
158
158
  #
159
159
  # Returns Hash API response.
160
160
  def delete_mx(options = {})
161
- perform_request({ :api_function => "delmx" }.merge(options))
161
+ perform_request({ api_function: "delmx" }.merge(options))
162
162
  end
163
163
 
164
164
  # Public: Set a mail exchanger for a specified domain to local,
@@ -171,7 +171,7 @@ module Lumberg
171
171
  #
172
172
  # Returns Hash API response.
173
173
  def set_mx_type(options = {})
174
- perform_request({ :api_function => "setmxcheck" }.merge(options))
174
+ perform_request({ api_function: "setmxcheck" }.merge(options))
175
175
  end
176
176
 
177
177
  # Public: Set mail delivery for a domain.
@@ -186,8 +186,8 @@ module Lumberg
186
186
  # Returns Hash API response.
187
187
  def set_mail_delivery(options = {})
188
188
  perform_request({
189
- :api_function => "setalwaysaccept",
190
- :mxcheck => options[:delivery]
189
+ api_function: "setalwaysaccept",
190
+ mxcheck: options[:delivery]
191
191
  }.merge(options))
192
192
  end
193
193
 
@@ -201,7 +201,7 @@ module Lumberg
201
201
  # Returns Hash API response.
202
202
  def check_local_delivery(options = {})
203
203
  perform_request({
204
- :api_function => "getalwaysaccept"
204
+ api_function: "getalwaysaccept"
205
205
  }.merge(options))
206
206
  end
207
207
 
@@ -245,7 +245,7 @@ module Lumberg
245
245
  # Returns Hash API response.
246
246
  def add_filter(options = {})
247
247
  perform_request({
248
- :api_function => "storefilter"
248
+ api_function: "storefilter"
249
249
  }.merge(options))
250
250
  end
251
251
 
@@ -264,7 +264,7 @@ module Lumberg
264
264
  func = options.delete(:old_style) ? "listfilters" : "filterlist"
265
265
 
266
266
  perform_request({
267
- :api_function => func
267
+ api_function: func
268
268
  }.merge(options))
269
269
  end
270
270
 
@@ -280,7 +280,7 @@ module Lumberg
280
280
  # Returns Hash API response.
281
281
  def add_account(options = {})
282
282
  perform_request({
283
- :api_function => "addpop"
283
+ api_function: "addpop"
284
284
  }.merge(options))
285
285
  end
286
286
 
@@ -306,15 +306,15 @@ module Lumberg
306
306
  # Returns Hash API response.
307
307
  def accounts(options = {})
308
308
  styles = {
309
- :with_disk => "listpopswithdisk",
310
- :without_disk => "listpops",
311
- :with_image => "listpopswithimage",
312
- :single => "listpopssingle"
309
+ with_disk: "listpopswithdisk",
310
+ without_disk: "listpops",
311
+ with_image: "listpopswithimage",
312
+ single: "listpopssingle"
313
313
  }
314
314
  func = styles.fetch(options.delete(:style), styles[:with_disk])
315
315
 
316
316
  perform_request({
317
- :api_function => func
317
+ api_function: func
318
318
  }.merge(options))
319
319
  end
320
320
 
@@ -326,7 +326,7 @@ module Lumberg
326
326
  # Returns Hash API response.
327
327
  def default_address(options = {})
328
328
  perform_request({
329
- :api_function => "listdefaultaddresses"
329
+ api_function: "listdefaultaddresses"
330
330
  }.merge(options))
331
331
  end
332
332
 
@@ -339,7 +339,7 @@ module Lumberg
339
339
  # Returns Hash API response.
340
340
  def disk_usage(options = {})
341
341
  perform_request({
342
- :api_function => "getdiskusage"
342
+ api_function: "getdiskusage"
343
343
  }.merge(options))
344
344
  end
345
345
 
@@ -353,7 +353,7 @@ module Lumberg
353
353
  # Returns Hash API response.
354
354
  def mail_dir(options = {})
355
355
  perform_request({
356
- :api_function => "getabsbrowsedir"
356
+ api_function: "getabsbrowsedir"
357
357
  }.merge(options))
358
358
  end
359
359
 
@@ -370,7 +370,7 @@ module Lumberg
370
370
  # Returns Hash API response.
371
371
  def mail_dirs(options = {})
372
372
  perform_request({
373
- :api_function => "browseboxes"
373
+ api_function: "browseboxes"
374
374
  }.merge(options))
375
375
  end
376
376
 
@@ -383,7 +383,7 @@ module Lumberg
383
383
  #
384
384
  # Returns Hash API response.
385
385
  def remove(options = {})
386
- perform_request({ :api_function => 'delpop' }.merge(options))
386
+ perform_request({ api_function: 'delpop' }.merge(options))
387
387
  end
388
388
 
389
389
  # Public: Modify an email account's quota.
@@ -397,14 +397,14 @@ module Lumberg
397
397
  #
398
398
  # Returns Hash API response.
399
399
  def edit_quota(options = {})
400
- perform_request({ :api_function => 'editquota' }.merge(options))
400
+ perform_request({ api_function: 'editquota' }.merge(options))
401
401
  end
402
402
 
403
403
  # Public: Retrieve a list of character encodings supported by cPanel
404
404
  #
405
405
  # Returns Hash API response.
406
406
  def acceptable_encodings
407
- perform_request({ :api_function => 'fetchcharmaps' })
407
+ perform_request({ api_function: 'fetchcharmaps' })
408
408
  end
409
409
 
410
410
  # Public: Retrieve the destination for email forwarded by a domain
@@ -415,7 +415,7 @@ module Lumberg
415
415
  #
416
416
  # Returns Hash API response
417
417
  def listdomainforwards(options = {})
418
- perform_request({ :api_function => "listdomainforwards" }.merge(options))
418
+ perform_request({ api_function: "listdomainforwards" }.merge(options))
419
419
  end
420
420
 
421
421
  # Public: Retrieve a list of auto responders associated with a domain
@@ -428,14 +428,14 @@ module Lumberg
428
428
  #
429
429
  # Returns Hash API response
430
430
  def listautoresponders(options = {})
431
- perform_request({ :api_function => "listautoresponders" }.merge(options))
431
+ perform_request({ api_function: "listautoresponders" }.merge(options))
432
432
  end
433
433
 
434
434
  # Public: Retrieve a list of domains that use domain-level filters
435
435
  #
436
436
  # Returns Hash API response
437
437
  def listfilterbackups
438
- perform_request({ :api_function => "listfilterbackups" })
438
+ perform_request({ api_function: "listfilterbackups" })
439
439
  end
440
440
 
441
441
  # Public: Retrieve a list of email filters
@@ -453,7 +453,7 @@ module Lumberg
453
453
  #
454
454
  # Returns Hash API response
455
455
  def filterlist(options={})
456
- perform_request({ :api_function => "filterlist" }.merge(options))
456
+ perform_request({ api_function: "filterlist" }.merge(options))
457
457
  end
458
458
 
459
459
  # Public: Test the action of account-level mail filters. You can only
@@ -471,7 +471,7 @@ module Lumberg
471
471
  # Returns Hash API response
472
472
  def tracefilter(options={})
473
473
  options[:msg] = options.delete(:message)
474
- perform_request({ :api_function => "tracefilter" }.merge(options))
474
+ perform_request({ api_function: "tracefilter" }.merge(options))
475
475
  end
476
476
 
477
477
  # Public: Retrieve information about an auto responder used by a
@@ -483,7 +483,7 @@ module Lumberg
483
483
  #
484
484
  # Returns Hash API response
485
485
  def fetchautoresponder(options={})
486
- perform_request({ :api_function => "fetchautoresponder" }.merge(options))
486
+ perform_request({ api_function: "fetchautoresponder" }.merge(options))
487
487
  end
488
488
  end
489
489
  end
@@ -57,7 +57,7 @@ module Lumberg
57
57
  options[:checkleaf] = options.delete(:check_leaf)
58
58
  options[:showdotfiles] = options.delete(:show_dot_files)
59
59
 
60
- perform_request({ :api_function => 'listfiles' }.merge(options))
60
+ perform_request({ api_function: 'listfiles' }.merge(options))
61
61
  end
62
62
 
63
63
  # Public: View a file within your home directory. This function also
@@ -74,7 +74,7 @@ module Lumberg
74
74
  def show(options = {})
75
75
  options[:dir] = options.delete(:directory)
76
76
 
77
- perform_request({ :api_function => 'viewfile' }.merge(options))
77
+ perform_request({ api_function: 'viewfile' }.merge(options))
78
78
  end
79
79
 
80
80
  # Public: Retrieve information about specific files
@@ -91,14 +91,14 @@ module Lumberg
91
91
  def stat(options = {})
92
92
  options[:dir] = options.delete(:directory)
93
93
 
94
- perform_request({ :api_function => 'statfiles' }.merge(options))
94
+ perform_request({ api_function: 'statfiles' }.merge(options))
95
95
  end
96
96
 
97
97
  # Public: Retrieve disk usage statistics about your account.
98
98
  #
99
99
  # Returns Hash API response.
100
100
  def disk_usage
101
- perform_request({ :api_function => 'getdiskinfo' })
101
+ perform_request({ api_function: 'getdiskinfo' })
102
102
  end
103
103
 
104
104
  # Public: Perform an operation on a file or group of files. You can use
@@ -138,7 +138,7 @@ module Lumberg
138
138
  options[:sourcefiles] = options.delete(:source_files)
139
139
  options[:destfiles] = options.delete(:destination_files)
140
140
 
141
- perform_request({ :api_function => "fileop" }.merge(options))
141
+ perform_request({ api_function: "fileop" }.merge(options))
142
142
  end
143
143
  end
144
144
  end
@@ -0,0 +1,101 @@
1
+ module Lumberg
2
+ module Cpanel
3
+ class Ftp < Base
4
+ def self.api_module; "Ftp"; end
5
+
6
+ # Public: List FTP accounts associated with the authenticated user's account
7
+ #
8
+ # options - Hash options for API call params (default: {}):
9
+ # :include_acct_types - specify which FTP account types to include
10
+ # :skip_acct_types - specify which FTP account types to exclude
11
+ #
12
+ # Returns Hash API response.
13
+ def list_ftp(options = {})
14
+ perform_request({
15
+ api_function: "listftp"
16
+ }.merge(options))
17
+ end
18
+
19
+ # Public: Retrieve a list of FTP sessions associated with the account
20
+ #
21
+ # Returns Hash API response.
22
+ def list_ftp_sessions(options = {})
23
+ perform_request({
24
+ api_function: "listftpsessions"
25
+ }.merge(options))
26
+ end
27
+
28
+ # Public: Generate a list of FTP accounts associated with a cPanel account
29
+ # The list will contain each account's disk information
30
+ #
31
+ # options - Hash options for API call params (default: {}):
32
+ # :dirhtml - prepend the 'dir' return variable with a URL
33
+ # :include_acct_types - specify which FTP account types to include
34
+ # :skip_acct_types - specify which FTP account types to exclude
35
+ #
36
+ # Returns Hash API response.
37
+ def list_ftp_with_disk(options = {})
38
+ perform_request({
39
+ api_function: "listftpwithdisk"
40
+ }.merge(options))
41
+ end
42
+
43
+ # Public: Change an FTP account's password
44
+ #
45
+ # options - Hash options for API call params (default: {}):
46
+ # :user - The username portion of the FTP account
47
+ # :pass - The new password for the FTP account
48
+ #
49
+ # Returns Hash API response.
50
+ def passwd(options = {})
51
+ perform_request({
52
+ api_function: "passwd"
53
+ }.merge(options))
54
+ end
55
+
56
+ # Public: Add a new FTP account
57
+ #
58
+ # options - Hash options for API call params (default: {}):
59
+ # :user - The username portion of the new FTP account, without the domain
60
+ # :pass - The password for the new FTP account
61
+ # :quota - The new FTP account's quota. The default, 0, indicates that
62
+ # the account will not use a quota.
63
+ # :homedir - The path to the FTP account's root directory. This value
64
+ # should be relative to the account's home directory
65
+ #
66
+ # Returns Hash API response.
67
+ def add_ftp(options = {})
68
+ perform_request({
69
+ api_function: "addftp"
70
+ }.merge(options))
71
+ end
72
+
73
+ # Public: Change an FTP account's quota
74
+ #
75
+ # options - Hash options for API call params (default: {}):
76
+ # :user - The username portion of the FTP account
77
+ # :quota - The new quota (in megabytes) for the FTP account
78
+ #
79
+ # Returns Hash API response.
80
+ def set_quota(options = {})
81
+ perform_request({
82
+ api_function: "setquota"
83
+ }.merge(options))
84
+ end
85
+
86
+ # Public: Delete an FTP account
87
+ #
88
+ # options - Hash options for API call params (default: {}):
89
+ # :user - The name of the account to be removed
90
+ # :destroy - A boolean value that indicates whether or not the FTP account's
91
+ # home directory should also be deleted
92
+ #
93
+ # Returns Hash API response.
94
+ def del_ftp(options = {})
95
+ perform_request({
96
+ api_function: "delftp"
97
+ }.merge(options))
98
+ end
99
+ end
100
+ end
101
+ end