gds-api-adapters 97.3.0 → 97.4.1
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.rb +9 -4
- data/lib/gds_api/test_helpers/publishing_api.rb +30 -6
- data/lib/gds_api/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3d86ff9c8bece588fe1eae2ec8ec8c71ca5ef5108c7b900f19f8444fb2d016b
|
4
|
+
data.tar.gz: 4d83794af16a9af548c3a1f803afb2e05f619728e3623305b6af667a9315b635
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc5856e22afbf5d6484a1b31074e14ed3a1d40dbdb902cb6ed7fb8f62c01c28ea238dbbe0d370373a9d08180057fbf69207916dc72a3706eee9174eacfc62129
|
7
|
+
data.tar.gz: 18e2a2894684c34f4ee5fe549bb88dae6cdc712e885996d597239e6ae8b9b780314c68ad3c2e7fc13b7af898eedb222541597272b1552400a83353fba08d246c
|
@@ -342,7 +342,7 @@ class GdsApi::PublishingApi < GdsApi::Base
|
|
342
342
|
# @param content_id [UUID]
|
343
343
|
# @param params [Hash]
|
344
344
|
#
|
345
|
-
# publishing_api.
|
345
|
+
# publishing_api.get_host_content_for_content_id(
|
346
346
|
# "4b148ebc-b2bb-40db-8e48-dd8cff363ff7",
|
347
347
|
# { page: 1, order: '-last_edited_at' }
|
348
348
|
# )
|
@@ -350,10 +350,15 @@ class GdsApi::PublishingApi < GdsApi::Base
|
|
350
350
|
# @return [GdsApi::Response] A response containing a summarised list of the content items which embed the target.
|
351
351
|
# The content items returned will be in either the draft of published state.
|
352
352
|
#
|
353
|
-
# @see https://github.com/alphagov/publishing-api/blob/main/docs/api.md#get-
|
354
|
-
def
|
353
|
+
# @see https://github.com/alphagov/publishing-api/blob/main/docs/api.md#get-v2contentcontent_idhost-content
|
354
|
+
def get_host_content_for_content_id(content_id, params = {})
|
355
355
|
query = query_string(params)
|
356
|
-
get_json("#{endpoint}/v2/content/#{content_id}/
|
356
|
+
get_json("#{endpoint}/v2/content/#{content_id}/host-content#{query}")
|
357
|
+
end
|
358
|
+
|
359
|
+
def get_content_by_embedded_document(content_id, params = {})
|
360
|
+
warn "GdsAPI::PublishingApi: #get_content_by_embedded_document deprecated (please use #get_host_content_for_content_id)"
|
361
|
+
get_host_content_for_content_id(content_id, params)
|
357
362
|
end
|
358
363
|
|
359
364
|
# Returns an Enumerator of content items for the provided
|
@@ -371,13 +371,28 @@ module GdsApi
|
|
371
371
|
# "base_path" => "/organisation/bar",
|
372
372
|
# },
|
373
373
|
# }] # an array of content items that embed the target content_id
|
374
|
+
# rollup: {
|
375
|
+
# "views" => 1
|
376
|
+
# "locations" => 1
|
377
|
+
# "instances" => 1
|
378
|
+
# "organisations" => 1
|
379
|
+
# } # metadata with the total counts across all pages
|
374
380
|
# )
|
375
|
-
# @param content_id [UUID
|
381
|
+
# @param content_id [UUID]
|
376
382
|
# @param total Integer
|
377
383
|
# @param total_pages Integer
|
378
|
-
# @param results [
|
379
|
-
|
380
|
-
|
384
|
+
# @param results [Array]
|
385
|
+
# @param rollup [Hash]
|
386
|
+
def stub_publishing_api_has_embedded_content(
|
387
|
+
content_id:,
|
388
|
+
total: 0,
|
389
|
+
total_pages: 0,
|
390
|
+
results: [],
|
391
|
+
page_number: nil,
|
392
|
+
order: nil,
|
393
|
+
rollup: {}
|
394
|
+
)
|
395
|
+
url = "#{PUBLISHING_API_V2_ENDPOINT}/content/#{content_id}/host-content"
|
381
396
|
|
382
397
|
query = {
|
383
398
|
"page" => page_number,
|
@@ -390,12 +405,20 @@ module GdsApi
|
|
390
405
|
"content_id" => content_id,
|
391
406
|
"total" => total,
|
392
407
|
"total_pages" => total_pages,
|
408
|
+
"rollup" => rollup,
|
393
409
|
"results" => results,
|
394
410
|
}.to_json)
|
395
411
|
end
|
396
412
|
|
397
|
-
def stub_publishing_api_has_embedded_content_for_any_content_id(
|
398
|
-
|
413
|
+
def stub_publishing_api_has_embedded_content_for_any_content_id(
|
414
|
+
total: 0,
|
415
|
+
total_pages: 0,
|
416
|
+
results: [],
|
417
|
+
page_number: nil,
|
418
|
+
order: nil,
|
419
|
+
rollup: {}
|
420
|
+
)
|
421
|
+
url = %r{\A#{PUBLISHING_API_V2_ENDPOINT}/content/[0-9a-fA-F-]{36}/host-content}
|
399
422
|
|
400
423
|
query = {
|
401
424
|
"page" => page_number,
|
@@ -408,6 +431,7 @@ module GdsApi
|
|
408
431
|
"content_id" => SecureRandom.uuid,
|
409
432
|
"total" => total,
|
410
433
|
"total_pages" => total_pages,
|
434
|
+
"rollup" => rollup,
|
411
435
|
"results" => results,
|
412
436
|
}.to_json)
|
413
437
|
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: 97.
|
4
|
+
version: 97.4.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: 2024-11-
|
11
|
+
date: 2024-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -268,14 +268,14 @@ dependencies:
|
|
268
268
|
requirements:
|
269
269
|
- - '='
|
270
270
|
- !ruby/object:Gem::Version
|
271
|
-
version: 5.0.
|
271
|
+
version: 5.0.3
|
272
272
|
type: :development
|
273
273
|
prerelease: false
|
274
274
|
version_requirements: !ruby/object:Gem::Requirement
|
275
275
|
requirements:
|
276
276
|
- - '='
|
277
277
|
- !ruby/object:Gem::Version
|
278
|
-
version: 5.0.
|
278
|
+
version: 5.0.3
|
279
279
|
- !ruby/object:Gem::Dependency
|
280
280
|
name: simplecov
|
281
281
|
requirement: !ruby/object:Gem::Requirement
|