gds-api-adapters 30.4.0 → 30.5.0
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/publishing_api_v2.rb +4 -2
- data/lib/gds_api/test_helpers/publishing_api_v2.rb +10 -0
- data/lib/gds_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73f4ec1858d59e35d24b807bc1563ef99425a246
|
4
|
+
data.tar.gz: 2bf51592ac65dc4aad37e5bcfc517c1a9d27df07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c98b6e0f62db2002483a65c405d8d428ec66870fbee80f0bc76a148dbd204f2222c594ff3f1afc2ba53a2008728cc4707db7fd20bada1240026b47a91d0bd0b8
|
7
|
+
data.tar.gz: dbac2675ea0da5641190d1fd904822cecdc2c4a0e06bf2d8b9593c2e0c4cb6a5a36f61ca6e2dd46e3d20077f854ec20abb694d0f3cb77ec19c1a476ccbe7e7a2
|
@@ -118,9 +118,10 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
118
118
|
# @param alternative_path [String] (optional) Alternative path to show on the page or redirect to.
|
119
119
|
# @param discard_drafts [Boolean] (optional) Whether to discard drafts on that item. Defaults to false.
|
120
120
|
# @param previous_version [Integer] (optional) A lock version number for optimistic locking.
|
121
|
+
# @param locale [String] (optional) The content item locale.
|
121
122
|
#
|
122
|
-
# @see
|
123
|
-
def unpublish(content_id, type:, explanation: nil, alternative_path: nil, discard_drafts: false, previous_version: nil)
|
123
|
+
# @see https://github.com/alphagov/publishing-api/blob/master/doc/publishing-api-syntactic-usage.md#post-v2contentcontent_idunpublish
|
124
|
+
def unpublish(content_id, type:, explanation: nil, alternative_path: nil, discard_drafts: false, previous_version: nil, locale: nil)
|
124
125
|
params = {
|
125
126
|
type: type
|
126
127
|
}
|
@@ -129,6 +130,7 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
129
130
|
params.merge!(alternative_path: alternative_path) if alternative_path
|
130
131
|
params.merge!(previous_version: previous_version) if previous_version
|
131
132
|
params.merge!(discard_drafts: discard_drafts) if discard_drafts
|
133
|
+
params.merge!(locale: locale) if locale
|
132
134
|
|
133
135
|
post_json!(unpublish_url(content_id), params)
|
134
136
|
end
|
@@ -40,6 +40,16 @@ module GdsApi
|
|
40
40
|
stub_request(:post, url).with(body: body).to_return(response)
|
41
41
|
end
|
42
42
|
|
43
|
+
def stub_publishing_api_unpublish(content_id, params, response_hash = {})
|
44
|
+
url = PUBLISHING_API_V2_ENDPOINT + "/content/#{content_id}/unpublish"
|
45
|
+
response = {
|
46
|
+
status: 200,
|
47
|
+
body: '{}',
|
48
|
+
headers: {"Content-Type" => "application/json; charset=utf-8"}
|
49
|
+
}.merge(response_hash)
|
50
|
+
stub_request(:post, url).with(params).to_return(response)
|
51
|
+
end
|
52
|
+
|
43
53
|
def stub_publishing_api_discard_draft(content_id)
|
44
54
|
url = PUBLISHING_API_V2_ENDPOINT + "/content/#{content_id}/discard-draft"
|
45
55
|
stub_request(:post, url).to_return(status: 200, headers: {"Content-Type" => "application/json; charset=utf-8"})
|
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: 30.
|
4
|
+
version: 30.5.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-05-
|
11
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plek
|