datasift 3.5.0 → 3.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2fead364f5c1631d28e826b6ab3a1bc0feaf570b
4
- data.tar.gz: 66b66356edcf1446051e3fc4fd8e35c72f5bf561
3
+ metadata.gz: fe305d23648d41d808a86c13411481f7bdf75129
4
+ data.tar.gz: 6e90471c5872a20097cc4170422bc9695aca777f
5
5
  SHA512:
6
- metadata.gz: f8a5b9f74d8c5bb4d00271b921b1167e9ab2be70b254837042e368340d771546d995f83870ba9e743c2d17f40ac1f7824aef37d10291382ab369649c99ac26f3
7
- data.tar.gz: 0a032a3711190b06f10ac7c3c1cc288ae4b4dd4af46eb0b8c7c2a006fa74b372c2406dc80b215654a725fc3026d67dbb198011311e3c3c6840530940ce1c508c
6
+ metadata.gz: b25f41df2312e59b7850ac67fabedce030d8fd2f3c5ff0fc0bec6b7770deab01e8066f081d4d2cbcee239e14dd68c3f8e264abf245e8cb533a4b2a30f9ac536d
7
+ data.tar.gz: 6a44062ecb3affee0d7e2ecfa4f3b230f692d3f3aceb78994588ae4cb3ebb6a3176acd4cc10f7df4682b6618e290d132b521cda6f9c64d1c494c53af48ab1a98
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  CHANGELOG
2
2
  ================================
3
+ ## v.3.5.1 (2016-10-06)
4
+ ### Added
5
+ * Explicit support for 500 and 502 responses from the API
6
+ ### Fixes
7
+ * Resolves [#86](https://github.com/datasift/datasift-ruby/issues/86); not handling 502 responses well
8
+
3
9
  ## v.3.5.0 (2015-11-13)
4
10
  ### Added
5
11
  * Support for the [/account/usage](http://dev.datasift.com/pylon/docs/api/acct-api-endpoints/get-accountusage) API endpoint
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.5.0
1
+ 3.5.1
data/lib/datasift.rb CHANGED
@@ -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
data/lib/errors.rb CHANGED
@@ -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.5.0
4
+ version: 3.5.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: 2015-11-13 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
@@ -202,9 +202,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
202
  version: 1.3.5
203
203
  requirements: []
204
204
  rubyforge_project:
205
- rubygems_version: 2.4.8
205
+ rubygems_version: 2.6.3
206
206
  signing_key:
207
207
  specification_version: 4
208
208
  summary: DataSift is a simple wrapper for the DataSift API.
209
209
  test_files: []
210
- has_rdoc: