lumberg 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/lumberg/format_whm.rb +9 -1
- data/lib/lumberg/version.rb +1 -1
- data/lib/lumberg/whm/server.rb +0 -1
- data/spec/format_whm_spec.rb +18 -7
- data/spec/whm/server_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52c46d1297e939a78ed704799eb7c2f7f5dfd0ac
|
4
|
+
data.tar.gz: 1fa9469f31285e6feed8453e373d1a292be4e7a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97879e4cf0e072b5887441a2f08cee3154d14573c2318cb75bc352d715a46e93a4a08912a639911329902c2bab403619d9cd9635b1ed3788991b69b7fde5742d
|
7
|
+
data.tar.gz: 85b21775cfd5c1a9b795c835429d434899cffe9440373a0267449793c5723562e1329b53bf7b3117ac9b2328d4b8becdf1f004efa5f385420815b6dbb3552faf
|
data/lib/lumberg/format_whm.rb
CHANGED
@@ -26,7 +26,15 @@ module Lumberg
|
|
26
26
|
env[:body]
|
27
27
|
end
|
28
28
|
|
29
|
-
|
29
|
+
if body =~ /cPanel operations have been temporarily suspended/
|
30
|
+
raise Lumberg::WhmConnectionError.new(body)
|
31
|
+
end
|
32
|
+
|
33
|
+
if @type == :whostmgr || response_type(body) == :whostmgr
|
34
|
+
env[:body] = format_response body
|
35
|
+
else
|
36
|
+
env[:body] = format_response JSON.parse(body)
|
37
|
+
end
|
30
38
|
end
|
31
39
|
|
32
40
|
def response_values(env)
|
data/lib/lumberg/version.rb
CHANGED
data/lib/lumberg/whm/server.rb
CHANGED
@@ -251,7 +251,6 @@ module Lumberg
|
|
251
251
|
c.request :url_encoded
|
252
252
|
c.response :format_whm, @force_response_type, @response_key, @boolean_params
|
253
253
|
c.response :logger, create_logger_instance
|
254
|
-
c.response :json unless @force_response_type == :whostmgr
|
255
254
|
c.adapter :net_http
|
256
255
|
c.options[:timeout] = timeout if timeout
|
257
256
|
end.get(function).body
|
data/spec/format_whm_spec.rb
CHANGED
@@ -6,8 +6,9 @@ describe Lumberg::FormatWhm do
|
|
6
6
|
|
7
7
|
context "gzip" do
|
8
8
|
let(:gzipped_data) do
|
9
|
-
"\
|
10
|
-
"\
|
9
|
+
"\x1F\x8B\b\x00\x13d\x01V\x00\x03\xABV*.MNN-.V\xB2*)*M\xD5Q\xCA" +
|
10
|
+
"\x05\xB2\x13\xD3S\x95\xAC\x94\x8A\xF3sS\x15R\x12K\x12\x95j\x01" +
|
11
|
+
"\xA0E\x91\xF9&\x00\x00\x00"
|
11
12
|
end
|
12
13
|
|
13
14
|
it "removes content encoding" do
|
@@ -18,13 +19,14 @@ describe Lumberg::FormatWhm do
|
|
18
19
|
|
19
20
|
env.should_not include "content-encoding"
|
20
21
|
|
21
|
-
env[:body][:params].should eq "some data"
|
22
|
+
env[:body][:params][:message].should eq "some data"
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
25
26
|
context "deflate" do
|
26
27
|
let(:compressed_data) do
|
27
|
-
"x\x9C
|
28
|
+
"x\x9C\xABV*.MNN-.V\xB2*)*M\xD5Q\xCA\x05\xB2\x13\xD3S\x95\xAC" +
|
29
|
+
"\x94\x8A\xF3sS\x15R\x12K\x12\x95j\x01\n\xFE\rq"
|
28
30
|
end
|
29
31
|
|
30
32
|
it "removes content encoding" do
|
@@ -35,19 +37,28 @@ describe Lumberg::FormatWhm do
|
|
35
37
|
|
36
38
|
env.should_not include "content-encoding"
|
37
39
|
|
38
|
-
env[:body][:params].should eq "some data"
|
40
|
+
env[:body][:params][:message].should eq "some data"
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
42
44
|
context "no content encoding" do
|
43
45
|
it "doesn't touch response headers" do
|
44
|
-
env = { body: "
|
46
|
+
env = { body: "{\"success\":true,\"message\":\"some data\"}",
|
47
|
+
response_headers: { foo: "bar" } }
|
45
48
|
|
46
49
|
subject.on_complete(env)
|
47
50
|
|
48
51
|
env[:response_headers].should include :foo
|
49
52
|
|
50
|
-
env[:body][:params].should eq "some data"
|
53
|
+
env[:body][:params][:message].should eq "some data"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "API unavailable" do
|
58
|
+
it "raises a Lumberg::WhmConnectionError" do
|
59
|
+
env = { body: "cPanel operations have been temporarily suspended", response_headers: { foo: "bar" } }
|
60
|
+
|
61
|
+
expect { subject.on_complete(env) }.to raise_error(Lumberg::WhmConnectionError)
|
51
62
|
end
|
52
63
|
end
|
53
64
|
end
|
data/spec/whm/server_spec.rb
CHANGED
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: 3.
|
4
|
+
version: 3.1.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: 2015-
|
11
|
+
date: 2015-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|