govuk_personalisation 0.13.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a5a2220ec7824bf32bffa97e4965169731f346303b2712908b4160587c85b1f
4
- data.tar.gz: 9129d15308675709673f548c3df9d8be6c9d72a076395ef1817e563eb7482572
3
+ metadata.gz: ca12ab61e875bd39261e990560cd16d8957b15c2c4f16d9ffef0a2404cee91b7
4
+ data.tar.gz: e5826ce6cbd13aa29e6861ff15bd69d173313b73f73581e6df15ae8cc775157d
5
5
  SHA512:
6
- metadata.gz: a1ad6932786c4569c68280bab4e0e02a74b0e0afae6e504028c94a6877273ae9c8df75c7de869fcba9eb3502067e2acf724fb72be17a00e04c5c7ac6a03d46a7
7
- data.tar.gz: bd8db5c53d6f7526bb10f3ae8ca0240500932dfa6b91d361c3ae79ede0055dbcfc0c2faf7c87bd0f5fbe51b9dfecea307c176e7b004800f4db94c7ed5b50e214
6
+ metadata.gz: 0caf472a2188909e45cbe7720451dc224b9d809a9cf2983d8cb0f10111fd936fd164bbacafefb3c4480565f24d0ad36a87cd740ea5575076283a8ea688b9e307
7
+ data.tar.gz: 678e921c691e474ea7a87b7d1eb96061bceba614c6184c38731caf70e379e6877fb4cf58f5339a44316a616bf596e2634b7df595c93c968b4cd14271898a547f
@@ -7,10 +7,10 @@ jobs:
7
7
  fail-fast: false
8
8
  matrix:
9
9
  # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
10
- ruby: [2.7, '3.0', 3.1, 3.2]
10
+ ruby: ['3.0', 3.1, 3.2]
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
- - uses: actions/checkout@v3
13
+ - uses: actions/checkout@v4
14
14
  - uses: ruby/setup-ruby@v1
15
15
  with:
