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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 52c46d1297e939a78ed704799eb7c2f7f5dfd0ac
4
- data.tar.gz: 1fa9469f31285e6feed8453e373d1a292be4e7a7
3
+ metadata.gz: df27b32a5d659460a3b7ec985f6bda98fde7785e
4
+ data.tar.gz: 15f261d3889b1e04679c258c4dc150520d7d5f19
5
5
  SHA512:
6
- metadata.gz: 97879e4cf0e072b5887441a2f08cee3154d14573c2318cb75bc352d715a46e93a4a08912a639911329902c2bab403619d9cd9635b1ed3788991b69b7fde5742d
7
- data.tar.gz: 85b21775cfd5c1a9b795c835429d434899cffe9440373a0267449793c5723562e1329b53bf7b3117ac9b2328d4b8becdf1f004efa5f385420815b6dbb3552faf
6
+ metadata.gz: 9dea37dd5ef656d9e41b02a32a05bb5e8b0ec4d02db8db2e4bdf5287d7078f01a1bbce9dd6b6bfdb7767c66a5ccc849210bad5fdc6a183d28120265f87610c51
7
+ data.tar.gz: e3c864782bcf82a4324e7fe7b93bfc8ea283ba1837a7f7c7d25691264350037aae0ed9b0e324f6291257d96fc6014c8b6b1a401a115dac215dcc85e0a9c262e3
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015 WWWH, LLC.
1
+ Copyright (c) 2015-2016 WWWH, LLC.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
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.9.3, 2.0.0, 2.1.3, 2.2.0 and JRuby 1.9 mode.
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]: http://travis-ci.org/site5/lumberg
13
- [Build Icon]: https://secure.travis-ci.org/site5/lumberg.png?branch=master
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.
@@ -15,7 +15,7 @@ module Lumberg
15
15
 
16
16
  encoding = encoding.to_s.downcase if encoding
17
17
 
18
- body = case encoding
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
- 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
29
+ env[:body] = if @type == :whostmgr
30
+ format_response(uncompressed_body)
35
31
  else
36
- env[:body] = format_response JSON.parse(body)
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
- else
64
+ when :unknown
63
65
  message = "Unknown error occurred #{response.inspect}"
64
66
  end
65
67
 
@@ -1,3 +1,3 @@
1
1
  module Lumberg
2
- VERSION = '3.1.0'
2
+ VERSION = '4.0.0'
3
3
  end
@@ -54,9 +54,9 @@ describe Lumberg::FormatWhm do
54
54
  end
55
55
  end
56
56
 
57
- context "API unavailable" do
57
+ context "non-JSON response" do
58
58
  it "raises a Lumberg::WhmConnectionError" do
59
- env = { body: "cPanel operations have been temporarily suspended", response_headers: { foo: "bar" } }
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&notify_bandwidth_limit=1&notify_disk_limit=&notify_email_quota_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&notify_bandwidth_limit=1&notify_disk_limit&notify_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=&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=listfiles&cpanel_jsonapi_module=Fileman&cpanel_jsonapi_user=lumberg&dir=&filelist=&filepath=&needmime=&showdotfiles=
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=&op=copy&sourcefiles=.shouldneverexist
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=&op=copy&sourcefiles=.lastlogin
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=&file=.lastlogin
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=&file=.lastlogin
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: 3.1.0
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: 2015-09-22 00:00:00.000000000 Z
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.2.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