gds-api-adapters 17.5.0 → 17.6.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/publishing_api.rb +8 -0
- data/lib/gds_api/test_helpers/publishing_api.rb +6 -2
- data/lib/gds_api/version.rb +1 -1
- data/test/publishing_api_test.rb +11 -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: 4765fe1a71706fba9d3dac03b7da25cbd8b75f94
|
4
|
+
data.tar.gz: 3ae561726bc965a18f442980dc6eed98e0e6ec2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6830b420c8366e96184ffc8890c11ab486afb549838f749eebf54dd78a1df9f9dc1549b3d4273420a6a388f8f5765d963ce7f92535cf250fb1a8caedd8498c00
|
7
|
+
data.tar.gz: 0a7bc9e5bc72bee32faa1bf0290cbb8ba9e6c0f65b941b038a64d740b7fba09e179423953cd559f21abfcaf9d12454107c59091c1354156525955bd446be78a9
|
@@ -3,6 +3,10 @@ require_relative 'exceptions'
|
|
3
3
|
|
4
4
|
class GdsApi::PublishingApi < GdsApi::Base
|
5
5
|
|
6
|
+
def put_draft_content_item(base_path, payload)
|
7
|
+
put_json!(draft_content_item_url(base_path), payload)
|
8
|
+
end
|
9
|
+
|
6
10
|
def put_content_item(base_path, payload)
|
7
11
|
put_json!(content_item_url(base_path), payload)
|
8
12
|
end
|
@@ -18,6 +22,10 @@ class GdsApi::PublishingApi < GdsApi::Base
|
|
18
22
|
|
19
23
|
private
|
20
24
|
|
25
|
+
def draft_content_item_url(base_path)
|
26
|
+
"#{endpoint}/draft-content#{base_path}"
|
27
|
+
end
|
28
|
+
|
21
29
|
def content_item_url(base_path)
|
22
30
|
"#{endpoint}/content#{base_path}"
|
23
31
|
end
|
@@ -11,8 +11,12 @@ module GdsApi
|
|
11
11
|
|
12
12
|
PUBLISHING_API_ENDPOINT = Plek.current.find('publishing-api')
|
13
13
|
|
14
|
-
def
|
15
|
-
|
14
|
+
def stub_publishing_api_put_draft_item(base_path, body = content_item_for_base_path(base_path))
|
15
|
+
stub_publishing_api_put_item(base_path, body, '/draft-content')
|
16
|
+
end
|
17
|
+
|
18
|
+
def stub_publishing_api_put_item(base_path, body = content_item_for_base_path(base_path), resource_path = '/content')
|
19
|
+
url = PUBLISHING_API_ENDPOINT + resource_path + base_path
|
16
20
|
body = body.to_json unless body.is_a?(String)
|
17
21
|
stub_request(:put, url).with(body: body).to_return(status: 201, body: body, headers: {})
|
18
22
|
end
|
data/lib/gds_api/version.rb
CHANGED
data/test/publishing_api_test.rb
CHANGED
@@ -12,13 +12,23 @@ describe GdsApi::PublishingApi do
|
|
12
12
|
|
13
13
|
describe "item" do
|
14
14
|
it "should create the item" do
|
15
|
-
base_path = "/test-
|
15
|
+
base_path = "/test-content-item"
|
16
16
|
stub_publishing_api_put_item(base_path)
|
17
17
|
response = @api.put_content_item(base_path, content_item_for_base_path(base_path))
|
18
18
|
assert_equal base_path, response["base_path"]
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
describe "draft item" do
|
23
|
+
it "should create the draft item" do
|
24
|
+
base_path = "/test-draft-content-item"
|
25
|
+
stub_publishing_api_put_draft_item(base_path)
|
26
|
+
|
27
|
+
response = @api.put_draft_content_item(base_path, content_item_for_base_path(base_path))
|
28
|
+
assert_equal base_path, response["base_path"]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
22
32
|
describe "intent" do
|
23
33
|
it "should create the intent" do
|
24
34
|
base_path = "/test-intent"
|
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: 17.
|
4
|
+
version: 17.6.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-02-
|
11
|
+
date: 2015-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plek
|