gov_fake_notify 1.1.1 → 1.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: 6d0b4a0c314fb0765dc52ded119d9de4c8116e102bac5700ab25397568b4fb23
4
- data.tar.gz: eb26beb1c5413d77473206756baeec9fdd98bd57b2d4b0f77c1b61ff9a7664ad
3
+ metadata.gz: 328a4b8bd7150fa5fa80584e6a28163e911f1a8ab8c50d23630d31710a9b845d
4
+ data.tar.gz: baf4e19409990d079218613fe1b80572944b9ece9dff39855672baa551810872
5
5
  SHA512:
6
- metadata.gz: 1cba914fabbf22c453f016048d460aa37b0b5fdccec28a616deefdef8c34b1deec1343dfb8a24477cbf36b59737762045d3960055406779ee9a2a5722a6bce93
7
- data.tar.gz: d3d58b3c3e47e3fc8bec35948195a19c1bf3fcb4fb3d465baf6c2c131e09bdb19a84e18421078560d110020a835ac9821dd9ed6e9e4e8ff3877c8ce28d12557d
6
+ metadata.gz: 2ae605a812571782eb2d3147e8b6b39f981e247d783baf40497ed43c89a27bef9bdb384009373a14e8fba52f4c95201b3f731597b7d21e546cb2be61a4245487
7
+ data.tar.gz: 808e2eb41722aa9e279280ddfa4c25ffe204c3ae4a026e378411a0e4a8aa1e1558e6078266619b3e840bb26fb6913f64ceae489855d84342e8e90c6578424918
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/gov_fake_notify.iml" filepath="$PROJECT_DIR$/.idea/gov_fake_notify.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gov_fake_notify (1.1.1)
5
- activemodel (>= 5.2.3)
4
+ gov_fake_notify (1.2.0)
5
+ activemodel (>= 6.1)
6
6
  iodine (~> 0.7)
7
7
  jwt (~> 2.2, >= 2.2.3)
8
8
  mail (~> 2.7, >= 2.7.1)
@@ -13,34 +13,33 @@ PATH
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- activemodel (6.1.4.1)
17
- activesupport (= 6.1.4.1)
18
- activesupport (6.1.4.1)
16
+ activemodel (7.0.3.1)
17
+ activesupport (= 7.0.3.1)
18
+ activesupport (7.0.3.1)
19
19
  concurrent-ruby (~> 1.0, >= 1.0.2)
20
20
  i18n (>= 1.6, < 2)
21
21
  minitest (>= 5.1)
22
22
  tzinfo (~> 2.0)
23
- zeitwerk (~> 2.3)
24
23
  ast (2.4.2)
25
- concurrent-ruby (1.1.9)
24
+ concurrent-ruby (1.1.10)
26
25
  diff-lcs (1.4.4)
27
- i18n (1.8.10)
26
+ i18n (1.12.0)
28
27
  concurrent-ruby (~> 1.0)
29
- iodine (0.7.44)
30
- jwt (2.2.3)
28
+ iodine (0.7.48)
29
+ jwt (2.4.1)
31
30
  mail (2.7.1)
32
31
  mini_mime (>= 0.1.1)
33
- mini_mime (1.1.1)
34
- minitest (5.14.4)
32
+ mini_mime (1.1.2)
33
+ minitest (5.16.2)
35
34
  parallel (1.21.0)
36
35
  parser (3.0.2.0)
37
36
  ast (~> 2.4.1)
38
- rack (2.2.3)
37
+ rack (2.2.4)
39
38
  rainbow (3.0.0)
40
39
  rake (12.3.3)
41
40
  regexp_parser (2.1.1)
42
41
  rexml (3.2.5)
43
- roda (3.48.0)
42
+ roda (3.58.0)
44
43
  rack
45
44
  rspec (3.10.0)
46
45
  rspec-core (~> 3.10.0)
@@ -67,12 +66,11 @@ GEM
67
66
  rubocop-ast (1.11.0)
68
67
  parser (>= 3.0.1.1)
69
68
  ruby-progressbar (1.11.0)
