gds-api-adapters 28.0.2 → 28.1.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: ae2b8c300b0806e2a61911133d3de290e84777c1
4
- data.tar.gz: 622bec9c3dd19e774be56f68ef7579b8b9108e9b
3
+ metadata.gz: 577489488123046a6bf239ae2eab422e697482e6
4
+ data.tar.gz: e7136513270b9aa473c1f7da292aab95ad8a98ef
5
5
  SHA512:
6
- metadata.gz: bb6cfca105105e40265f46308c80f912b0de71d69d80c040d236cbfda866f4fa4f65f5bb2c6110749ba97fe7221e914a602cd6a808d46404f2e3197e4ca3ad3c
7
- data.tar.gz: 7c8daf926635bb741e6ffbc62448d406fedaa2382fb9e4be0a1de41686052e2772f13b9813a65e967673f8c03fae833d90516e4d194fbf446ca65035f7fdcc82
6
+ metadata.gz: 9330d84309333e80d96a025b4402aad25c4dc4e91bfe116ff90fe9912a43338981c87afabaa2a1e4a1a379563bb320dd754824df24e9d2421efe163a01fb40ce
7
+ data.tar.gz: 53199536bc83afd241d1a8626798fec1736a5c6ce3c937663ba5c25f04165c73867855b760a1e4e5160572a721d23feabc8067bf3ff3adf976ffafb2f8a58832
@@ -5,13 +5,34 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
5
5
  put_json!(content_url(content_id), payload)
6
6
  end
7
7
 
8
- def get_content(content_id, options = {})
9
- params = {}
10
- params = params.merge(locale: options[:locale]) if options[:locale]
11
-
8
+ # Return a content item
9
+ #
10
+ # Returns nil if the content item doesn't exist.
11
+ #
12
+ # @param content_id [UUID]
13
+ # @param params [Hash]
14
+ # @option params [String] locale The language, defaults to 'en' in publishing-api.
15
+ #
16
+ # @return [GdsApi::Response] a content item
17
+ def get_content(content_id, params = {})
12
18
  get_json(content_url(content_id, params))
13
19
  end
14
20
 
21
+ # Return a content item
22
+ #
23
+ # Raises exception if the item doesn't exist.
24
+ #
25
+ # @param content_id [UUID]
26
+ # @param params [Hash]
27
+ # @option params [String] locale The language, defaults to 'en' in publishing-api.
28
+ #
29
+ # @return [GdsApi::Response] a content item
30
+ #
31
+ # @raise [HTTPNotFound] when the content item is not found
32
+ def get_content!(content_id, params = {})
33
+ get_json!(content_url(content_id, params))
34
+ end
35
+
15
36
  def publish(content_id, update_type, options = {})
16
37
  params = {
17
38
  update_type: update_type
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '28.0.2'
2
+ VERSION = '28.1.0'
3
3
  end
@@ -369,44 +369,6 @@ describe GdsApi::PublishingApiV2 do
369
369
  end
370
370
  end
371
371
 
372
- describe "if the content item is not publishable" do
373
- before do
374
- publishing_api
375
- .given("a draft content item exists with content_id: #{@content_id} which does not have a publishing_app")
376
- .upon_receiving("a publish request")
377
- .with(
378
- method: :post,
379
- path: "/v2/content/#{@content_id}/publish",
380
- body: {
381
- update_type: "major",
382
- },
383
- headers: {
384
- "Content-Type" => "application/json",
385
- },
386
- )
387
- .will_respond_with(
388
- status: 422,
389
- body: {
390
- "error" => {
391
- "code" => 422,
392
- "fields" => {
393
- "publishing_app"=>["can't be blank"],
394
- },
395
- },
396
- }
397
- )
398
- end
399
-
400
- it "responds with 422" do
401
- error = assert_raises GdsApi::HTTPClientError do
402
- @api_client.publish(@content_id, "major")
403
- end
404
-
405
- assert_equal 422, error.code
406
- assert_equal ["can't be blank"], error.error_details["error"]["fields"]["publishing_app"]
407
- end
408
- end
409
-
410
372
  describe "if the update information is invalid" do
411
373
  before do
412
374
  publishing_api
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: 28.0.2
4
+ version: 28.1.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: 2016-02-15 00:00:00.000000000 Z
11
+ date: 2016-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plek