intercom 2.4.1 → 2.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/changes.txt +3 -0
- data/lib/intercom/request.rb +6 -7
- data/lib/intercom/version.rb +1 -1
- data/spec/unit/intercom/request_spec.rb +7 -1
- 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: 9496ff15812ad595a1a475e5063c4c761005a76b
|
4
|
+
data.tar.gz: f79db0f25ddda16aaccd0a222c4331f157a9bc5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6680e040fde3ae378c499bbff89fcde30154805b5505baf959d8b4b6e655c962c5cf8fea5dc6b88aa1412a50421bc92f374b494c2cba810a8638cb186f2fb0cc
|
7
|
+
data.tar.gz: 9d7134dd3245c3d1233372272ebfe568f0b94ba95d3113c0d8f995fd7dc4a461d722399bd5b52fbf478e679099d080887e4b47244bdf1961f316d643e686f908
|
data/README.md
CHANGED
data/changes.txt
CHANGED
data/lib/intercom/request.rb
CHANGED
@@ -81,14 +81,13 @@ module Intercom
|
|
81
81
|
|
82
82
|
def parse_body(decoded_body, response)
|
83
83
|
parsed_body = nil
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
end
|
90
|
-
raise_application_errors_on_failure(parsed_body, response.code.to_i) if parsed_body['type'] == 'error.list'
|
84
|
+
return parsed_body if decoded_body.nil? || decoded_body.strip.empty?
|
85
|
+
begin
|
86
|
+
parsed_body = JSON.parse(decoded_body)
|
87
|
+
rescue JSON::ParserError => e
|
88
|
+
raise_errors_on_failure(response)
|
91
89
|
end
|
90
|
+
raise_application_errors_on_failure(parsed_body, response.code.to_i) if parsed_body['type'] == 'error.list'
|
92
91
|
parsed_body
|
93
92
|
end
|
94
93
|
|
data/lib/intercom/version.rb
CHANGED
@@ -7,4 +7,10 @@ describe 'Intercom::Request' do
|
|
7
7
|
req = Intercom::Request.new('path/', 'GET')
|
8
8
|
proc {req.parse_body('<html>somethjing</html>', response)}.must_raise(Intercom::ServerError)
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
|
+
it 'parse_body returns nil if decoded_body is nil' do
|
12
|
+
response = OpenStruct.new(:code => 500)
|
13
|
+
req = Intercom::Request.new('path/', 'GET')
|
14
|
+
req.parse_body(nil, response).must_equal(nil)
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: intercom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben McRedmond
|
@@ -15,7 +15,7 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date: 2014-
|
18
|
+
date: 2014-11-12 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: minitest
|