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
@@ -5,7 +5,7 @@ require 'spec_helper'
5
5
  module Lumberg
6
6
  describe Whm::Server do
7
7
  before(:each) do
8
- @login = { :host => @whm_host, :hash => @whm_hash }
8
+ @login = { host: @whm_host, hash: @whm_hash }
9
9
  @whm = Whm::Server.new(@login.dup)
10
10
  @url_base = "https://myhost.com:2087/json-api"
11
11
  end
@@ -25,7 +25,7 @@ module Lumberg
25
25
  end
26
26
 
27
27
  it "should allow setting of the username" do
28
- @whm = Whm::Server.new(@login.merge(:user => 'bob'))
28
+ @whm = Whm::Server.new(@login.merge(user: 'bob'))
29
29
  @whm.user.should == 'bob'
30
30
  end
31
31
 
@@ -34,14 +34,14 @@ module Lumberg
34
34
  end
35
35
 
36
36
  it "should allow setting of basic_auth" do
37
- @whm = Whm::Server.new(@login.merge(:basic_auth => true))
37
+ @whm = Whm::Server.new(@login.merge(basic_auth: true))
38
38
  @whm.basic_auth.should be_true
39
39
  end
40
40
 
41
41
  it "raises message for invalid domain" do
42
42
  Resolv.stub(:getaddress).and_raise(Resolv::ResolvError)
43
43
  expect do
44
- Whm::Server.new(:host => "nxdomain.tld", :hash => "")
44
+ Whm::Server.new(host: "nxdomain.tld", hash: "")
45
45
  end.to raise_error(
46
46
  Lumberg::WhmArgumentError, "Unable to resolve nxdomain.tld"
47
47
  )
@@ -51,7 +51,7 @@ module Lumberg
51
51
  describe "setting timeout" do
52
52
  it "allows setting of timeout" do
53
53
  Whm::Server.new(
54
- @login.merge(:timeout => 1000)
54
+ @login.merge(timeout: 1000)
55
55
  ).timeout.should == 1000
56
56
  end
57
57
  end
@@ -62,31 +62,31 @@ module Lumberg
62
62
  end
63
63
 
64
64
  it "converts the host into an SSL URL when asked" do
65
- @whm = Whm::Server.new(@login.dup.merge(:ssl => true))
65
+ @whm = Whm::Server.new(@login.dup.merge(ssl: true))
66
66
  @whm.send(:format_url).should == "https://myhost.com:2087/json-api/"
67
67
  end
68
68
 
69
69
  it "converts the host into a non SSL URL when asked" do
70
- @whm = Whm::Server.new(@login.dup.merge(:ssl => false))
70
+ @whm = Whm::Server.new(@login.dup.merge(ssl: false))
71
71
  @whm.send(:format_url).should == "http://myhost.com:2086/json-api/"
72
72
  end
73
73
  end
74
74
 
75
75
  describe "#format_hash" do
76
76
  it "raises an error if hash is not a string" do
77
- expect{ Whm::Server.new(:host => @whm_host, :hash => nil) }.
77
+ expect{ Whm::Server.new(host: @whm_host, hash: nil) }.
78
78
  to raise_error(Lumberg::WhmArgumentError, "Missing WHM hash")
79
79
  end
80
80
 
81
81
  it "removes \\n's from the hash" do
82
82
  hash = "my\nhash\n\n\n\n"
83
- @whm = Whm::Server.new(:host => @whm_host, :hash => hash)
83
+ @whm = Whm::Server.new(host: @whm_host, hash: hash)
84
84
  @whm.hash.should == 'myhash'
85
85
  end
86
86
 
87
87
  it "removes whitespace from the hash" do
88
88
  hash = " my hash "
89
- @whm = Whm::Server.new(:host => @whm_host, :hash => hash)
89
+ @whm = Whm::Server.new(host: @whm_host, hash: hash)
90
90
  @whm.hash.should == 'myhash'
91
91
  end
92
92
  end
@@ -107,16 +107,16 @@ module Lumberg
107
107
 
108
108
  it "calls the proper URL and arguments" do
109
109
  JSON.should_receive(:parse).with("[]").and_return([])
110
- @whm.perform_request('my_function', :arg1 => 1, :arg2 => 'test')
110
+ @whm.perform_request('my_function', arg1: 1, arg2: 'test')
111
111
  @whm.function.should == 'my_function'
