wp-api 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wp/api/client.rb +3 -0
- data/lib/wp/api/endpoints.rb +1 -0
- data/lib/wp/api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 014bb33ae92d9361bbd8d6a7459ace08504f29d3
|
4
|
+
data.tar.gz: 0b58919d93d5d0707daeba5a6b17284fd5bb0285
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32242ca52e07b44cc838066ab46cae8a9dbcbb073e539a04d999c32be2dd68f733f035aac659a71ad322ea1bd15e7dc8ef1ada6ce6020bfaac6b0c5f05ea8261
|
7
|
+
data.tar.gz: c3f076406ad24ab9e555201ce6374daa56c2a56cac06e450211dc9565acef676d93bd346bf6166f1c507e5c2a61cc99d98a9c9d77c107f15c51966033b76b0c7
|
data/lib/wp/api/client.rb
CHANGED
@@ -28,6 +28,7 @@ module WP::API
|
|
28
28
|
protected
|
29
29
|
|
30
30
|
def get(resource, query = {})
|
31
|
+
should_raise_on_empty = query.delete(:should_raise_on_empty) || true
|
31
32
|
query = ActiveSupport::HashWithIndifferentAccess.new(query)
|
32
33
|
path = url_for(resource, query)
|
33
34
|
|
@@ -39,6 +40,8 @@ module WP::API
|
|
39
40
|
|
40
41
|
if response.code != 200
|
41
42
|
raise WP::API::ResourceNotFoundError
|
43
|
+
elsif response.parsed_response.empty? && should_raise_on_empty
|
44
|
+
raise WP::API::ResourceNotFoundError
|
42
45
|
else
|
43
46
|
[ response.parsed_response, response.headers ] # Already parsed.
|
44
47
|
end
|
data/lib/wp/api/endpoints.rb
CHANGED
data/lib/wp/api/version.rb
CHANGED