govuk_content_item_loader 2.1.3 → 2.2.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: 0dcf5b2b565e52bd01cb1ab8edd4a697fe05ece140cb044a9118b5ea0273c5a2
4
- data.tar.gz: 01070d8d27ae6541a211bdb939c54e0489db96900e4cb5c23a7234e2dd1a5288
3
+ metadata.gz: b3ceca83242496f8f8c801c30b74ff9e1a7e2614f9b596b9df3d793bb54f3f2e
4
+ data.tar.gz: f24ec6c54b15b1eeb5c3c793946c94ad44fe25aa173aceebabeec2b8000842b5
5
5
  SHA512:
6
- metadata.gz: d8e0abf9f4d6e7088742f6a034231904d9f3ca01835f235497896139917ddc49ff21a6857a448098fbc7881a5ec5cf2ea74150667ca83aa5fe826ebc983b220d
7
- data.tar.gz: 3351a571beed7bcf55f0ea8f3881e806d8d2955d9a36237e0c1542494da137d0d554552510a3ea30c453c0799885e63eeae14224c1c1ecea04a09f561bca1311
6
+ metadata.gz: ab47e97e60c256f5abc8286644de7e1f00a10295519b1effa8c1525afb3c09ff045cf4bd850b1e14c1bf044ce23e5d3901cc2a64733192e2079de2e163a5b8dc
7
+ data.tar.gz: 6e26ba08c76fc6a7cdada9282f8a6e709c44f54afd8465512d0920f9d44b37ce2d813b8168fd0beecee989913d187363bed65d947c91c66669b0286ac10d4bb4
@@ -1,10 +1,31 @@
1
1
  version: 2
2
2
  updates:
3
3
  - package-ecosystem: bundler
4
- directory: "/"
4
+ directory: /
5
5
  schedule:
6
- interval: daily
7
- - package-ecosystem: "github-actions"
8
- directory: "/"
6
+ interval: weekly
7
+ day: tuesday
8
+ time: "07:00"
9
+ allow:
10
+ - dependency-type: direct
11
+ cooldown:
12
+ default-days: 3
13
+ open-pull-requests-limit: 25
14
+ groups:
15
+ test:
16
+ patterns:
17
+ - "climate_control"
18
+ - "ostruct"
19
+ - "rspec"
20
+ - "simplecov"
21
+ - "webmock"
22
+
23
+ - package-ecosystem: github-actions
24
+ directory: /
9
25
  schedule:
10
- interval: daily
26
+ interval: weekly
27
+ day: tuesday
28
+ time: "07:00"
29
+ cooldown:
30
+ default-days: 3
31
+ open-pull-requests-limit: 25
@@ -1 +1 @@
1
- This application is owned by the Publishing Platform team. Please let us know in [#govuk-publishing-platform](https://gds.slack.com/archives/C03D792LYJG) when you raise any PRs.
1
+ This repo is owned by the Content APIs team. Please let us know in [#govuk-content-apis](https://gds.slack.com/archives/C03D792LYJG) when you raise any PRs.
@@ -6,7 +6,7 @@ jobs:
6
6
  actionlint:
7
7
  runs-on: ubuntu-latest
8
8
  steps:
9
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
9
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
10
10
  with:
11
11
  show-progress: false
12
12
  - uses: alphagov/govuk-infrastructure/.github/actions/actionlint@main
@@ -35,10 +35,10 @@ jobs:
35
35
  ruby: [3.3, 3.4, 4.0]
36
36
  runs-on: ubuntu-latest
37
37
  steps:
38
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
38
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
39
39
  with:
40
40
  ref: ${{ inputs.ref || github.ref }}
41
- - uses: ruby/setup-ruby@4c56a21280b36d862b5fc31348f463d60bdc55d5 # v1.301.0
41
+ - uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0
42
42
  with:
43
43
  ruby-version: ${{ matrix.ruby }}
44
44
  bundler-cache: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.2.0
4
+
5
+ * Don't initialise Publishing API client when the Publishing API connection is not configured
6
+
3
7
  ## 2.1.3
4
8
 
5
9
  * Update dependencies
@@ -1,9 +1,9 @@
1
1
  class GovukConditionalContentItemLoader
2
2
  attr_reader :content_store_client, :publishing_api_client, :request, :base_path
3
3
 
4
- def initialize(request:, content_store_client: GdsApi.content_store, publishing_api_client: GdsApi.publishing_api, base_path: nil)
4
+ def initialize(request:, content_store_client: GdsApi.content_store, publishing_api_client: nil, base_path: nil)
5
5
  @content_store_client = content_store_client
6
- @publishing_api_client = publishing_api_client
6
+ @publishing_api_client = publishing_api_client || default_publishing_api_client
7
7
  @request = request
8
8
  @base_path = base_path || request&.path
9
9
  end
@@ -15,6 +15,8 @@ class GovukConditionalContentItemLoader
15
15
  end
16
16
 
17
17
  def can_load_from_graphql?
18
+ return false unless publishing_api_client
19
+
18
20
  return false unless request
19
21
 
20
22
  return false if draft_host?
@@ -55,6 +57,14 @@ private
55
57
  request.env["govuk.prometheus_labels"] = prometheus_labels.merge(hash)
56
58
  end
57
59
 
60
+ def publishing_api_service_uri_configured?
61
+ !ENV["PLEK_SERVICE_PUBLISHING_API_URI"].nil?
62
+ end
63
+
64
+ def default_publishing_api_client
65
+ publishing_api_service_uri_configured? ? GdsApi.publishing_api : nil
66
+ end
67
+
58
68
  def draft_host?
59
69
  ENV["PLEK_HOSTNAME_PREFIX"] == "draft-"
60
70
  end
@@ -1,3 +1,3 @@
1
1
  module GovukContentItemLoader
2
- VERSION = "2.1.3".freeze
2
+ VERSION = "2.2.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_content_item_loader
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  - !ruby/object:Gem::Version
211
211
  version: '0'
212
212
  requirements: []
213
- rubygems_version: 4.0.10
213
+ rubygems_version: 4.0.14
214
214
  specification_version: 4
215
215
  summary: Provides a standardised content item loader for GOV.UK frontend apps with
216
216
  configurable GraphQL traffic routing and automatic fallback to the Content Store