70
- thor (1.1.0)
71
- tilt (2.0.10)
72
- tzinfo (2.0.4)
69
+ thor (1.2.1)
70
+ tilt (2.0.11)
71
+ tzinfo (2.0.5)
73
72
  concurrent-ruby (~> 1.0)
74
73
  unicode-display_width (2.1.0)
75
- zeitwerk (2.4.2)
76
74
 
77
75
  PLATFORMS
78
76
  ruby
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ['lib']
29
29
 
30
- spec.add_dependency 'activemodel', '>= 5.2.3'
30
+ spec.add_dependency 'activemodel', '>= 6.1'
31
31
  spec.add_dependency 'iodine', '~> 0.7'
32
32
  spec.add_dependency 'jwt', '~> 2.2', '>= 2.2.3'
33
33
  spec.add_dependency 'mail', '~> 2.7', '>= 2.7.1'
@@ -57,19 +57,20 @@ module GovFakeNotify
57
57
  def send_email_from_template(template_data) # rubocop:disable Metrics/MethodLength
58
58
  pre_process_files
59
59
  our_params = params
60
- our_body = mail_message(template_data)
60
+ our_html_body = mail_message_html(template_data)
61
+ our_text_body = mail_message_text(template_data)
61
62
  our_service = service
62
- @message_body = our_body
63
+ @message_body = our_html_body
63
64
  mail = Mail.new do
64
65
  from our_service['service_email']
65
66
  to our_params['email_address']
66
67
  subject template_data['subject']
67
68
  html_part do
68
69
  content_type 'text/html; charset=UTF-8'
69
- body our_body
70
+ body our_html_body
70
71
  end
71
72
  text_part do
72
- body 'text part to go here'
73
+ body our_text_body
73
74
  end
74
75
  end
75
76
  mail.deliver
@@ -101,53 +102,102 @@ module GovFakeNotify
101
102
  end
102
103
  end
103
104
 
104
- def mail_message(template_data)
105
+ def mail_message_html(template_data)
105
106
  layout = Tilt.new(File.absolute_path('../../views/layouts/govuk.html.erb', __dir__))
106
107
  layout.render do
107
- template_content(template_data)
108
+ template_content_html(template_data)
108
109
  end
109
110
  end
110
111
 
111
- def template_content(template_data)
112
+ def mail_message_text(template_data)
113
+ layout = Tilt.new(File.absolute_path('../../views/layouts/govuk.text.erb', __dir__))
114
+ layout.render do
115
+ template_content_text(template_data)
116
+ end
117
+ end
118
+
119
+ def template_content_html(template_data)
112
120
  template = template_data['message']
113
121
  buffer = ''.dup
114
122
  template.each_line do |line|
115
- buffer << format_line(line)
123
+ buffer << format_line_html(line)
116
124
  end
117
125
  buffer
118
126
  end
119
127
 
120
- def format_line(line)
128
+ def template_content_text(template_data)
129
+ template = template_data['message']
130
+ buffer = ''.dup
131
+ template.each_line do |line|
132
+ buffer << format_line_text(line)
133
+ end
134
+ buffer
135
+ end
136
+
137
+ def format_line_html(line)
138
+ replaced = line.gsub(/\(\(([^)]*)\)\)/) do
139
+ post_process_value_html params['personalisation'][Regexp.last_match[1]]
140
+ end
141
+ wrap_line_html(replaced)
142
+ end
143
+
144
+ def format_line_text(line)
121
145
  replaced = line.gsub(/\(\(([^)]*)\)\)/) do
122
- post_process_value params['personalisation'][Regexp.last_match[1]]
146
+ post_process_value_text params['personalisation'][Regexp.last_match[1]]
123
147
  end
124
- wrap_line(replaced)
148
+ wrap_line_text(replaced)
125
149
  end
126
150
 
127
- def post_process_value(value)
151
+ def post_process_value_html(value)
128
152
  return value unless value.is_a?(Hash) && value.keys.include?('file')
129
153
 
130
- render_file(value)
154
+ render_file_html(value)
131
155
  end
132
156
 
133
- def wrap_line(line)
157
+ def post_process_value_text(value)
158
+ return value unless value.is_a?(Hash) && value.keys.include?('file')
159
+
160
+ render_file_text(value)
161
+ end
162
+
163
+ def wrap_line_html(line)
164
+ case line
165
+ when /^---/ then render_horizontal_line_html
166
+ else render_paragraph_html(line)
167
+ end
168
+ end
169
+
170
+ def wrap_line_text(line)
134
171
  case line
135
- when /^---/ then render_horizontal_line
136
- else render_paragraph(line)
172
+ when /^---/ then render_horizontal_line_text
173
+ else render_paragraph_text(line)
137
174
  end
138
175
  end
139
176
 
140
- def render_horizontal_line
177
+ def render_horizontal_line_html
141
178
  Tilt.new(File.absolute_path('../../views/govuk/horizontal_line.html.erb', __dir__)).render
142
179
  end
143
180
 
144
- def render_paragraph(line)
181
+ def render_horizontal_line_text
182
+ Tilt.new(File.absolute_path('../../views/govuk/horizontal_line.text.erb', __dir__)).render
183
+ end
184
+
185
+ def render_paragraph_html(line)
145
186
  Tilt.new(File.absolute_path('../../views/govuk/paragraph.html.erb', __dir__)).render(nil, content: line)
146
187
  end
147
188
 
148
- def render_file(file_data)
189
+ def render_paragraph_text(line)
190
+ Tilt.new(File.absolute_path('../../views/govuk/paragraph.text.erb', __dir__)).render(nil, content: line)
191
+ end
192
+
193
+ def render_file_html(file_data)
149
194
  Tilt.new(File.absolute_path('../../views/govuk/file.html.erb', __dir__)).render(nil, file_data: file_data,
150
195
  base_url: base_url)
151
196
  end
197
+
198
+ def render_file_text(file_data)
199
+ Tilt.new(File.absolute_path('../../views/govuk/file.text.erb', __dir__)).render(nil, file_data: file_data,
200
+ base_url: base_url)
201
+ end
152
202
  end
153
203
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GovFakeNotify
4
- VERSION = '1.1.1'
4
+ VERSION = '1.2.0'
5
5
  end
@@ -0,0 +1 @@
1
+ <%= base_url %>/files/confirm/<%= File.basename file_data['file'] %>
@@ -0,0 +1 @@
1
+ -------------------------------------------
@@ -0,0 +1 @@
1
+ <%= content %>
@@ -0,0 +1,2 @@
1
+
2
+ <%= yield %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gov_fake_notify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - garytaylor
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-28 00:00:00.000000000 Z
11
+ date: 2022-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.3
19
+ version: '6.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 5.2.3
26
+ version: '6.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: iodine
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -149,6 +149,7 @@ extensions: []
149
149
  extra_rdoc_files: []
150
150
  files:
151
151
  - ".gitignore"
152
+ - ".idea/modules.xml"
152
153
  - ".rspec"
153
154
  - ".rubocop.yml"
154
155
  - ".rubocop_todo.yml"
@@ -186,10 +187,13 @@ files:
186
187
  - lib/views/files/confirm.html.erb
187
188
  - lib/views/files/download.html.erb
188
189
  - lib/views/govuk/file.html.erb
190
+ - lib/views/govuk/file.text.erb
189
191
  - lib/views/govuk/horizontal_line.html.erb
192
+ - lib/views/govuk/horizontal_line.text.erb
190
193
  - lib/views/govuk/paragraph.html.erb
191
- - lib/views/govuk/show.html.erb
194
+ - lib/views/govuk/paragraph.text.erb
192
195
  - lib/views/layouts/govuk.html.erb
196
+ - lib/views/layouts/govuk.text.erb
193
197
  homepage: https://github.com/hmcts/gov_fake_notify
194
198
  licenses:
195
199
  - MIT
@@ -1,19 +0,0 @@
1
- <p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Claim number: 262000200400</p>
2
- <p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Gary Taylor</p>
3
- <p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Thank you for submitting your claim to an employment tribunal.</p>
4
- <hr style="border:0;height:1px;background:#bfc1c3;Margin:30px 0 30px 0">
5
- <p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">WHAT HAPPENS NEXT</p>
6
- <p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">We’ll contact you once we have sent your claim to the respondent and explain what happens next.<br>At present, this is taking us an average of 25 days.<br>Once we have sent them your claim, the respondent has 28 days to reply.</p>
7
- <hr style="border:0;height:1px;background:#bfc1c3;Margin:30px 0 30px 0">
8
- <p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">SUBMISSION DETAILS</p>
9
- <p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Claim submitted: 09 October 2020<br>Tribunal office: Midlands (East) ET<br>Contact: <a href="mailto:midlandseastet@justice.gov.uk" target="_blank">midlandseastet@justice.gov.uk</a>, 0115 947 5701</p>
10
- <hr style="border:0;height:1px;background:#bfc1c3;Margin:30px 0 30px 0">
11
- <p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Please use the link below to download a copy of your claim.<br><a style="word-wrap:break-word;color:#005ea5" href="https://documents.service.gov.uk/d/f8FKyAk4SCeu4_sjf5zV5w/p0-ZUPWESuGUsbUdomOoHQ?key=VvieEVMIEWUZTKZQWPR4Lb4HWCeCwVi3WtaqJICgvfA" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://documents.service.gov.uk/d/f8FKyAk4SCeu4_sjf5zV5w/p0-ZUPWESuGUsbUdomOoHQ?key%3DVvieEVMIEWUZTKZQWPR4Lb4HWCeCwVi3WtaqJICgvfA&amp;source=gmail&amp;ust=1632034513216000&amp;usg=AFQjCNG4im8mu2Nu231SXyHMi3gptqaYaQ">https://documents.service.gov.<wbr>uk/d/f8FKyAk4SCeu4_sjf5zV5w/<wbr>p0-ZUPWESuGUsbUdomOoHQ?key=<wbr>VvieEVMIEWUZTKZQWPR4Lb4HWCeCwV<wbr>i3WtaqJICgvfA</a></p>
12
- <hr style="border:0;height:1px;background:#bfc1c3;Margin:30px 0 30px 0">
13
- <p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Additional Information File</p>
14
- <p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">no additional file</p>
15
- <p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">no additional file</p>
16
- <hr style="border:0;height:1px;background:#bfc1c3;Margin:30px 0 30px 0">
17
- <p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Your feedback helps us improve this service:<br><a style="word-wrap:break-word;color:#005ea5" href="https://www.gov.uk/done/employment-tribunals-make-a-claim" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://www.gov.uk/done/employment-tribunals-make-a-claim&amp;source=gmail&amp;ust=1632034513216000&amp;usg=AFQjCNHY6ZdK3Y4wrMzZ6kpEubbSkN6byQ">https://www.gov.uk/done/<wbr>employment-tribunals-make-a-<wbr>claim</a></p>
18
- <p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Help us keep track. Complete our diversity monitoring questionnaire.<br><a style="word-wrap:break-word;color:#005ea5" href="https://employmenttribunals.service.gov.uk/en/apply/diversity" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://employmenttribunals.service.gov.uk/en/apply/diversity&amp;source=gmail&amp;ust=1632034513216000&amp;usg=AFQjCNGBtP5C9AjOY9cl0HAKTJYjMna5BA">https://employmenttribunals.<wbr>service.gov.uk/en/apply/<wbr>diversity</a></p>
19
- <p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Contact us: <a style="word-wrap:break-word;color:#005ea5" href="http://www.justice.gov.uk/contacts/hmcts/tribunals/employment" target="_blank" data-saferedirecturl="https://www.google.com/url?q=http://www.justice.gov.uk/contacts/hmcts/tribunals/employment&amp;source=gmail&amp;ust=1632034513216000&amp;usg=AFQjCNEq9IFj6UCn4aCCO1P8taYI_SQQRw">http://www.justice.gov.uk/<wbr>contacts/hmcts/tribunals/<wbr>employment</a></p>