112
- @whm.params.should == {:arg1 => 1, :arg2 => 'test'}
112
+ @whm.params.should == {arg1: 1, arg2: 'test'}
113
113
  end
114
114
 
115
115
  it "changes params to booleans when given a block" do
116
- req = @whm.perform_request('my_function', :block => 1) do |p|
116
+ req = @whm.perform_request('my_function', block: 1) do |p|
117
117
  p.boolean_params = :true, :false
118
118
  end
119
- req[:params].should include(:true => true, :false => false, :other => 2)
119
+ req[:params].should include(true: true, false: false, other: 2)
120
120
  end
121
121
 
122
122
  end
@@ -174,7 +174,7 @@ module Lumberg
174
174
  use_vcr_cassette "whm/server/applist"
175
175
 
176
176
  it "sets a response message" do
177
- @whm = Whm::Server.new(:host => @whm_host, :hash => @whm_hash)
177
+ @whm = Whm::Server.new(host: @whm_host, hash: @whm_hash)
178
178
  @whm.perform_request('applist')
179
179
  @whm.function.should == 'applist'
180
180
  end
@@ -286,7 +286,7 @@ module Lumberg
286
286
  use_vcr_cassette "whm/server/addip"
287
287
 
288
288
  it "adds the ip address" do
289
- result = @whm.add_ip(:ip => '208.77.188.166', :netmask => '255.255.255.0')
289
+ result = @whm.add_ip(ip: '208.77.188.166', netmask: '255.255.255.0')
290
290
  result[:success].should be_true
291
291
  end
292
292
  end
@@ -295,7 +295,7 @@ module Lumberg
295
295
  use_vcr_cassette "whm/server/delip"
296
296
 
297
297
  it "deletes the ip address" do
298
- result = @whm.delete_ip(:ip => '208.77.188.166')
298
+ result = @whm.delete_ip(ip: '208.77.188.166')
299
299
  result[:success].should be_true
300
300
  end
301
301
  end
@@ -304,7 +304,7 @@ module Lumberg
304
304
  use_vcr_cassette "whm/server/sethostname"
305
305
 
306
306
  it "changes the server's hostname" do
307
- result = @whm.set_hostname(:hostname => "myhost.com")
307
+ result = @whm.set_hostname(hostname: "myhost.com")
308
308
  result[:success].should be_true
309
309
  end
310
310
  end
@@ -313,7 +313,7 @@ module Lumberg
313
313
  use_vcr_cassette "whm/server/gettweaksetting"
314
314
 
315
315
  it "gets a tweak setting" do
316
- result = @whm.get_tweaksetting(:key => 'skipwebalizer')
316
+ result = @whm.get_tweaksetting(key: 'skipwebalizer')
317
317
  result[:success].should be_true
318
318
  end
319
319
  end
@@ -322,7 +322,7 @@ module Lumberg
322
322
  use_vcr_cassette "whm/server/settweaksetting"
323
323
 
324
324
  it "sets a tweak setting" do
325
- result = @whm.set_tweaksetting(:key => 'skipwebalizer', :value => 0)
325
+ result = @whm.set_tweaksetting(key: 'skipwebalizer', value: 0)
326
326
  result[:success].should be_true
327
327
  end
328
328
  end
@@ -331,7 +331,7 @@ module Lumberg
331
331
  use_vcr_cassette "whm/server/setresolvers"
332
332
 
333
333
  it "configures the nameservers" do
334
- result = @whm.set_resolvers(:nameserver1 => "123.123.123.123", :nameserver2 => "123.123.123.124")
334
+ result = @whm.set_resolvers(nameserver1: "123.123.123.123", nameserver2: "123.123.123.124")
335
335
  result[:success].should be_true
336
336
  end
337
337
  end
@@ -340,7 +340,7 @@ module Lumberg
340
340
  use_vcr_cassette "whm/server/showbw"
341
341
 
342
342
  it "shows the bandwidth information" do
343
- result = @whm.show_bandwidth(:year => 2011, :month => 5)
343
+ result = @whm.show_bandwidth(year: 2011, month: 5)
344
344
  result[:params][:month].to_i.should == 5
345
345
  result[:params][:acct].should have(3).accounts
346
346
  end
data/spec/whm/whm_spec.rb CHANGED
@@ -5,21 +5,21 @@ module Lumberg
5
5
  describe Whm do
6
6
  describe "#to_bool" do
7
7
  it "converts all 1/0 values to bools" do
