gds-api-adapters 29.1.1 → 29.2.0
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 +4 -4
- data/lib/gds_api/test_helpers/content_store.rb +12 -8
- data/lib/gds_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: dcbcf83df995ff4cdd0002f989cc9e4032cd7470
|
4
|
+
data.tar.gz: 8eaabd463ed9176934ea0adb6bb67bf4b7ec1947
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1020031ea15ed8ac360b783f1ad57b765c1ed4aefa521ce65c2a5b0f4eed014cf19468f039e07a3f8a7e3c71e5bee4e56eab63af91a80d362a441be2dbf2c638
|
7
|
+
data.tar.gz: 844a5785f27a1e5168c65bf5d5fa4acd9b5640b42982896203178ff2c4e1758edf11f0d5e036cbdcf8ffb0bfd95679bfa1f60fd072d2984a024e9339665c8b59
|
@@ -7,18 +7,22 @@ module GdsApi
|
|
7
7
|
module ContentStore
|
8
8
|
include ContentItemHelpers
|
9
9
|
|
10
|
-
CONTENT_STORE_ENDPOINT = Plek.current.find('content-store')
|
11
|
-
|
12
10
|
# Stubs a content item in the content store.
|
13
11
|
# The following options can be passed in:
|
14
12
|
#
|
15
13
|
# :max_age will set the max-age of the Cache-Control header in the response. Defaults to 900
|
16
14
|
# :private if true, the Cache-Control header will include the "private" directive. By default it
|
17
15
|
# will include "public"
|
16
|
+
# :draft will point to the draft content store if set to true
|
17
|
+
|
18
|
+
def content_store_endpoint(draft=false)
|
19
|
+
draft ? Plek.current.find('draft-content-store') : Plek.current.find('content-store')
|
20
|
+
end
|
21
|
+
|
18
22
|
def content_store_has_item(base_path, body = content_item_for_base_path(base_path), options = {})
|
19
23
|
max_age = options.fetch(:max_age, 900)
|
20
24
|
visibility = options[:private] ? "private" : "public"
|
21
|
-
url =
|
25
|
+
url = content_store_endpoint(options[:draft]) + "/content" + base_path
|
22
26
|
body = body.to_json unless body.is_a?(String)
|
23
27
|
|
24
28
|
stub_request(:get, url).to_return(
|
@@ -31,16 +35,16 @@ module GdsApi
|
|
31
35
|
)
|
32
36
|
end
|
33
37
|
|
34
|
-
def content_store_does_not_have_item(base_path)
|
35
|
-
url =
|
38
|
+
def content_store_does_not_have_item(base_path, options = {})
|
39
|
+
url = content_store_endpoint(options[:draft]) + "/content" + base_path
|
36
40
|
stub_request(:get, url).to_return(status: 404, headers: {})
|
37
41
|
|
38
|
-
url =
|
42
|
+
url = content_store_endpoint(options[:draft]) + "/incoming-links" + base_path
|
39
43
|
stub_request(:get, url).to_return(status: 404, headers: {})
|
40
44
|
end
|
41
45
|
|
42
46
|
def content_store_isnt_available
|
43
|
-
stub_request(:any, /#{
|
47
|
+
stub_request(:any, /#{content_store_endpoint}\/.*/).to_return(:status => 503)
|
44
48
|
end
|
45
49
|
|
46
50
|
def content_item_for_base_path(base_path)
|
@@ -48,7 +52,7 @@ module GdsApi
|
|
48
52
|
end
|
49
53
|
|
50
54
|
def content_store_has_incoming_links(base_path, links)
|
51
|
-
url =
|
55
|
+
url = content_store_endpoint + "/incoming-links" + base_path
|
52
56
|
body = links.to_json
|
53
57
|
|
54
58
|
stub_request(:get, url).to_return(body: body)
|
data/lib/gds_api/version.rb
CHANGED