gds-api-adapters 40.4.0 → 40.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 +6 -4
- data/lib/gds_api/test_helpers/publishing_api_v2.rb +3 -2
- 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: c3d32a44d6c4af1d7dfa99da6d1e4efd15f1058b
|
4
|
+
data.tar.gz: 4322ea245faa89b2d39b8bb785dd1ecc90477983
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0663bf4259c410c9ccc9b579e5f2725a4dc2a8fd8fe2ac0f78e6c7de4c2ff24e4726bb7c9e764fd6437c83442bb6c1436acb6333fb85445658341c782e656ffd
|
7
|
+
data.tar.gz: 3edc226ee816777b76e0304540471bef5fedd2effa272171d278d57dfb34bae31752215f9b50269e8a676fbadff2bf592a33a62f5d894066e0a8271c0240622b
|
@@ -199,10 +199,11 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
199
199
|
# Return the expanded links of the item.
|
200
200
|
#
|
201
201
|
# @param content_id [UUID]
|
202
|
+
# @param with_drafts [Bool] Whether links to draft-only editions are returned, defaulting to `true`.
|
202
203
|
#
|
203
204
|
# @example
|
204
205
|
#
|
205
|
-
# publishing_api.get_expanded_links("8157589b-65e2-4df6-92ba-2c91d80006c0").to_h
|
206
|
+
# publishing_api.get_expanded_links("8157589b-65e2-4df6-92ba-2c91d80006c0", with_drafts: false).to_h
|
206
207
|
#
|
207
208
|
# #=> {
|
208
209
|
# "content_id" => "8157589b-65e2-4df6-92ba-2c91d80006c0",
|
@@ -218,10 +219,11 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
218
219
|
# }
|
219
220
|
#
|
220
221
|
# @see https://github.com/alphagov/publishing-api/blob/master/doc/api.md#get-v2expanded-linkscontent_id
|
221
|
-
def get_expanded_links(content_id)
|
222
|
+
def get_expanded_links(content_id, with_drafts: true)
|
223
|
+
params = with_drafts ? {} : { with_drafts: "false" }
|
224
|
+
query = query_string(params)
|
222
225
|
validate_content_id(content_id)
|
223
|
-
|
224
|
-
get_json(url)
|
226
|
+
get_json("#{endpoint}/v2/expanded-links/#{content_id}#{query}")
|
225
227
|
end
|
226
228
|
|
227
229
|
# Patch the links of a content item
|
@@ -441,9 +441,10 @@ module GdsApi
|
|
441
441
|
# ]
|
442
442
|
# }
|
443
443
|
# }
|
444
|
-
def publishing_api_has_expanded_links(links)
|
444
|
+
def publishing_api_has_expanded_links(links, with_drafts: true)
|
445
445
|
links = deep_transform_keys(links, &:to_sym)
|
446
|
-
|
446
|
+
query = with_drafts ? "" : "?with_drafts=false"
|
447
|
+
url = PUBLISHING_API_V2_ENDPOINT + "/expanded-links/" + links[:content_id] + query
|
447
448
|
stub_request(:get, url).to_return(status: 200, body: links.to_json, headers: {})
|
448
449
|
end
|
449
450
|
|
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: 40.
|
4
|
+
version: 40.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: 2017-03-
|
11
|
+
date: 2017-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plek
|