8
- hash = {:true => 1, :false => 0, :other => 2}
8
+ hash = {true: 1, false: 0, other: 2}
9
9
  new_hash = Whm::to_bool(hash)
10
- new_hash.should include(:true => true, :false => false, :other => 2)
10
+ new_hash.should include(true: true, false: false, other: 2)
11
11
  end
12
12
 
13
13
  it "converts signle specified key" do
14
- hash = {:true => 1, :false => 0, :other => 2}
14
+ hash = {true: 1, false: 0, other: 2}
15
15
  new_hash = Whm::to_bool(hash, :true)
16
- new_hash.should include(:true => true, :false => 0, :other => 2)
16
+ new_hash.should include(true: true, false: 0, other: 2)
17
17
  end
18
18
 
19
19
  it "converts all specified keys" do
20
- hash = {:true => 1, :false => 0, :something => 1}
20
+ hash = {true: 1, false: 0, something: 1}
21
21
  new_hash = Whm::to_bool(hash, :true, :false)
22
- new_hash.should include(:true => true, :false => false, :something => 1)
22
+ new_hash.should include(true: true, false: false, something: 1)
23
23
  end
24
24
  end
25
25
 
@@ -33,8 +33,8 @@ module Lumberg
33
33
  end
34
34
 
35
35
  it "converts all falses and trues to 0 and 1" do
36
- hash = {:true => true, :false => false}
37
- Whm::from_bool(hash).should include(:true => 1, :false => 0)
36
+ hash = {true: true, false: false}
37
+ Whm::from_bool(hash).should include(true: 1, false: 0)
38
38
  end
39
39
  end
40
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lumberg
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre4
4
+ version: 2.0.0.pre5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Mazzi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-30 00:00:00.000000000 Z
11
+ date: 2013-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -139,6 +139,7 @@ files:
139
139
  - lib/lumberg/cpanel/domain_lookup.rb
140
140
  - lib/lumberg/cpanel/email.rb
141
141
  - lib/lumberg/cpanel/file_manager.rb
142
+ - lib/lumberg/cpanel/ftp.rb
142
143
  - lib/lumberg/cpanel/gpg.rb
143
144
  - lib/lumberg/cpanel/locale.rb
144
145
  - lib/lumberg/cpanel/mime.rb
@@ -146,6 +147,7 @@ files:
146
147
  - lib/lumberg/cpanel/net.rb
147
148
  - lib/lumberg/cpanel/park.rb
148
149
  - lib/lumberg/cpanel/password.rb
150
+ - lib/lumberg/cpanel/password_strength.rb
149
151
  - lib/lumberg/cpanel/random_data.rb
150
152
  - lib/lumberg/cpanel/redirect.rb
151
153
  - lib/lumberg/cpanel/ssl.rb
@@ -176,6 +178,7 @@ files:
176
178
  - spec/cpanel/domain_lookup_spec.rb
177
179
  - spec/cpanel/email_spec.rb
178
180
  - spec/cpanel/file_manager_spec.rb
181
+ - spec/cpanel/ftp_spec.rb
179
182
  - spec/cpanel/gpg_spec.rb
180
183
  - spec/cpanel/locale_spec.rb
181
184
  - spec/cpanel/mime_spec.rb
@@ -183,6 +186,7 @@ files:
183
186
  - spec/cpanel/net_spec.rb
184
187
  - spec/cpanel/park_spec.rb
185
188
  - spec/cpanel/password_spec.rb
189
+ - spec/cpanel/password_strength_spec.rb
186
190
  - spec/cpanel/random_data_spec.rb
187
191
  - spec/cpanel/redirect_spec.rb
188
192
  - spec/cpanel/ssl_spec.rb
@@ -258,6 +262,13 @@ files:
258
262
  - spec/vcr_cassettes/cpanel/file_manager/operate.yml
259
263
  - spec/vcr_cassettes/cpanel/file_manager/show.yml
260
264
  - spec/vcr_cassettes/cpanel/file_manager/stat.yml
265
+ - spec/vcr_cassettes/cpanel/ftp/addftp.yml
266
+ - spec/vcr_cassettes/cpanel/ftp/delftp.yml
267
+ - spec/vcr_cassettes/cpanel/ftp/listftp.yml
268
+ - spec/vcr_cassettes/cpanel/ftp/listftpsessions.yml
269
+ - spec/vcr_cassettes/cpanel/ftp/listftpwithdisk.yml
270
+ - spec/vcr_cassettes/cpanel/ftp/passwd.yml
271
+ - spec/vcr_cassettes/cpanel/ftp/setquota.yml
261
272
  - spec/vcr_cassettes/cpanel/gpg/count.yml
