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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff4790d228201b1c229e1e2b884a2eae62465642cfe426581b5b3c32726536b2
4
- data.tar.gz: d25f58e557df2982e70e1e373ee4665b0984aa1068944f0f33381cf0a931cc53
3
+ metadata.gz: a3d86ff9c8bece588fe1eae2ec8ec8c71ca5ef5108c7b900f19f8444fb2d016b
4
+ data.tar.gz: 4d83794af16a9af548c3a1f803afb2e05f619728e3623305b6af667a9315b635
5
5
  SHA512:
6
- metadata.gz: 1fde2097672b343ebad3e5f55d7a15a2b1e42415611d6a49e6d39239dd0dd31941c73000043e264cfc7292e410454bc28910fe638715b6090d34cbd3b6829871
7
- data.tar.gz: 7dc3ec03939c0cf2e0f92174c9a4588fd2b378aa0af457a2f876b6a743b19f2903a82a63b6e5f000a51295dd80e1e6e6577daeeaa4fd117d2158a4d2c11cec3e
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.get_content_by_embedded_document(
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-v2contentcontent_idembedded
354
- def get_content_by_embedded_document(content_id, params = {})
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}/embedded#{query}")
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, Mocha::ParameterMatchers::Anything]
381
+ # @param content_id [UUID]
376
382
  # @param total Integer
377
383
  # @param total_pages Integer
378
- # @param results [Hash]
379
- def stub_publishing_api_has_embedded_content(content_id:, total: 0, total_pages: 0, results: [], page_number: nil, order: nil)
380
- url = "#{PUBLISHING_API_V2_ENDPOINT}/content/#{content_id}/embedded"
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(total: 0, total_pages: 0, results: [], page_number: nil, order: nil)
398
- url = %r{\A#{PUBLISHING_API_V2_ENDPOINT}/content/[0-9a-fA-F-]{36}/embedded}
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
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = "97.3.0".freeze
2
+ VERSION = "97.4.1".freeze
3
3
  end
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.3.0
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-14 00:00:00.000000000 Z
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.2
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.2
278
+ version: 5.0.3
279
279
  - !ruby/object:Gem::Dependency
280
280
  name: simplecov
281
281
  requirement: !ruby/object:Gem::Requirement