16
16
  ruby-version: ${{ matrix.ruby }}
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.6
1
+ 3.0.5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 0.15.0
2
+
3
+ - Update URLs and method names for One Login ([#56](https://github.com/alphagov/govuk_personalisation/pull/56))
4
+ - Note that this release deprecates the your_account, manage, security, and feedback methods of GovukPersonalisation::Urls, but retains them as aliases to allow easier transition. They will be removed in a later release.
5
+
6
+ # 0.14.0
7
+
8
+ - Use GOVUK_ENVIRONMENT as a backstop for DIGITAL_IDENTITY_ENVIRONMENT ([#53](https://github.com/alphagov/govuk_personalisation/pull/53))
9
+ - Drop Ruby 2.7 support ([#51](https://github.com/alphagov/govuk_personalisation/pull/51))
10
+
1
11
  # 0.13.0
2
12
 
3
13
  - Minimum Ruby version is now 2.7.6 ([#39](https://github.com/alphagov/govuk_personalisation/pull/39))
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.description = "A gem to hold shared code which other GOV.UK apps will use to implement accounts-related functionality."
15
15
  spec.homepage = "https://github.com/alphagov/govuk_personalisation"
16
16
  spec.license = "MIT"
17
- spec.required_ruby_version = Gem::Requirement.new(">= 2.7.6")
17
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.0")
18
18
 
19
19
  # Specify which files should be added to the gem when it is released.
20
20
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -33,5 +33,5 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "pry-byebug"
34
34
  spec.add_development_dependency "rake"
35
35
  spec.add_development_dependency "rspec-rails"
36
- spec.add_development_dependency "rubocop-govuk", "4.9.0"
36
+ spec.add_development_dependency "rubocop-govuk", "4.12.0"
37
37
  end
@@ -3,7 +3,7 @@
3
3
  module GovukPersonalisation::Flash
4
4
  SESSION_SEPARATOR = "$$"
5
5
  MESSAGE_SEPARATOR = ","
6
- MESSAGE_REGEX = /\A[a-zA-Z0-9._-]+\z/.freeze
6
+ MESSAGE_REGEX = /\A[a-zA-Z0-9._-]+\z/
7
7
 
8
8
  # Splits the session header into a session value (suitable for using
9
9
  # in account-api calls) and flash messages.
@@ -22,32 +22,41 @@ module GovukPersonalisation::Urls
22
22
  find_govuk_url(var: "SIGN_OUT", application: "email-alert-frontend", path: "/email/manage")
23
23
  end
24
24
 
25
- # Find the external URL for the "your account" page
25
+ # Find the external URL for the "your services" page on One Login
26
26
  #
27
27
  # @return [String] the URL
28
+ def self.one_login_your_services
29
+ find_external_url(var: "ONE_LOGIN_YOUR_SERVICES", url: "https://#{digital_identity_domain('home')}")
30
+ end
31
+
28
32
  def self.your_account
29
- find_external_url(var: "YOUR_ACCOUNT", url: "https://#{digital_identity_domain}")
33
+ one_login_your_services
30
34
  end
31
35
 
32
- # Find the external URL for the "manage" page
36
+ # Find the external URL for the "security" page on One Login
33
37
  #
34
38
  # @return [String] the URL
39
+ def self.one_login_security
40
+ find_external_url(var: "ONE_LOGIN_SECURITY", url: "https://#{digital_identity_domain('home')}/security")
41
+ end
42
+
35
43
  def self.manage
36
- find_external_url(var: "MANAGE", url: "https://#{digital_identity_domain}?link=manage-account")
44
+ one_login_security
37
45
  end
38
46
 
39
- # Find the external URL for the "security" page
40
- #
41
- # @return [String] the URL
42
47
  def self.security
43
- find_external_url(var: "SECURITY", url: "https://#{digital_identity_domain}?link=security-privacy")
48
+ one_login_security
44
49
  end
45
50
 
46
- # Find the external URL for the "feedback" page
51
+ # Find the external URL for the "feedback" page on One Login
47
52
  #
48
53
  # @return [String] the URL
54
+ def self.one_login_feedback
55
+ find_external_url(var: "ONE_LOGIN_FEEDBACK", url: "https://#{digital_identity_domain('signin')}/support?supportType=PUBLIC")
56
+ end
57
+
49
58
  def self.feedback
50
- find_external_url(var: "FEEDBACK", url: "https://signin.account.gov.uk/support")
59
+ one_login_feedback
51
60
  end
52
61
 
53
62
  # Finds a URL on www.gov.uk. This method is used so we can have
@@ -91,15 +100,17 @@ module GovukPersonalisation::Urls
91
100
  ENV.fetch("GOVUK_PERSONALISATION_#{var}_URI", url)
92
101
  end
93
102
 
94
- # Gets the Digital Identity domain for the current environment
95
- #
96
- # @return [String] the domain
97
- def self.digital_identity_domain
98
- environment = ENV["DIGITAL_IDENTITY_ENVIRONMENT"]
99
- if environment
100
- "home.#{environment}.account.gov.uk"
103
+ def self.digital_identity_domain(host)
104
+ if digital_identity_environment
105
+ "#{host}.#{digital_identity_environment}.account.gov.uk"
101
106
  else
102
- "home.account.gov.uk"
107
+ "#{host}.account.gov.uk"
103
108
  end
104
109
  end
110
+
111
+ def self.digital_identity_environment
112
+ return ENV["DIGITAL_IDENTITY_ENVIRONMENT"] if ENV["DIGITAL_IDENTITY_ENVIRONMENT"]
113
+
114
+ ENV["GOVUK_ENVIRONMENT"] == "production" ? nil : ENV["GOVUK_ENVIRONMENT"]
115
+ end
105
116
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GovukPersonalisation
4
- VERSION = "0.13.0"
4
+ VERSION = "0.15.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_personalisation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-19 00:00:00.000000000 Z
11
+ date: 2023-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plek
@@ -120,14 +120,14 @@ dependencies:
120
120
  requirements:
121
121
  - - '='
122
122
  - !ruby/object:Gem::Version
123
- version: 4.9.0
123
+ version: 4.12.0
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - '='
129
129
  - !ruby/object:Gem::Version
130
- version: 4.9.0
130
+ version: 4.12.0
131
131
  description: A gem to hold shared code which other GOV.UK apps will use to implement
132
132
  accounts-related functionality.
133
133
  email:
@@ -170,14 +170,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - ">="
172
172
  - !ruby/object:Gem::Version
173
- version: 2.7.6
173
+ version: '3.0'
174
174
  required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  requirements:
176
176
  - - ">="
177
177
  - !ruby/object:Gem::Version
178
178
  version: '0'
179
179
  requirements: []
180
- rubygems_version: 3.4.4
180
+ rubygems_version: 3.4.19
181
181
  signing_key:
182
182
  specification_version: 4
183
183
  summary: A gem to hold shared code which other GOV.UK apps will use to implement accounts-related