gds-api-adapters 47.1.1 → 47.1.2
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 +4 -4
- data/lib/gds_api/publishing_api_v2.rb +15 -4
- data/lib/gds_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a17d11273afbf8570787c39195b5a82169afbbc5
|
|
4
|
+
data.tar.gz: 75c2fdecf164e1b60cddd4e04d75e1c17f10afb4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b536ed4c51f78eb622c5642ac950ce0dffc5bde4c29ec1e049e9b69241682ad1af4428b9be9d6929da4b8c4bc57fbacc9c30cbc24e3993ff56199ed9a98689e
|
|
7
|
+
data.tar.gz: b6f03de36bfd875e3ede56462744d512030df55cfc92f16aad9e589f9e887877cf6f3d4721a0918b3c96490a3fe84bdf7909787fd6b152cf31b1197a898614d8
|
|
@@ -41,6 +41,8 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
|
41
41
|
# Find the content_ids for a list of base_paths.
|
|
42
42
|
#
|
|
43
43
|
# @param base_paths [Array]
|
|
44
|
+
# @param exclude_document_types [Array] (optional)
|
|
45
|
+
# @param exclude_publishing_types [Array] (optional)
|
|
44
46
|
# @return [Hash] a hash, keyed by `base_path` with `content_id` as value
|
|
45
47
|
# @example
|
|
46
48
|
#
|
|
@@ -48,8 +50,11 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
|
48
50
|
# # => { "/foo" => "51ac4247-fd92-470a-a207-6b852a97f2db", "/bar" => "261bd281-f16c-48d5-82d2-9544019ad9ca" }
|
|
49
51
|
#
|
|
50
52
|
# @see https://github.com/alphagov/publishing-api/blob/master/doc/api.md#post-lookup-by-base-path
|
|
51
|
-
def lookup_content_ids(base_paths:)
|
|
52
|
-
|
|
53
|
+
def lookup_content_ids(base_paths:, exclude_document_types: nil, exclude_publishing_types: nil)
|
|
54
|
+
options = { base_paths: base_paths }
|
|
55
|
+
options[:exclude_document_types] = exclude_document_types if exclude_document_types
|
|
56
|
+
options[:exclude_publishing_types] = exclude_publishing_types if exclude_publishing_types
|
|
57
|
+
response = post_json("#{endpoint}/lookup-by-base-path", options)
|
|
53
58
|
response.to_hash
|
|
54
59
|
end
|
|
55
60
|
|
|
@@ -59,6 +64,8 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
|
59
64
|
# base_path. For multiple base_paths, use {GdsApi::PublishingApiV2#lookup_content_ids}.
|
|
60
65
|
#
|
|
61
66
|
# @param base_path [String]
|
|
67
|
+
# @param exclude_document_types [Array] (optional)
|
|
68
|
+
# @param exclude_publishing_types [Array] (optional)
|
|
62
69
|
#
|
|
63
70
|
# @return [UUID] the `content_id` for the `base_path`
|
|
64
71
|
#
|
|
@@ -68,8 +75,12 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
|
|
|
68
75
|
# # => "51ac4247-fd92-470a-a207-6b852a97f2db"
|
|
69
76
|
#
|
|
70
77
|
# @see https://github.com/alphagov/publishing-api/blob/master/doc/api.md#post-lookup-by-base-path
|
|
71
|
-
def lookup_content_id(base_path:)
|
|
72
|
-
lookups = lookup_content_ids(
|
|
78
|
+
def lookup_content_id(base_path:, exclude_document_types: nil, exclude_publishing_types: nil)
|
|
79
|
+
lookups = lookup_content_ids(
|
|
80
|
+
base_paths: [base_path],
|
|
81
|
+
exclude_document_types: exclude_document_types,
|
|
82
|
+
exclude_publishing_types: exclude_publishing_types
|
|
83
|
+
)
|
|
73
84
|
lookups[base_path]
|
|
74
85
|
end
|
|
75
86
|
|
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: 47.1.
|
|
4
|
+
version: 47.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Stewart
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-07-
|
|
11
|
+
date: 2017-07-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: plek
|