gds-api-adapters 17.5.0 → 17.6.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: 6841e316b10260b0fe2a409023c3f35ac7801cca
4
- data.tar.gz: eff681982d8d3d8a16d1ce6a705af11d65d3b4b6
3
+ metadata.gz: 4765fe1a71706fba9d3dac03b7da25cbd8b75f94
4
+ data.tar.gz: 3ae561726bc965a18f442980dc6eed98e0e6ec2c
5
5
  SHA512:
6
- metadata.gz: 76b45aa38625b74c522bdab30e7d14fa3f392bd99badc112b6a3a01732ee96cca3bb48cd8919df0a874b353fb3a140be954fb9581d0172c134e608dc39b4f1e8
7
- data.tar.gz: c61209c058ca4d73da84d8d85560edc8ac06770685fc1813fe8d13a7b966e42670dcd6ba511f1379926dbfb637cbe642b9bf9a99244214691132cf0ead4c467c
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 stub_publishing_api_put_item(base_path, body = content_item_for_base_path(base_path))
15
- url = PUBLISHING_API_ENDPOINT + "/content" + base_path
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
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '17.5.0'
2
+ VERSION = '17.6.0'
3
3
  end
@@ -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-to-publishing-api"
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.5.0
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-12 00:00:00.000000000 Z
11
+ date: 2015-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plek