govuk_personalisation 0.4.0 → 0.5.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: 267d1e8727e692cb953532c2064e3730455845c95a78caa468e82525b5800864
4
- data.tar.gz: 1d303703827774ca360100948fbd3a2a98c7145ae02153b1faaa801107a961f3
3
+ metadata.gz: 7494e4a43a49be9a654d9b95ad2a2884575c3d46b8b6e5487b9c472575705ada
4
+ data.tar.gz: 4321076a89efdcc1289d3dccb23eb7c26a87dd877dc63764d1d6da796f18c128
5
5
  SHA512:
6
- metadata.gz: 29720a981741b63b503fd28affdf48b41f9f2ab0e7f28368db85d9d4e81726a3264e771dc1b4e5696d4190470cbe2450f949735795f88e2c9182dbc35a370f9d
7
- data.tar.gz: ff365c527b710f736e34470364b3679c37328734f80ebfc5d09e25a50c833e410e3cd2472f90a86ebc35cf456c34632128f6b590beb43bc425a37de82de56682
6
+ metadata.gz: 3d772b13491114187dc74f38ceb5959721da4e9df7caa46384fea1e5b7e2f0bdc96486b9e11e1f07a40da625371bfd219f10024d801f417fe23da75ec32ce435
7
+ data.tar.gz: 1e68f1eeb364957909271666d19a12af06c3f64f47744c9e34d7850a99282b67685cace40b997d5b56a4245b1b7501fc8d03e4c2eaec61b8eddd91957604783f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.5.0
2
+
3
+ - Rename header name constants ([#7](https://github.com/alphagov/govuk_personalisation/pull/7))
4
+
1
5
  # 0.4.0
2
6
 
3
7
  - Add ability to set GOVUK-Account-Session ([#6](https://github.com/alphagov/govuk_personalisation/pull/6))
@@ -6,9 +6,9 @@ module GovukPersonalisation
6
6
  module AccountConcern
7
7
  extend ActiveSupport::Concern
8
8
 
9
- ACCOUNT_SESSION_REQUEST_HEADER_NAME = "HTTP_GOVUK_ACCOUNT_SESSION"
10
- ACCOUNT_SESSION_RESPONSE_HEADER_NAME = "GOVUK-Account-Session"
11
- ACCOUNT_END_SESSION_RESPONSE_HEADER_NAME = "GOVUK-Account-End-Session"
9
+ ACCOUNT_SESSION_INTERNAL_HEADER_NAME = "HTTP_GOVUK_ACCOUNT_SESSION"
10
+ ACCOUNT_SESSION_HEADER_NAME = "GOVUK-Account-Session"
11
+ ACCOUNT_END_SESSION_HEADER_NAME = "GOVUK-Account-End-Session"
12
12
  ACCOUNT_SESSION_DEV_COOKIE_NAME = "govuk_account_session"
13
13
 
14
14
  included do
@@ -23,20 +23,20 @@ module GovukPersonalisation
23
23
 
24
24
  def fetch_account_session_header
25
25
  @account_session_header =
26
- if request.headers[ACCOUNT_SESSION_REQUEST_HEADER_NAME]
27
- request.headers[ACCOUNT_SESSION_REQUEST_HEADER_NAME].presence
26
+ if request.headers[ACCOUNT_SESSION_INTERNAL_HEADER_NAME]
27
+ request.headers[ACCOUNT_SESSION_INTERNAL_HEADER_NAME].presence
28
28
  elsif Rails.env.development?
29
29
  cookies[ACCOUNT_SESSION_DEV_COOKIE_NAME]
30
30
  end
31
31
  end
32
32
 
33
33
  def set_account_vary_header
34
- response.headers["Vary"] = [response.headers["Vary"], ACCOUNT_SESSION_RESPONSE_HEADER_NAME].compact.join(", ")
34
+ response.headers["Vary"] = [response.headers["Vary"], ACCOUNT_SESSION_HEADER_NAME].compact.join(", ")
35
35
  end
36
36
 
37
37
  def set_account_session_header(govuk_account_session = nil)
38
38
  @account_session_header = govuk_account_session if govuk_account_session
39
- response.headers[ACCOUNT_SESSION_RESPONSE_HEADER_NAME] = @account_session_header
39
+ response.headers[ACCOUNT_SESSION_HEADER_NAME] = @account_session_header
40
40
  if Rails.env.development?
41
41
  cookies[ACCOUNT_SESSION_DEV_COOKIE_NAME] = {
42
42
  value: @account_session_header,
@@ -46,7 +46,7 @@ module GovukPersonalisation
46
46
  end
47
47
 
48
48
  def logout!
49
- response.headers[ACCOUNT_END_SESSION_RESPONSE_HEADER_NAME] = "1"
49
+ response.headers[ACCOUNT_END_SESSION_HEADER_NAME] = "1"
50
50
  @account_session_header = nil
51
51
  if Rails.env.development?
52
52
  cookies[ACCOUNT_SESSION_DEV_COOKIE_NAME] = {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GovukPersonalisation
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.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.4.0
4
+ version: 0.5.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: 2021-06-08 00:00:00.000000000 Z
11
+ date: 2021-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails