gds-api-adapters 100.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a97f28eec3d867d6b785d0f21be19bee59e5f554bdd8e8e8f560144c44adb3de
4
- data.tar.gz: 7159ed4dcbe4373a8ff071ccfce1c48a49b701925a06b0842a8f6333529e5b4f
3
+ metadata.gz: 0452ce585eda439e6e108d87399c57fc6735147d61e46f25aa9d2976ae2f2631
4
+ data.tar.gz: 1ee56ab8efe164f1129576143d70997d7068ca21f2d514f12df568948f01326b
5
5
  SHA512:
6
- metadata.gz: 25ce95b7d3dfc469b4bb27442648e4cd38287a0ab9e8e56b202f4ffb0b99e26236f6dcef3d908a462e4d0f9d4e8a3c338fa2d4e8efba3338ae250422bfca19e2
7
- data.tar.gz: 7c5cfb799ee20f8c632ebd508e31b28cd5a7c05233bcc661a7677b3c212741362c9607b0ae10b9f148fe16458276994d38afbfaa9c53e4f6e4e2b626e8784649
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)
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = "100.0.0".freeze
2
+ VERSION = "101.0.0".freeze
3
3
  end
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: 100.0.0
4
+ version: 101.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev