gds-api-adapters 98.1.0 → 98.3.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 +4 -4
- data/lib/gds_api/email_alert_api.rb +1 -1
- data/lib/gds_api/publishing_api.rb +5 -2
- data/lib/gds_api/signon_api.rb +17 -0
- data/lib/gds_api/version.rb +1 -1
- data/lib/gds_api.rb +14 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fe90caccd0306511c9dc18c06ded0c55e9fff82236a7e6db924fd0d2664111e
|
4
|
+
data.tar.gz: 03253a27d17e1cf9f6a1f92ee3712bf9cd3d73bb4fbc75dfc555b743ae8fcc96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1952f1cae5f6e0b910e40a12aab64734ebfbe7ee02668192739cc94c6ee981f1285c2aff008fea4ca6c30fff8c70362c1a470823a6ada842bd240ba17cc596e9
|
7
|
+
data.tar.gz: '01585c1f95ff8453cda4a9faa064dfd6a04d748ef4bf736fe3040c8fdb14a08b4ca0c3ac50e90193abc18369b1dc7e6c927fc0d3168164affca31472596346f7'
|
@@ -11,7 +11,7 @@ class GdsApi::EmailAlertApi < GdsApi::Base
|
|
11
11
|
# @param attributes [Hash] document_type, links, tags used to search existing subscriber lists
|
12
12
|
def find_or_create_subscriber_list(attributes)
|
13
13
|
present_fields = [attributes["content_id"], attributes["links"], attributes["tags"]].compact.count
|
14
|
-
if (present_fields > 1) &&
|
14
|
+
if (present_fields > 1) && attributes["tags"]
|
15
15
|
message = "Invalid attributes provided. Valid attributes are content_id only, tags only, links only, content_id AND links, or none."
|
16
16
|
raise ArgumentError, message
|
17
17
|
end
|
@@ -360,17 +360,20 @@ class GdsApi::PublishingApi < GdsApi::Base
|
|
360
360
|
#
|
361
361
|
# @param content_id [UUID]
|
362
362
|
# @param host_content_id [UUID]
|
363
|
+
# @param params [Hash]
|
363
364
|
#
|
364
365
|
# publishing_api.get_host_content_item_for_content_id(
|
365
366
|
# "4b148ebc-b2bb-40db-8e48-dd8cff363ff7",
|
366
367
|
# "10d91dd1-cc9d-4c4c-9540-219ebb8d4501",
|
368
|
+
# { locale: "en" }
|
367
369
|
# )
|
368
370
|
#
|
369
371
|
# @return [GdsApi::Response] A response containing the content item which embeds the target.
|
370
372
|
#
|
371
373
|
# @see https://github.com/alphagov/publishing-api/blob/main/docs/api.md#get-v2contentcontent_idhost-contenthost_content_id
|
372
|
-
def get_host_content_item_for_content_id(content_id, host_content_id)
|
373
|
-
|
374
|
+
def get_host_content_item_for_content_id(content_id, host_content_id, params = {})
|
375
|
+
query = query_string(params)
|
376
|
+
get_json("#{endpoint}/v2/content/#{content_id}/host-content/#{host_content_id}#{query}")
|
374
377
|
end
|
375
378
|
|
376
379
|
def get_content_by_embedded_document(content_id, params = {})
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative "base"
|
2
|
+
|
3
|
+
class GdsApi::SignonApi < GdsApi::Base
|
4
|
+
# Get users with specific UUIDs
|
5
|
+
#
|
6
|
+
# @param uuids [Array]
|
7
|
+
#
|
8
|
+
# signon_api.users(
|
9
|
+
# ["7ac47b33-c09c-4c1d-a9a7-0cfef99081ac"],
|
10
|
+
# )
|
11
|
+
#
|
12
|
+
# @return [GdsApi::Response] A response containing a list of users with the specified UUIDs
|
13
|
+
def get_users(uuids:)
|
14
|
+
query = query_string(uuids:)
|
15
|
+
get_json("#{endpoint}/api/users#{query}")
|
16
|
+
end
|
17
|
+
end
|
data/lib/gds_api/version.rb
CHANGED
data/lib/gds_api.rb
CHANGED
@@ -16,6 +16,7 @@ require "gds_api/organisations"
|
|
16
16
|
require "gds_api/publishing_api"
|
17
17
|
require "gds_api/search"
|
18
18
|
require "gds_api/search_api_v2"
|
19
|
+
require "gds_api/signon_api"
|
19
20
|
require "gds_api/support"
|
20
21
|
require "gds_api/support_api"
|
21
22
|
require "gds_api/worldwide"
|
@@ -154,6 +155,19 @@ module GdsApi
|
|
154
155
|
)
|
155
156
|
end
|
156
157
|
|
158
|
+
# Creates a GdsApi::SignonApi adapter
|
159
|
+
#
|
160
|
+
# This will set a bearer token if a PUBLISHING_API_BEARER_TOKEN environment
|
161
|
+
# variable is set
|
162
|
+
#
|
163
|
+
# @return [GdsApi::SignonApi]
|
164
|
+
def self.signon_api(options = {})
|
165
|
+
GdsApi::SignonApi.new(
|
166
|
+
Plek.find("signon"),
|
167
|
+
{ bearer_token: ENV["SIGNON_API_BEARER_TOKEN"] }.merge(options),
|
168
|
+
)
|
169
|
+
end
|
170
|
+
|
157
171
|
# Creates a GdsApi::Search adapter to access via a search.* hostname
|
158
172
|
#
|
159
173
|
# @return [GdsApi::Search]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gds-api-adapters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 98.
|
4
|
+
version: 98.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 2025-03-12 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: addressable
|
@@ -267,14 +267,14 @@ dependencies:
|
|
267
267
|
requirements:
|
268
268
|
- - '='
|
269
269
|
- !ruby/object:Gem::Version
|
270
|
-
version: 5.0.
|
270
|
+
version: 5.0.9
|
271
271
|
type: :development
|
272
272
|
prerelease: false
|
273
273
|
version_requirements: !ruby/object:Gem::Requirement
|
274
274
|
requirements:
|
275
275
|
- - '='
|
276
276
|
- !ruby/object:Gem::Version
|
277
|
-
version: 5.0.
|
277
|
+
version: 5.0.9
|
278
278
|
- !ruby/object:Gem::Dependency
|
279
279
|
name: simplecov
|
280
280
|
requirement: !ruby/object:Gem::Requirement
|
@@ -352,6 +352,7 @@ files:
|
|
352
352
|
- lib/gds_api/response.rb
|
353
353
|
- lib/gds_api/search.rb
|
354
354
|
- lib/gds_api/search_api_v2.rb
|
355
|
+
- lib/gds_api/signon_api.rb
|
355
356
|
- lib/gds_api/support.rb
|
356
357
|
- lib/gds_api/support_api.rb
|
357
358
|
- lib/gds_api/test_helpers/account_api.rb
|
@@ -398,7 +399,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
398
399
|
- !ruby/object:Gem::Version
|
399
400
|
version: '0'
|
400
401
|
requirements: []
|
401
|
-
rubygems_version: 3.6.
|
402
|
+
rubygems_version: 3.6.5
|
402
403
|
specification_version: 4
|
403
404
|
summary: Adapters to work with GDS APIs
|
404
405
|
test_files: []
|