gds-api-adapters 97.2.0 → 97.3.0
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/search_api_v2.rb +6 -0
- data/lib/gds_api/test_helpers/publishing_api.rb +26 -6
- data/lib/gds_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff4790d228201b1c229e1e2b884a2eae62465642cfe426581b5b3c32726536b2
|
4
|
+
data.tar.gz: d25f58e557df2982e70e1e373ee4665b0984aa1068944f0f33381cf0a931cc53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fde2097672b343ebad3e5f55d7a15a2b1e42415611d6a49e6d39239dd0dd31941c73000043e264cfc7292e410454bc28910fe638715b6090d34cbd3b6829871
|
7
|
+
data.tar.gz: 7dc3ec03939c0cf2e0f92174c9a4588fd2b378aa0af457a2f876b6a743b19f2903a82a63b6e5f000a51295dd80e1e6e6577daeeaa4fd117d2158a4d2c11cec3e
|
@@ -4,5 +4,11 @@ module GdsApi
|
|
4
4
|
request_url = "#{endpoint}/search.json?#{Rack::Utils.build_nested_query(args)}"
|
5
5
|
get_json(request_url, additional_headers)
|
6
6
|
end
|
7
|
+
|
8
|
+
def autocomplete(query)
|
9
|
+
args = { q: query }
|
10
|
+
request_url = "#{endpoint}/autocomplete.json?#{Rack::Utils.build_nested_query(args)}"
|
11
|
+
get_json(request_url)
|
12
|
+
end
|
7
13
|
end
|
8
14
|
end
|
@@ -376,14 +376,16 @@ module GdsApi
|
|
376
376
|
# @param total Integer
|
377
377
|
# @param total_pages Integer
|
378
378
|
# @param results [Hash]
|
379
|
-
def stub_publishing_api_has_embedded_content(content_id:, total: 0, total_pages: 0, results: [])
|
380
|
-
url =
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
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"
|
381
|
+
|
382
|
+
query = {
|
383
|
+
"page" => page_number,
|
384
|
+
"order" => order,
|
385
|
+
}.compact
|
385
386
|
|
386
387
|
stub_request(:get, url)
|
388
|
+
.with(query:)
|
387
389
|
.to_return(body: {
|
388
390
|
"content_id" => content_id,
|
389
391
|
"total" => total,
|
@@ -392,6 +394,24 @@ module GdsApi
|
|
392
394
|
}.to_json)
|
393
395
|
end
|
394
396
|
|
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}
|
399
|
+
|
400
|
+
query = {
|
401
|
+
"page" => page_number,
|
402
|
+
"order" => order,
|
403
|
+
}.compact
|
404
|
+
|
405
|
+
stub_request(:get, url)
|
406
|
+
.with { |request| WebMock::Util::QueryMapper.query_to_values(request.uri.query) == query }
|
407
|
+
.to_return(body: {
|
408
|
+
"content_id" => SecureRandom.uuid,
|
409
|
+
"total" => total,
|
410
|
+
"total_pages" => total_pages,
|
411
|
+
"results" => results,
|
412
|
+
}.to_json)
|
413
|
+
end
|
414
|
+
|
395
415
|
# This method has been refactored into publishing_api_has_content (above)
|
396
416
|
# publishing_api_has_content allows for flexible passing in of arguments, please use instead
|
397
417
|
def stub_publishing_api_has_fields_for_document(document_type, items, fields)
|
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.3.0
|
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-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|