gds-api-adapters 29.1.1 → 29.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79d15b6fd807103c6fc88870512f1e3c3d341858
4
- data.tar.gz: 000f3511afdf25a9c4746da4a43d82fe283580cb
3
+ metadata.gz: dcbcf83df995ff4cdd0002f989cc9e4032cd7470
4
+ data.tar.gz: 8eaabd463ed9176934ea0adb6bb67bf4b7ec1947
5
5
  SHA512:
6
- metadata.gz: e2d59c5d0ed42723b7a559fcf95cd54a75c12a8fb986900157639ad5457445c29d63059c6e70868ea406a3212c1a6fc6eaf4f75cc89029a41a85117c9cfb029d
7
- data.tar.gz: aa2d16f162b3f6a383db6e79518a0d693815978c4513047e26feab6882f4dcadd729a06f214ed81dfcb9a60fc78f18eca4c4978766a6bf90ade67107dc2c968e
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 = CONTENT_STORE_ENDPOINT + "/content" + base_path
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 = CONTENT_STORE_ENDPOINT + "/content" + base_path
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 = CONTENT_STORE_ENDPOINT + "/incoming-links" + base_path
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, /#{CONTENT_STORE_ENDPOINT}\/.*/).to_return(:status => 503)
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 = CONTENT_STORE_ENDPOINT + "/incoming-links" + base_path
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)
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '29.1.1'
2
+ VERSION = '29.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gds-api-adapters
3
3
  version: !ruby/object:Gem::Version
4
- version: 29.1.1
4
+ version: 29.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Stewart