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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e666fa1f3e03d4ee2514a54799c5b448207fa76b
4
- data.tar.gz: 4bcf1ac7401ef0a3197ff85111d2436c0e40d69e
3
+ metadata.gz: 9496ff15812ad595a1a475e5063c4c761005a76b
4
+ data.tar.gz: f79db0f25ddda16aaccd0a222c4331f157a9bc5d
5
5
  SHA512:
6
- metadata.gz: ef06e460771992cc2876d3c2d01532167d321b10f673828136f99dca662400e09a8c00178a3533434eabc21892e728e274597f406a2770fa9ef3442310d8f2bd
7
- data.tar.gz: ad68662d937de1d6df9322c92caf03391cb6682c2a2632a1da87d59d501ecd764f18a87c60f4acccee9ba74fcb46508b51f0191d017353b46a448d2f4372b7bd
6
+ metadata.gz: 6680e040fde3ae378c499bbff89fcde30154805b5505baf959d8b4b6e655c962c5cf8fea5dc6b88aa1412a50421bc92f374b494c2cba810a8638cb186f2fb0cc
7
+ data.tar.gz: 9d7134dd3245c3d1233372272ebfe568f0b94ba95d3113c0d8f995fd7dc4a461d722399bd5b52fbf478e679099d080887e4b47244bdf1961f316d643e686f908
data/README.md CHANGED
@@ -19,7 +19,7 @@ This version of the gem is compatible with `Ruby 2.1`, `Ruby 2.0` & `Ruby 1.9.3`
19
19
 
20
20
  Using bundler:
21
21
 
22
- gem 'intercom', "~> 2.4.1"
22
+ gem 'intercom', "~> 2.4.2"
23
23
 
24
24
  ## Basic Usage
25
25
 
@@ -1,3 +1,6 @@
1
+ 2.4.2
2
+ - Add nil guard around decode_body to fix potential issue.
3
+
1
4
  2.4.1
2
5
  - Add 'update_last_requst_at=true' as an attribute to set on a User.
3
6
 
@@ -81,14 +81,13 @@ module Intercom
81
81
 
82
82
  def parse_body(decoded_body, response)
83
83
  parsed_body = nil
84
- unless decoded_body.strip.empty?
85
- begin
86
- parsed_body = JSON.parse(decoded_body)
87
- rescue JSON::ParserError => e
88
- raise_errors_on_failure(response)
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
 
@@ -1,3 +1,3 @@
1
1
  module Intercom #:nodoc:
2
- VERSION = "2.4.1"
2
+ VERSION = "2.4.2"
3
3
  end
@@ -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
- end
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.1
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-10-28 00:00:00.000000000 Z
18
+ date: 2014-11-12 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: minitest