europeana-api 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/europeana/api/errors.rb +10 -0
- data/lib/europeana/api/search.rb +6 -1
- data/lib/europeana/api/version.rb +1 -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: fed167ebe94821c373f6b8900d928272b77ac1b1
|
4
|
+
data.tar.gz: 4caaa829abfc8af7f7f3c9a3ae7e557b610ba260
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c76ccf7a83211c0e1fb1652c1481bd24e6b53806a7538f968b38cbc41fc48949e926852564e2439f784727c945c5c2f2f6934d1cdeeb7685b8cca959f9b49a5
|
7
|
+
data.tar.gz: f35b2ca4859c4f2fd77b50af490aa1fc9db4a4db43519e0e72a670a29e4fd0ff8efa89759ad195576dc8ab4bb125adb71d0d5459ae8202ea8c86978e6599a42a
|
data/lib/europeana/api/errors.rb
CHANGED
@@ -3,6 +3,8 @@ module Europeana
|
|
3
3
|
module Errors
|
4
4
|
##
|
5
5
|
# Raised if API requests are attempted without the API key having been set.
|
6
|
+
#
|
7
|
+
# @todo Use one-line error messages (in backwards-incompatible version)
|
6
8
|
class MissingAPIKeyError < StandardError
|
7
9
|
def initialize(msg = nil)
|
8
10
|
msg ||= <<-MSG
|
@@ -46,6 +48,14 @@ module Europeana
|
|
46
48
|
super(msg)
|
47
49
|
end
|
48
50
|
end
|
51
|
+
|
52
|
+
module Request
|
53
|
+
##
|
54
|
+
# Raised if the API response indicates invalid pagination params in
|
55
|
+
# the request.
|
56
|
+
class PaginationError < StandardError
|
57
|
+
end
|
58
|
+
end
|
49
59
|
end
|
50
60
|
end
|
51
61
|
end
|
data/lib/europeana/api/search.rb
CHANGED
@@ -50,7 +50,12 @@ module Europeana
|
|
50
50
|
def parse_response(response, _options = {})
|
51
51
|
super.tap do |body|
|
52
52
|
unless body[:success]
|
53
|
-
|
53
|
+
klass = if body.key?(:error) && body[:error] =~ /1000 search results/
|
54
|
+
Errors::Request::PaginationError
|
55
|
+
else
|
56
|
+
Errors::RequestError
|
57
|
+
end
|
58
|
+
fail klass, (body.key?(:error) ? body[:error] : response.code)
|
54
59
|
end
|
55
60
|
end
|
56
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: europeana-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Doe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|