gds-api-adapters 57.3.1 → 57.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gds_api/publishing_api_v2.rb +23 -0
- data/lib/gds_api/test_helpers/publishing_api_v2.rb +20 -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: 98f6d50e09a673f3d635d13d13da68c1c862813aec0370aae6fc1ed7560b1d13
|
4
|
+
data.tar.gz: ab20464e5ae9434f97a7368ff6d66e69240077daf7ac572634a9a34d6c458787
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09253066aef155ced752a0c50305caa1ade28432c7675adecf827b63b2b715e7ad085a48df8561157aafcfb8e16f3dd0c0ecb8b15bbc0a5be90cebde581e2789'
|
7
|
+
data.tar.gz: 77deeb7ae44f867c919656093a3c4fe27eb31f26398df38be67df639a4cbe23b27c58692dee605cab2a5c4403f8a2b206fe7fbf8e579cbc7651afae40e97d9ef
|
@@ -106,6 +106,24 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
106
106
|
post_json(publish_url(content_id), params)
|
107
107
|
end
|
108
108
|
|
109
|
+
# Republish a content item
|
110
|
+
#
|
111
|
+
# The publishing-api will "republish" a live edition. This can be used to remove an unpublishing or to
|
112
|
+
# re-send a published edition downstream
|
113
|
+
#
|
114
|
+
# @param content_id [UUID]
|
115
|
+
# @param options [Hash]
|
116
|
+
# @option options [String] locale The language, defaults to 'en' in publishing-api.
|
117
|
+
#
|
118
|
+
# @see ...
|
119
|
+
def republish(content_id, options = {})
|
120
|
+
optional_keys = %i[locale previous_version]
|
121
|
+
|
122
|
+
params = merge_optional_keys({}, options, optional_keys)
|
123
|
+
|
124
|
+
post_json(republish_url(content_id), params)
|
125
|
+
end
|
126
|
+
|
109
127
|
# Import content into the publishing API
|
110
128
|
#
|
111
129
|
# The publishing-api will delete any content which has the content
|
@@ -447,6 +465,11 @@ private
|
|
447
465
|
"#{endpoint}/v2/content/#{content_id}/publish"
|
448
466
|
end
|
449
467
|
|
468
|
+
def republish_url(content_id)
|
469
|
+
validate_content_id(content_id)
|
470
|
+
"#{endpoint}/v2/content/#{content_id}/republish"
|
471
|
+
end
|
472
|
+
|
450
473
|
def unpublish_url(content_id)
|
451
474
|
validate_content_id(content_id)
|
452
475
|
"#{endpoint}/v2/content/#{content_id}/unpublish"
|
@@ -84,6 +84,21 @@ module GdsApi
|
|
84
84
|
stub_request(:post, url).with(body: body).to_return(response)
|
85
85
|
end
|
86
86
|
|
87
|
+
# Stub a POST /v2/content/:content_id/republish request
|
88
|
+
#
|
89
|
+
# @param content_id [UUID]
|
90
|
+
# @param body [String]
|
91
|
+
# @param response_hash [Hash]
|
92
|
+
def stub_publishing_api_republish(content_id, body = {}, response_hash = {})
|
93
|
+
url = PUBLISHING_API_V2_ENDPOINT + "/content/#{content_id}/republish"
|
94
|
+
response = {
|
95
|
+
status: 200,
|
96
|
+
body: '{}',
|
97
|
+
headers: { "Content-Type" => "application/json; charset=utf-8" }
|
98
|
+
}.merge(response_hash)
|
99
|
+
stub_request(:post, url).with(body: body).to_return(response)
|
100
|
+
end
|
101
|
+
|
87
102
|
# Stub a POST /v2/content/:content_id/unpublish request
|
88
103
|
#
|
89
104
|
# @param content_id [UUID]
|
@@ -143,6 +158,11 @@ module GdsApi
|
|
143
158
|
stub_request(:post, %r{\A#{PUBLISHING_API_V2_ENDPOINT}/content/.*/publish})
|
144
159
|
end
|
145
160
|
|
161
|
+
# Stub any POST /v2/content/*/publish request
|
162
|
+
def stub_any_publishing_api_republish
|
163
|
+
stub_request(:post, %r{\A#{PUBLISHING_API_V2_ENDPOINT}/content/.*/republish})
|
164
|
+
end
|
165
|
+
|
146
166
|
# Stub any POST /v2/content/*/unpublish request
|
147
167
|
def stub_any_publishing_api_unpublish
|
148
168
|
stub_request(:post, %r{\A#{PUBLISHING_API_V2_ENDPOINT}/content/.*/unpublish})
|
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: 57.
|
4
|
+
version: 57.4.0
|
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: 2019-
|
11
|
+
date: 2019-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|