gds-api-adapters 54.1.0 → 54.1.1

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
  SHA256:
3
- metadata.gz: fa94a62c5438abcf6bb659c8c9e3f23a5fd156facba7ddb10b5d3904c8dca66d
4
- data.tar.gz: e524d741a8b2ad15184ec520acde4258efa6ca2c554f65de0e89d8185939e3ff
3
+ metadata.gz: b5024a7a7b46c8e9d94294bfb2dc38206adc60fd52a74eb83f4c22604f1c10e6
4
+ data.tar.gz: 3868924f4dd1a30526fc3454fd8f41aed7cda0e2852c77648b8ccc4c58532cce
5
5
  SHA512:
6
- metadata.gz: 0e75e059e1af9ae0b74b320f9065200b998e983754d2acc2a431b48fb110f3b5f6c3435f7cfa4d535e88e0f6ee442e2ac327a666a5bc7f251b1271dcb1f052c0
7
- data.tar.gz: 3fc53c608d6ca8f1b3b329e7e4ace1ff63103994ed981ec0ac4411ae82339e9ba8f34e678fb7fb530533506096576bc1749764caa8d713cc59b6c9aca37bb004
6
+ metadata.gz: 7c900d31a48d52dff098a0d2437ea4aec1f67e54091979da504863fca29c496683027c2ea1b448be0a9d6050a494f4b17459dbd7feda9ef0fa2654b32e8b636f
7
+ data.tar.gz: e4053fcd426aeae02f0a8306604b7304171356ad99ef158daee980fcf3fb328f29e7c31afffc566b3974e750c5558231c0542d86e4539f8895afff5ce2436783
@@ -34,12 +34,39 @@ module GdsApi
34
34
 
35
35
  # Stub a PATCH /v2/links/:content_id request
36
36
  #
37
+ # @example
38
+ # stub_publishing_api_patch_links(
39
+ # my_content_id,
40
+ # "links" => {
41
+ # "taxons" => %w(level_one_topic level_two_topic),
42
+ # },
43
+ # "previous_version" => "3",
44
+ # )
45
+ #
37
46
  # @param content_id [UUID]
38
47
  # @param body [String]
39
48
  def stub_publishing_api_patch_links(content_id, body)
40
49
  stub_publishing_api_patch(content_id, body, '/links')
41
50
  end
42
51
 
52
+ # Stub a PATCH /v2/links/:content_id request to return a 409 response
53
+ #
54
+ # @example
55
+ # stub_publishing_api_patch_links_conflict(
56
+ # my_content_id,
57
+ # "links" => {
58
+ # "taxons" => %w(level_one_topic level_two_topic),
59
+ # },
60
+ # "previous_version" => "3",
61
+ # )
62
+ #
63
+ # @param content_id [UUID]
64
+ # @param body [String]
65
+ def stub_publishing_api_patch_links_conflict(content_id, body)
66
+ override_response_hash = { status: 409, body: version_conflict(body[:previous_version]) }
67
+ stub_publishing_api_patch(content_id, body, '/links', override_response_hash)
68
+ end
69
+
43
70
  # Stub a POST /v2/content/:content_id/publish request
44
71
  #
45
72
  # @param content_id [UUID]
@@ -620,6 +647,16 @@ module GdsApi
620
647
  }
621
648
  }
622
649
  end
650
+
651
+ def version_conflict(expected_version, actual_version = expected_version + 1)
652
+ {
653
+ error: {
654
+ code: 409,
655
+ message: "A lock-version conflict occurred. The `previous_version` you've sent (#{expected_version}) is not the same as the current lock version of the edition (#{actual_version}).",
656
+ fields: { previous_version: ["does not match"] },
657
+ }
658
+ }
659
+ end
623
660
  end
624
661
  end
625
662
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '54.1.0'.freeze
2
+ VERSION = '54.1.1'.freeze
3
3
  end
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: 54.1.0
4
+ version: 54.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-02 00:00:00.000000000 Z
11
+ date: 2018-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable