gds-api-adapters 96.0.2 → 96.0.3

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: dc4d5293f2005f19ecf4e118705f8dada987a1dcc7d6a100ee750402d5d3ca2f
4
- data.tar.gz: 90b47aa245e497c7d652fc1b2885af98438b69b704b8f7cb229b9960492426e2
3
+ metadata.gz: 3182c86f70e20b3d92c0cf4f28f63a487e343dff7394d41de0f0953b51fde3fa
4
+ data.tar.gz: 2e31481af69353c207b13cc4e94c6e59a7f151c94c5eda22d5b2a0d0c4ef86ef
5
5
  SHA512:
6
- metadata.gz: f2bfe2f375887428b7f29dd888bce619900f0ff8f0c3d51d37fe7771a5282492ad54f584022ac28d4a2e7901c015cb9968c00b15d611b0915302027a27cc1e96
7
- data.tar.gz: 3c5ef5415b155090e5c763d5c9087b8b1f2e7db181d558aba488bdcb35a548113d221a6330245999c3e6ea1d2665ef675e84d9efc9924158bd044ecaf1f659f6
6
+ metadata.gz: 3b4d1743e125d8d1d8928fc7d4bc705fee3dd0eae19342d75d5c07f28dcea2590f8986efc3fd4671885ad610c311cf88deb62bccecd580cef39c3231cbe93834
7
+ data.tar.gz: a3a01fd52aa66cf83a346c90a025fa7972aee550f19f81de5ff3d033d98415101cf900a2e3e455286e245675a6aaa85ed7a3c1c93a6ac974355cb59eadac4845
@@ -337,6 +337,22 @@ class GdsApi::PublishingApi < GdsApi::Base
337
337
  get_json("#{endpoint}/v2/content#{query}")
338
338
  end
339
339
 
340
+ # Get content items which embed a reusable content_id
341
+ #
342
+ # No params are currently permitted.
343
+ #
344
+ # @example
345
+ #
346
+ # publishing_api.get_content_by_embedded_document("4b148ebc-b2bb-40db-8e48-dd8cff363ff7")
347
+ #
348
+ # @return [GdsApi::Response] A response containing a summarised list of the content items which embed the target.
349
+ # The content items returned will be in either the draft of published state.
350
+ #
351
+ # @see https://github.com/alphagov/publishing-api/blob/main/docs/api.md#get-v2contentcontent_idembedded
352
+ def get_content_by_embedded_document(content_id)
353
+ get_json("#{endpoint}/v2/content/#{content_id}/embedded")
354
+ end
355
+
340
356
  # Returns an Enumerator of content items for the provided
341
357
  # query string parameters.
342
358
  #
@@ -340,6 +340,43 @@ module GdsApi
340
340
  .to_return(status: 200, body: body.to_json, headers: {})
341
341
  end
342
342
 
343
+ # Stub GET /v2/content/:content_id/embedded to return a list of content items that embed the target content_id
344
+ #
345
+ # @example
346
+ #
347
+ # stub_publishing_api_has_content_(
348
+ # content_id: "9faacf5c-f4e6-4bf9-ba90-413e997c1f22" # this is the content_id for a reusable edition
349
+ # total: 1 # the number of results returned
350
+ # results: [{
351
+ # "title" => "foo",
352
+ # "document_type" => "document",
353
+ # "base_path" => "/foo",
354
+ # "content_id" => "e60fae2a-5490-4e2f-9e80-2093c47608d4",
355
+ # "primary_publishing_organisation" => {
356
+ # "content_id" => "7662e1e7-79f9-4d0a-b754-6232186851f6",
357
+ # "title" => "bar",
358
+ # "base_path" => "/organisation/bar",
359
+ # },
360
+ # }] # an array of content items that embed the target content_id
361
+ # )
362
+ # @param content_id [UUID, Mocha::ParameterMatchers::Anything]
363
+ # @param total Integer
364
+ # @param params [Hash]
365
+ def stub_publishing_api_has_embedded_content(content_id:, total: 0, results: [])
366
+ url = if content_id.is_a?(Mocha::ParameterMatchers::Anything)
367
+ %r{\A#{PUBLISHING_API_V2_ENDPOINT}/content/[0-9a-fA-F-]{36}/embedded}
368
+ else
369
+ "#{PUBLISHING_API_V2_ENDPOINT}/content/#{content_id}/embedded"
370
+ end
371
+
372
+ stub_request(:get, url)
373
+ .to_return(body: {
374
+ "content_id" => content_id,
375
+ "total" => total,
376
+ "results" => results,
377
+ }.to_json)
378
+ end
379
+
343
380
  # This method has been refactored into publishing_api_has_content (above)
344
381
  # publishing_api_has_content allows for flexible passing in of arguments, please use instead
345
382
  def stub_publishing_api_has_fields_for_document(document_type, items, fields)
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = "96.0.2".freeze
2
+ VERSION = "96.0.3".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: 96.0.2
4
+ version: 96.0.3
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-06-25 00:00:00.000000000 Z
11
+ date: 2024-08-30 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: 4.18.0
271
+ version: 5.0.2
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: 4.18.0
278
+ version: 5.0.2
279
279
  - !ruby/object:Gem::Dependency
280
280
  name: simplecov
281
281
  requirement: !ruby/object:Gem::Requirement
@@ -402,7 +402,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
402
402
  - !ruby/object:Gem::Version
403
403
  version: '0'
404
404
  requirements: []
405
- rubygems_version: 3.5.14
405
+ rubygems_version: 3.5.18
406
406
  signing_key:
407
407
  specification_version: 4
408
408
  summary: Adapters to work with GDS APIs