datasift 3.7.0 → 3.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/VERSION +1 -1
  4. data/lib/datasift.rb +11 -1
  5. data/lib/errors.rb +8 -0
  6. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad4fb49dafd82b2670d5d7d7e6b165f06d3dd9a7
4
- data.tar.gz: f4575e31b0542ffe614e6021aa760c13ca08328c
3
+ metadata.gz: 9ba6751afecf874d13f2de17e8c27efed61693d9
4
+ data.tar.gz: 2a4d7e76cd1b84214e66f4f252e4608401389845
5
5
  SHA512:
6
- metadata.gz: 3d9f023a5938ce6c8d1b6a858a9aab453561f7f097eef24b41021f93350b22df584af6c457cbcc034e34b868a7a61051b37eabcc885bd3376c7a44199451eec1
7
- data.tar.gz: 93e354f5f7fbd9fb6f43d10d00b47f01356225b91fd2c29725244c194bdeb8f35254b0381f5f27234ad31ee3323b5728f9da6f310b5c188edb014ea634b322ec
6
+ metadata.gz: c4d5ab192c4a5663021854de9081eb602c4efde77731792160b9922cd8f608001d8c43d604e6f33b95688b7e799595b088f13002183f4d9a85e4755f1f7533c9
7
+ data.tar.gz: 3f54eee95ed7329d8fd3f46250859e8c36e06c0c5c7bdaea7c08993197160fb0f3dce8e48ebc02a1c9c87b8266469e38b0fddee9199cc4bd68d5c82a8729437d
@@ -7,6 +7,12 @@ CHANGELOG
7
7
  * Designed to make the most of DataSift's latest API version and features
8
8
  * Designed for Ruby 2.3+. Use features like keyword parameters across the board
9
9
 
10
+ ## v.3.7.1 (2016-10-06)
11
+ ### Added
12
+ * Explicit support for 500 and 502 responses from the API
13
+ ### Fixes
14
+ * Resolves [#86](https://github.com/datasift/datasift-ruby/issues/86); not handling 502 responses well
15
+
10
16
  ## v.3.7.0 (2016-08-04)
11
17
  ### Added
12
18
  * Support for an `analyze_queries` parameter for Account Identity Limits
@@ -27,6 +33,12 @@ CHANGELOG
27
33
  * Support for the [/pylon/update](http://dev.datasift.com/docs/platform/api/rest-api/endpoints/pylonupdate) API endpoint
28
34
  * Support for [API v1.3](http://dev.datasift.com/docs/platform/api/api-changelog)
29
35
 
36
+ ## v.3.5.1 (2016-10-06)
37
+ ### Added
38
+ * Explicit support for 500 and 502 responses from the API
39
+ ### Fixes
40
+ * Resolves [#86](https://github.com/datasift/datasift-ruby/issues/86); not handling 502 responses well
41
+
30
42
  ## v.3.5.0 (2015-11-13)
31
43
  ### Added
32
44
  * Support for the `/account/usage` API endpoint
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.7.0
1
+ 3.7.1
@@ -230,8 +230,14 @@ module DataSift
230
230
  begin
231
231
  code = e.http_code
232
232
  body = e.http_body
233
+ error = nil
233
234
  if code && body
234
- error = MultiJson.load(body)
235
+ begin
236
+ error = MultiJson.load(body)
237
+ rescue MultiJson::ParseError
238
+ # In cases where we receive 502 responses, Nginx may send HTML rather than JSON
239
+ error = body
240
+ end
235
241
  response_on_error = {
236
242
  :data => nil,
237
243
  :datasift => {
@@ -303,6 +309,10 @@ module DataSift
303
309
  raise UnprocessableEntityError.new(code, body, response)
304
310
  when 429
305
311
  raise TooManyRequestsError.new(code, body, response)
312
+ when 500
313
+ raise InternalServerError.new(code, body, response)
314
+ when 502
315
+ raise BadGatewayError.new(code, body, response)
306
316
  when 503
307
317
  raise ServiceUnavailableError.new(code, body, response)
308
318
  when 504
@@ -68,6 +68,14 @@ end
68
68
  class TooManyRequestsError < DataSiftError
69
69
  end
70
70
 
71
+ # Standard error returned when receiving a 500 response from the API
72
+ class InternalServerError < DataSiftError
73
+ end
74
+
75
+ # Standard error returned when receiving a 502 response from the API
76
+ class BadGatewayError < DataSiftError
77
+ end
78
+
71
79
  # Standard error returned when receiving a 503 response from the API
72
80
  class ServiceUnavailableError < DataSiftError
73
81
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datasift
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - DataSift
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-08-08 00:00:00.000000000 Z
13
+ date: 2016-10-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client