gds-api-adapters 99.3.0 → 101.0.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/publishing_api.rb +0 -31
- data/lib/gds_api/test_helpers/publishing_api.rb +0 -13
- data/lib/gds_api/version.rb +1 -1
- data/lib/gds_api.rb +0 -11
- metadata +3 -4
- data/lib/gds_api/maslow.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0452ce585eda439e6e108d87399c57fc6735147d61e46f25aa9d2976ae2f2631
|
4
|
+
data.tar.gz: 1ee56ab8efe164f1129576143d70997d7068ca21f2d514f12df568948f01326b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ae3c45e6a375f143392fbd520f4cfdd9f33e800793c13ddf6115ca1aba9fde8b4d947ff192b7e5450698b1927b2fbb64d63b92c47f662d7ec3743bc7cd9798e
|
7
|
+
data.tar.gz: e233c70c834929000f9e77c057a9383ff83b198e6712a25193f3727fff43834b53c148c581167bca0b981f8bfc8c0a503448b6b799f2315ab80c493c4979f452
|
@@ -605,37 +605,6 @@ class GdsApi::PublishingApi < GdsApi::Base
|
|
605
605
|
post_json("#{endpoint}/graphql", query:)
|
606
606
|
end
|
607
607
|
|
608
|
-
# Make a GraphQL query and return the response in the same format as a Content Store content item
|
609
|
-
#
|
610
|
-
# @param query [String]
|
611
|
-
#
|
612
|
-
# @return [GdsApi::Response] A response with the result of the GraphQL query formatted like a Content Store content item.
|
613
|
-
def graphql_content_item(query)
|
614
|
-
create_response = proc do |r|
|
615
|
-
parsed_body = JSON.parse(r.body)
|
616
|
-
|
617
|
-
updated_body = if parsed_body["errors"] && (unpublished_error = parsed_body["errors"].find { |error| error["message"] == "Edition has been unpublished" })
|
618
|
-
if unpublished_error.dig("extensions", "schema_name") == "gone" &&
|
619
|
-
(unpublished_error.dig("extensions", "details").nil? || unpublished_error.dig("extensions", "details").values.compact.reject(&:empty?).empty?)
|
620
|
-
raise GdsApi::HTTPGone.new(410, nil, unpublished_error["extensions"])
|
621
|
-
end
|
622
|
-
|
623
|
-
unpublished_error["extensions"]
|
624
|
-
else
|
625
|
-
parsed_body.dig("data", "edition")
|
626
|
-
end
|
627
|
-
|
628
|
-
updated_response = RestClient::Response.create(
|
629
|
-
updated_body.to_json,
|
630
|
-
r.net_http_res,
|
631
|
-
r.request,
|
632
|
-
)
|
633
|
-
GdsApi::Response.new(updated_response)
|
634
|
-
end
|
635
|
-
|
636
|
-
post_json("#{endpoint}/graphql", query:, &create_response)
|
637
|
-
end
|
638
|
-
|
639
608
|
# Get the live content item using GraphQL
|
640
609
|
#
|
641
610
|
# @return [GdsApi::Response] A response with the result of the GraphQL query formatted like a Content Store content item.
|
@@ -201,19 +201,6 @@ module GdsApi
|
|
201
201
|
stub_request(:post, url).with(body: { query: }).to_return(response)
|
202
202
|
end
|
203
203
|
|
204
|
-
# Stub a POST /graphql content item request
|
205
|
-
#
|
206
|
-
# @param query [String]
|
207
|
-
def stub_publishing_api_graphql_content_item(query, response_hash = {})
|
208
|
-
url = "#{PUBLISHING_API_ENDPOINT}/graphql"
|
209
|
-
response = {
|
210
|
-
status: 200,
|
211
|
-
body: response_hash.to_json,
|
212
|
-
headers: { "Content-Type" => "application/json; charset=utf-8" },
|
213
|
-
}
|
214
|
-
stub_request(:post, url).with(body: { query: }).to_return(response)
|
215
|
-
end
|
216
|
-
|
217
204
|
# Stub a GET /graphql/content/:base_path request
|
218
205
|
def stub_publishing_api_graphql_has_item(base_path, body = content_item_for_base_path(base_path), options = {})
|
219
206
|
max_age = options.fetch(:max_age, 900)
|
data/lib/gds_api/version.rb
CHANGED
data/lib/gds_api.rb
CHANGED
@@ -11,7 +11,6 @@ require "gds_api/licence_application"
|
|
11
11
|
require "gds_api/link_checker_api"
|
12
12
|
require "gds_api/local_links_manager"
|
13
13
|
require "gds_api/locations_api"
|
14
|
-
require "gds_api/maslow"
|
15
14
|
require "gds_api/organisations"
|
16
15
|
require "gds_api/publishing_api"
|
17
16
|
require "gds_api/search"
|
@@ -123,16 +122,6 @@ module GdsApi
|
|
123
122
|
GdsApi::LocationsApi.new(Plek.find("locations-api"), options)
|
124
123
|
end
|
125
124
|
|
126
|
-
# Creates a GdsApi::Maslow adapter
|
127
|
-
#
|
128
|
-
# It's set to use an external url as an endpoint as the Maslow adapter is
|
129
|
-
# used to generate external links
|
130
|
-
#
|
131
|
-
# @return [GdsApi::Maslow]
|
132
|
-
def self.maslow(options = {})
|
133
|
-
GdsApi::Maslow.new(Plek.new.external_url_for("maslow"), options)
|
134
|
-
end
|
135
|
-
|
136
125
|
# Creates a GdsApi::Organisations adapter for accessing Whitehall
|
137
126
|
# APIs through the origin, where the requests will be handled by
|
138
127
|
# Collections frontend.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gds-api-adapters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 101.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
@@ -267,14 +267,14 @@ dependencies:
|
|
267
267
|
requirements:
|
268
268
|
- - '='
|
269
269
|
- !ruby/object:Gem::Version
|
270
|
-
version: 5.1.
|
270
|
+
version: 5.1.19
|
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.1.
|
277
|
+
version: 5.1.19
|
278
278
|
- !ruby/object:Gem::Dependency
|
279
279
|
name: simplecov
|
280
280
|
requirement: !ruby/object:Gem::Requirement
|
@@ -342,7 +342,6 @@ files:
|
|
342
342
|
- lib/gds_api/list_response.rb
|
343
343
|
- lib/gds_api/local_links_manager.rb
|
344
344
|
- lib/gds_api/locations_api.rb
|
345
|
-
- lib/gds_api/maslow.rb
|
346
345
|
- lib/gds_api/middleware/govuk_header_sniffer.rb
|
347
346
|
- lib/gds_api/organisations.rb
|
348
347
|
- lib/gds_api/places_manager.rb
|