gds-api-adapters 54.1.0 → 54.1.1
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/test_helpers/publishing_api_v2.rb +37 -0
- data/lib/gds_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5024a7a7b46c8e9d94294bfb2dc38206adc60fd52a74eb83f4c22604f1c10e6
|
4
|
+
data.tar.gz: 3868924f4dd1a30526fc3454fd8f41aed7cda0e2852c77648b8ccc4c58532cce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/gds_api/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2018-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|