lumberg 3.1.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +4 -4
- data/lib/lumberg/format_whm.rb +11 -9
- data/lib/lumberg/version.rb +1 -1
- data/spec/format_whm_spec.rb +2 -2
- data/spec/vcr_cassettes/cpanel/contact/update.yml +1 -1
- data/spec/vcr_cassettes/cpanel/file_manager/list.yml +1 -1
- data/spec/vcr_cassettes/cpanel/file_manager/operate.yml +3 -2
- data/spec/vcr_cassettes/cpanel/file_manager/show.yml +1 -1
- data/spec/vcr_cassettes/cpanel/file_manager/stat.yml +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df27b32a5d659460a3b7ec985f6bda98fde7785e
|
4
|
+
data.tar.gz: 15f261d3889b1e04679c258c4dc150520d7d5f19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dea37dd5ef656d9e41b02a32a05bb5e8b0ec4d02db8db2e4bdf5287d7078f01a1bbce9dd6b6bfdb7767c66a5ccc849210bad5fdc6a183d28120265f87610c51
|
7
|
+
data.tar.gz: e3c864782bcf82a4324e7fe7b93bfc8ea283ba1837a7f7c7d25691264350037aae0ed9b0e324f6291257d96fc6014c8b6b1a401a115dac215dcc85e0a9c262e3
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -7,10 +7,10 @@ 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 2.1.3, 2.2.0, 2.3.1 and JRuby 1.9 mode.
|
11
11
|
|
12
|
-
[Build Status]:
|
13
|
-
[Build Icon]: https://
|
12
|
+
[Build Status]: https://travis-ci.org/site5/lumberg
|
13
|
+
[Build Icon]: https://travis-ci.org/site5/lumberg.svg?branch=master
|
14
14
|
|
15
15
|
|
16
16
|
## cPanel Version Targets
|
@@ -357,4 +357,4 @@ information still present (check URLs, authorization params, etc.).
|
|
357
357
|
|
358
358
|
## Copyright
|
359
359
|
|
360
|
-
Copyright (c) 2015 WWWH, LLC. See LICENSE for details.
|
360
|
+
Copyright (c) 2015-2016 WWWH, LLC. See LICENSE for details.
|
data/lib/lumberg/format_whm.rb
CHANGED
@@ -15,7 +15,7 @@ module Lumberg
|
|
15
15
|
|
16
16
|
encoding = encoding.to_s.downcase if encoding
|
17
17
|
|
18
|
-
|
18
|
+
uncompressed_body = case encoding
|
19
19
|
when 'gzip'
|
20
20
|
env[:response_headers].delete('content-encoding')
|
21
21
|
Zlib::GzipReader.new(StringIO.new(env[:body])).read
|
@@ -26,14 +26,16 @@ module Lumberg
|
|
26
26
|
env[:body]
|
27
27
|
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
if @type == :whostmgr || response_type(body) == :whostmgr
|
34
|
-
env[:body] = format_response body
|
29
|
+
env[:body] = if @type == :whostmgr
|
30
|
+
format_response(uncompressed_body)
|
35
31
|
else
|
36
|
-
|
32
|
+
begin
|
33
|
+
parsed_body = JSON.parse(uncompressed_body)
|
34
|
+
format_response(parsed_body)
|
35
|
+
rescue JSON::ParserError
|
36
|
+
# In some error cases, cpanel doesn't return JSON :smdh:
|
37
|
+
raise Lumberg::WhmConnectionError, uncompressed_body
|
38
|
+
end
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
@@ -59,7 +61,7 @@ module Lumberg
|
|
59
61
|
message = response['error']
|
60
62
|
when :xfer
|
61
63
|
success, message, params = format_xfer_response(response)
|
62
|
-
|
64
|
+
when :unknown
|
63
65
|
message = "Unknown error occurred #{response.inspect}"
|
64
66
|
end
|
65
67
|
|
data/lib/lumberg/version.rb
CHANGED
data/spec/format_whm_spec.rb
CHANGED
@@ -54,9 +54,9 @@ describe Lumberg::FormatWhm do
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
context "
|
57
|
+
context "non-JSON response" do
|
58
58
|
it "raises a Lumberg::WhmConnectionError" do
|
59
|
-
env = { body: "
|
59
|
+
env = { body: "<HTML>Not JSON, for some stupid reason</HTML>", response_headers: { foo: "bar" } }
|
60
60
|
|
61
61
|
expect { subject.on_complete(env) }.to raise_error(Lumberg::WhmConnectionError)
|
62
62
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=savecontactinfo&cpanel_jsonapi_module=CustInfo&cpanel_jsonapi_user=lumberg&email=testing@lumberg-test.com¬ify_bandwidth_limit=1¬ify_disk_limit
|
5
|
+
uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=savecontactinfo&cpanel_jsonapi_module=CustInfo&cpanel_jsonapi_user=lumberg&email=testing@lumberg-test.com¬ify_bandwidth_limit=1¬ify_disk_limit¬ify_email_quota_limit
|
6
6
|
body:
|
7
7
|
string: ""
|
8
8
|
headers:
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://myhost.com:2087/json-api/cpanel?checkleaf
|
5
|
+
uri: https://myhost.com:2087/json-api/cpanel?checkleaf&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=listfiles&cpanel_jsonapi_module=Fileman&cpanel_jsonapi_user=lumberg&dir&filelist&filepath&needmime&showdotfiles
|
6
6
|
body:
|
7
7
|
string: ""
|
8
8
|
headers:
|
@@ -3,7 +3,8 @@ recorded_with: VCR 2.0.1
|
|
3
3
|
http_interactions:
|
4
4
|
- request:
|
5
5
|
method: get
|
6
|
-
uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=fileop&cpanel_jsonapi_module=Fileman&cpanel_jsonapi_user=lumberg&destfiles=.someotherfile&doubledecode
|
6
|
+
uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=fileop&cpanel_jsonapi_module=Fileman&cpanel_jsonapi_user=lumberg&destfiles=.someotherfile&doubledecode&op=copy&sourcefiles=.shouldneverexist
|
7
|
+
|
7
8
|
body:
|
8
9
|
string: ""
|
9
10
|
headers:
|
@@ -40,7 +41,7 @@ http_interactions:
|
|
40
41
|
recorded_at: Wed, 12 Jun 2013 13:16:39 GMT
|
41
42
|
- request:
|
42
43
|
method: get
|
43
|
-
uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=fileop&cpanel_jsonapi_module=Fileman&cpanel_jsonapi_user=lumberg&destfiles=sample-last-login.txt&doubledecode
|
44
|
+
uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=fileop&cpanel_jsonapi_module=Fileman&cpanel_jsonapi_user=lumberg&destfiles=sample-last-login.txt&doubledecode&op=copy&sourcefiles=.lastlogin
|
44
45
|
body:
|
45
46
|
string: ""
|
46
47
|
headers:
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=viewfile&cpanel_jsonapi_module=Fileman&cpanel_jsonapi_user=lumberg&dir
|
5
|
+
uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=viewfile&cpanel_jsonapi_module=Fileman&cpanel_jsonapi_user=lumberg&dir&file=.lastlogin
|
6
6
|
body:
|
7
7
|
string: ""
|
8
8
|
headers:
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=statfiles&cpanel_jsonapi_module=Fileman&cpanel_jsonapi_user=lumberg&dir
|
5
|
+
uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=statfiles&cpanel_jsonapi_module=Fileman&cpanel_jsonapi_user=lumberg&dir&file=.lastlogin
|
6
6
|
body:
|
7
7
|
string: ""
|
8
8
|
headers:
|
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:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Mazzi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -435,7 +435,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
435
435
|
version: '0'
|
436
436
|
requirements: []
|
437
437
|
rubyforge_project: lumberg
|
438
|
-
rubygems_version: 2.
|
438
|
+
rubygems_version: 2.5.1
|
439
439
|
signing_key:
|
440
440
|
specification_version: 4
|
441
441
|
summary: Ruby library for the WHM & cPanel API
|