262
273
  - spec/vcr_cassettes/cpanel/gpg/count_private.yml
263
274
  - spec/vcr_cassettes/cpanel/gpg/list.yml
@@ -271,6 +282,9 @@ files:
271
282
  - spec/vcr_cassettes/cpanel/park/remove.yml
272
283
  - spec/vcr_cassettes/cpanel/password/digest_authentication.yml
273
284
  - spec/vcr_cassettes/cpanel/password/modify.yml
285
+ - spec/vcr_cassettes/cpanel/password_strength/all_required_strengths.yml
286
+ - spec/vcr_cassettes/cpanel/password_strength/required_strength.yml
287
+ - spec/vcr_cassettes/cpanel/password_strength/strength.yml
274
288
  - spec/vcr_cassettes/cpanel/random_data/show.yml
275
289
  - spec/vcr_cassettes/cpanel/ssl/fetchcabundle.yml
276
290
  - spec/vcr_cassettes/cpanel/ssl/gencrt.yml
@@ -402,6 +416,7 @@ test_files:
402
416
  - spec/cpanel/domain_lookup_spec.rb
403
417
  - spec/cpanel/email_spec.rb
404
418
  - spec/cpanel/file_manager_spec.rb
419
+ - spec/cpanel/ftp_spec.rb
405
420
  - spec/cpanel/gpg_spec.rb
406
421
  - spec/cpanel/locale_spec.rb
407
422
  - spec/cpanel/mime_spec.rb
@@ -409,6 +424,7 @@ test_files:
409
424
  - spec/cpanel/net_spec.rb
410
425
  - spec/cpanel/park_spec.rb
411
426
  - spec/cpanel/password_spec.rb
427
+ - spec/cpanel/password_strength_spec.rb
412
428
  - spec/cpanel/random_data_spec.rb
413
429
  - spec/cpanel/redirect_spec.rb
414
430
  - spec/cpanel/ssl_spec.rb
@@ -484,6 +500,13 @@ test_files:
484
500
  - spec/vcr_cassettes/cpanel/file_manager/operate.yml
485
501
  - spec/vcr_cassettes/cpanel/file_manager/show.yml
486
502
  - spec/vcr_cassettes/cpanel/file_manager/stat.yml
503
+ - spec/vcr_cassettes/cpanel/ftp/addftp.yml
504
+ - spec/vcr_cassettes/cpanel/ftp/delftp.yml
505
+ - spec/vcr_cassettes/cpanel/ftp/listftp.yml
506
+ - spec/vcr_cassettes/cpanel/ftp/listftpsessions.yml
507
+ - spec/vcr_cassettes/cpanel/ftp/listftpwithdisk.yml
508
+ - spec/vcr_cassettes/cpanel/ftp/passwd.yml
509
+ - spec/vcr_cassettes/cpanel/ftp/setquota.yml
487
510
  - spec/vcr_cassettes/cpanel/gpg/count.yml
488
511
  - spec/vcr_cassettes/cpanel/gpg/count_private.yml
489
512
  - spec/vcr_cassettes/cpanel/gpg/list.yml
@@ -497,6 +520,9 @@ test_files:
497
520
  - spec/vcr_cassettes/cpanel/park/remove.yml
498
521
  - spec/vcr_cassettes/cpanel/password/digest_authentication.yml
499
522
  - spec/vcr_cassettes/cpanel/password/modify.yml
523
+ - spec/vcr_cassettes/cpanel/password_strength/all_required_strengths.yml
524
+ - spec/vcr_cassettes/cpanel/password_strength/required_strength.yml
525
+ - spec/vcr_cassettes/cpanel/password_strength/strength.yml
500
526
  - spec/vcr_cassettes/cpanel/random_data/show.yml
501
527
  - spec/vcr_cassettes/cpanel/ssl/fetchcabundle.yml
502
528
  - spec/vcr_cassettes/cpanel/ssl/gencrt.yml
@@ -590,3 +616,4 @@ test_files:
590
616
  - spec/whm/reseller_spec.rb
591
617
  - spec/whm/server_spec.rb
592
618
  - spec/whm/whm_spec.rb
619
+ has_rdoc: