gds-api-adapters 19.1.0 → 19.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gds_api/exceptions.rb +5 -0
- data/lib/gds_api/version.rb +1 -1
- data/test/json_client_test.rb +8 -0
- 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: 2d7a14cdb0314fd0e249e1d7a958e436a9423a0a
|
4
|
+
data.tar.gz: 6c964b35d713dd3ffb6de9d2c4e4ec680ce84e2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa837106a456ce8863e297588642e1b16caf416da36cbdff0d80fce1e30922450cb49260eee9d6bb18ca889546d2566da40594232dfe1e012b5f6a3b7a7c7fcf
|
7
|
+
data.tar.gz: b42cbd5d65b6243174c9804fc9f3d676ca7a518a4430b0c574b3417d27420f58b9af8a1b902b0954f623bf6ce6bd01fe908295f263abff9e4d5ea06aafb9f93b
|
data/lib/gds_api/exceptions.rb
CHANGED
@@ -33,6 +33,9 @@ module GdsApi
|
|
33
33
|
class HTTPGone < HTTPClientError
|
34
34
|
end
|
35
35
|
|
36
|
+
class HTTPForbidden < HTTPClientError
|
37
|
+
end
|
38
|
+
|
36
39
|
class NoBearerToken < BaseError; end
|
37
40
|
|
38
41
|
module ExceptionHandling
|
@@ -51,6 +54,8 @@ module GdsApi
|
|
51
54
|
code = error.http_code
|
52
55
|
|
53
56
|
case code
|
57
|
+
when 403
|
58
|
+
GdsApi::HTTPForbidden.new(code, message, details)
|
54
59
|
when 404
|
55
60
|
GdsApi::HTTPNotFound.new(code, message, details)
|
56
61
|
when 410
|
data/lib/gds_api/version.rb
CHANGED
data/test/json_client_test.rb
CHANGED
@@ -326,6 +326,14 @@ class JsonClientTest < MiniTest::Spec
|
|
326
326
|
end
|
327
327
|
end
|
328
328
|
|
329
|
+
def test_get_bang_should_raise_http_forbidden_if_403_returned_from_endpoint
|
330
|
+
url = "http://some.endpoint/some.json"
|
331
|
+
stub_request(:get, url).to_return(:body => "{}", :status => 403)
|
332
|
+
assert_raises GdsApi::HTTPForbidden do
|
333
|
+
@client.get_json!(url)
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
329
337
|
def test_get_should_be_nil_if_404_returned_from_endpoint
|
330
338
|
url = "http://some.endpoint/some.json"
|
331
339
|
stub_request(:get, url).to_return(:body => "{}", :status => 404)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gds-api-adapters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 19.
|
4
|
+
version: 19.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Stewart
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plek
|