gds-api-adapters 37.1.0 → 37.2.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ab688fe0f4c7a815626d93141d88d1bf0bda31c
|
4
|
+
data.tar.gz: 14bb6c214dbce0e1f266834944bbee61e5477343
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b4739c6b4c3df39058ed88251aded081463ead11eb1ee417c715f0806d9b8d2b817531967b3992f9cf7dcba3fffba0c5382daeae6cb08d1ddec76cb3acdf022
|
7
|
+
data.tar.gz: 0ddd803d87e83aebca6c6f12ea2526f2b247cb89c690915c1b5c7c309c38b11653da3db4cad72395e1aee56f7d20df29703dcad2e53afe6a88bcd84224f08cda
|
@@ -358,6 +358,43 @@ module GdsApi
|
|
358
358
|
stub_request(:post, url).to_return(body: lookup_hash.to_json)
|
359
359
|
end
|
360
360
|
|
361
|
+
#
|
362
|
+
# Stub calls to the get linked items endpoint
|
363
|
+
#
|
364
|
+
# @param items [Array] The linked items we wish to return
|
365
|
+
# @param params [Hash] A hash of parameters
|
366
|
+
#
|
367
|
+
# @example
|
368
|
+
#
|
369
|
+
# publishing_api_has_linked_items(
|
370
|
+
# [ item_1, item_2 ],
|
371
|
+
# {
|
372
|
+
# content_id: "51ac4247-fd92-470a-a207-6b852a97f2db",
|
373
|
+
# link_type: "taxons",
|
374
|
+
# fields: ["title", "description", "base_path"]
|
375
|
+
# }
|
376
|
+
# )
|
377
|
+
#
|
378
|
+
def publishing_api_has_linked_items(items, params = {})
|
379
|
+
content_id = params.fetch(:content_id)
|
380
|
+
link_type = params.fetch(:link_type)
|
381
|
+
fields = params.fetch(:fields, %w(base_path content_id document_type title))
|
382
|
+
|
383
|
+
url = Plek.current.find('publishing-api') + "/v2/linked/#{content_id}"
|
384
|
+
|
385
|
+
request_parmeters = {
|
386
|
+
"fields" => fields,
|
387
|
+
"link_type" => link_type,
|
388
|
+
}
|
389
|
+
|
390
|
+
stub_request(:get, url)
|
391
|
+
.with(query: request_parmeters)
|
392
|
+
.and_return(
|
393
|
+
body: items.to_json,
|
394
|
+
status: 200
|
395
|
+
)
|
396
|
+
end
|
397
|
+
|
361
398
|
private
|
362
399
|
|
363
400
|
def stub_publishing_api_put(*args)
|
data/lib/gds_api/version.rb
CHANGED
@@ -6,6 +6,32 @@ describe GdsApi::TestHelpers::PublishingApiV2 do
|
|
6
6
|
include GdsApi::TestHelpers::PublishingApiV2
|
7
7
|
let(:publishing_api) { GdsApi::PublishingApiV2.new(Plek.current.find("publishing-api")) }
|
8
8
|
|
9
|
+
describe '#publishing_api_has_linked_items' do
|
10
|
+
it "stubs the get linked items api call" do
|
11
|
+
links = [
|
12
|
+
{ 'content_id' => 'id-1', 'title' => 'title 1', 'link_type' => 'taxons' },
|
13
|
+
{ 'content_id' => 'id-2', 'title' => 'title 2', 'link_type' => 'taxons' },
|
14
|
+
]
|
15
|
+
publishing_api_has_linked_items(
|
16
|
+
links,
|
17
|
+
content_id: 'content-id',
|
18
|
+
link_type: 'taxons',
|
19
|
+
fields: [:title]
|
20
|
+
)
|
21
|
+
|
22
|
+
api_response = publishing_api.get_linked_items(
|
23
|
+
'content-id',
|
24
|
+
link_type: 'taxons',
|
25
|
+
fields: [:title]
|
26
|
+
)
|
27
|
+
|
28
|
+
assert_equal(
|
29
|
+
api_response.to_hash,
|
30
|
+
links
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
9
35
|
describe "#publishing_api_has_lookups" do
|
10
36
|
it "stubs the lookup for content items" do
|
11
37
|
lookup_hash = { "/foo" => "2878337b-bed9-4e7f-85b6-10ed2cbcd504" }
|
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: 37.
|
4
|
+
version: 37.2.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: 2016-10-
|
11
|
+
date: 2016-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plek
|