gds-api-adapters 96.0.3 → 97.1.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: 3182c86f70e20b3d92c0cf4f28f63a487e343dff7394d41de0f0953b51fde3fa
4
- data.tar.gz: 2e31481af69353c207b13cc4e94c6e59a7f151c94c5eda22d5b2a0d0c4ef86ef
3
+ metadata.gz: c727b23d7397797f8a4dc8167fade432fd4161efcc9062942e6f942058bbdfc7
4
+ data.tar.gz: d4f897215feb468597bea8d62cb87c7c92bad5859ab1a7892c010aab99087d59
5
5
  SHA512:
6
- metadata.gz: 3b4d1743e125d8d1d8928fc7d4bc705fee3dd0eae19342d75d5c07f28dcea2590f8986efc3fd4671885ad610c311cf88deb62bccecd580cef39c3231cbe93834
7
- data.tar.gz: a3a01fd52aa66cf83a346c90a025fa7972aee550f19f81de5ff3d033d98415101cf900a2e3e455286e245675a6aaa85ed7a3c1c93a6ac974355cb59eadac4845
6
+ metadata.gz: 8a2de0818203bbd9f62766cbda6cbe7cb2402f87d5123d2a26cd094997dcf9acdb6a82575379329099c9434cdc13b8461abb57036d195c13a2a7e5e01d8fe609
7
+ data.tar.gz: 9663d632dce82d41aaeea134e17fe30334893084d89b0d5c8ac3ae5c8f02c3df804f4e1599fb5017110beec1363c641801ea99d66a98444ad126a9c6fd7e9007
data/README.md CHANGED
@@ -110,6 +110,30 @@ Then at the PSQL command line:
110
110
 
111
111
  `template1=# CREATE EXTENSION IF NOT EXISTS "uuid-ossp";`
112
112
 
113
+ ## Releasing
114
+
115
+ 1. Read the CHANGELOG.md and decide on the new semantic version number
116
+ 1. Create a release branch, eg. `release-96.0.3`
117
+ 1. Update the CHANGELOG.md
118
+ - Declare a new version number
119
+ - Move all unreleased changes beneath it
120
+ 1. Update `lib/gds_api/version.rb` to match, eg
121
+
122
+ ```ruby
123
+ module GdsApi
124
+ VERSION = "96.0.3".freeze
125
+ end
126
+ ```
127
+
128
+ 1. Copy the lines from the CHANGELOG.md into the git commit
129
+ 1. Propose and merge the pull request into `main`
130
+
131
+ Nb:
132
+
133
+ - You do not need to set any git tags
134
+ - After merging, CI will release the new version of the gem and Dependabot will
135
+ propose the new version of the gem to help distribute the changes to consumers
136
+
113
137
  ## Licence
114
138
 
115
139
  Released under the MIT Licence, a copy of which can be found in the file
@@ -53,7 +53,7 @@ private
53
53
  "#{Plek.new.website_root}#{destination_uri}"
54
54
  end
55
55
 
56
- [url, status_code(redirect)]
56
+ [url, 301]
57
57
  end
58
58
 
59
59
  private_class_method :new
@@ -105,10 +105,6 @@ private
105
105
 
106
106
  uri.to_s
107
107
  end
108
-
109
- def status_code(redirect)
110
- redirect["redirect_type"] == "temporary" ? 302 : 301
111
- end
112
108
  end
113
109
 
114
110
  class UnresolvedRedirect < GdsApi::BaseError; end
@@ -550,6 +550,15 @@ class GdsApi::PublishingApi < GdsApi::Base
550
550
  get_json("#{endpoint}/v2/schemas/#{schema_name}").to_hash
551
551
  end
552
552
 
553
+ # Make a GraphQL query
554
+ #
555
+ # @param query [String]
556
+ #
557
+ # @return [Hash] A response with the result of the GraphQL query.
558
+ def graphql_query(query)
559
+ post_json("#{endpoint}/graphql", query:).to_hash
560
+ end
561
+
553
562
  private
554
563
 
555
564
  def content_url(content_id, params = {})
@@ -33,7 +33,7 @@ class GdsApi::Router < GdsApi::Base
33
33
  )
34
34
  end
35
35
 
36
- def add_redirect_route(path, type, destination, redirect_type = "permanent", options = {})
36
+ def add_redirect_route(path, type, destination, options = {})
37
37
  put_json(
38
38
  "#{endpoint}/routes",
39
39
  route: {
@@ -41,7 +41,6 @@ class GdsApi::Router < GdsApi::Base
41
41
  route_type: type,
42
42
  handler: "redirect",
43
43
  redirect_to: destination,
44
- redirect_type:,
45
44
  segments_mode: options[:segments_mode],
46
45
  },
47
46
  )
@@ -188,6 +188,19 @@ module GdsApi
188
188
  stub_request(:any, /#{PUBLISHING_API_ENDPOINT}\/.*/).to_return(status: 503)
189
189
  end
190
190
 
191
+ # Stub a POST /graphql request
192
+ #
193
+ # @param query [String]
194
+ def stub_publishing_api_graphql_query(query, response_hash = {})
195
+ url = "#{PUBLISHING_API_ENDPOINT}/graphql"
196
+ response = {
197
+ status: 200,
198
+ body: response_hash.to_json,
199
+ headers: { "Content-Type" => "application/json; charset=utf-8" },
200
+ }
201
+ stub_request(:post, url).with(body: { query: }).to_return(response)
202
+ end
203
+
191
204
  # Assert that a draft was saved and published, and links were updated.
192
205
  # - PUT /v2/content/:content_id
193
206
  # - POST /v2/content/:content_id/publish
@@ -21,8 +21,8 @@ module GdsApi
21
21
  stub_router_has_route(path, handler: "backend", backend_id:, disabled:, route_type:)
22
22
  end
23
23
 
24
- def stub_router_has_redirect_route(path, redirect_to:, redirect_type: "permanent", route_type: "exact", disabled: false)
25
- stub_router_has_route(path, handler: "redirect", redirect_to:, redirect_type:, disabled:, route_type:)
24
+ def stub_router_has_redirect_route(path, redirect_to:, route_type: "exact", disabled: false)
25
+ stub_router_has_route(path, handler: "redirect", redirect_to:, disabled:, route_type:)
26
26
  end
27
27
 
28
28
  def stub_router_has_gone_route(path, route_type: "exact", disabled: false)
@@ -52,14 +52,13 @@ module GdsApi
52
52
  })
53
53
  end
54
54
 
55
- def stub_redirect_registration(path, type, destination, redirect_type, segments_mode = nil)
55
+ def stub_redirect_registration(path, type, destination, segments_mode = nil)
56
56
  stub_route_put({
57
57
  route: {
58
58
  incoming_path: path,
59
59
  route_type: type,
60
60
  handler: "redirect",
61
61
  redirect_to: destination,
62
- redirect_type:,
63
62
  segments_mode:,
64
63
  },
65
64
  })
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = "96.0.3".freeze
2
+ VERSION = "97.1.0".freeze
3
3
  end
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: 96.0.3
4
+ version: 97.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-30 00:00:00.000000000 Z
11
+ date: 2024-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -402,7 +402,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
402
402
  - !ruby/object:Gem::Version
403
403
  version: '0'
404
404
  requirements: []
405
- rubygems_version: 3.5.18
405
+ rubygems_version: 3.5.22
406
406
  signing_key:
407
407
  specification_version: 4
408
408
  summary: Adapters to work with GDS APIs