govuk_notify_rails 2.1.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/govuk_notify_rails/delivery.rb +16 -6
- data/lib/govuk_notify_rails/mail_ext.rb +5 -1
- data/lib/govuk_notify_rails/mailer.rb +6 -0
- data/lib/govuk_notify_rails/version.rb +1 -1
- data/spec/dummy/app/mailers/notify_mailer.rb +3 -0
- data/spec/dummy/log/development.log +288 -0
- data/spec/govuk_notify_delivery/delivery_spec.rb +74 -11
- data/spec/mailers/notify_mailer_spec.rb +11 -0
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7ae8e3403bc21d367702344fca21fdbccfb591089e9bfdaab0bef913345012e
|
4
|
+
data.tar.gz: 3f8ea35ea1389e0e420a73c9d698cb752b625254927a0e39b6114ab68ae6c820
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3656b4fba827f8290881dbdd910152756c7b32c82809769244e20dcb84fbe2617464dadf78c897a6a1bf2fc59da778264ab1726210c1e0a759170a60ba94c7d
|
7
|
+
data.tar.gz: ea580374689d4755e68585a2e80dd135f92ae1ac9dba74404ae4b976b255b77c47aec514cd4909342176ae63e78e4480dcfe5253541ec2eb85fe515c02daaa49
|
@@ -7,10 +7,20 @@ module GovukNotifyRails
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def deliver!(message)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
payload = payload_for(message)
|
11
|
+
|
12
|
+
responses = message.to.map do |to|
|
13
|
+
notify_client.send_email(
|
14
|
+
payload.merge(email_address: to)
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
message.govuk_notify_responses = responses
|
19
|
+
|
20
|
+
# For backwards compatibility
|
21
|
+
message.govuk_notify_response = responses.first
|
22
|
+
|
23
|
+
responses
|
14
24
|
end
|
15
25
|
|
16
26
|
private
|
@@ -21,11 +31,11 @@ module GovukNotifyRails
|
|
21
31
|
|
22
32
|
def payload_for(message)
|
23
33
|
{
|
24
|
-
email_address: message.to.first,
|
25
34
|
template_id: message.govuk_notify_template,
|
26
35
|
reference: message.govuk_notify_reference,
|
27
36
|
personalisation: message.govuk_notify_personalisation,
|
28
|
-
email_reply_to_id: message.govuk_notify_email_reply_to
|
37
|
+
email_reply_to_id: message.govuk_notify_email_reply_to,
|
38
|
+
one_click_unsubscribe_url: message.govuk_notify_one_click_unsubscribe_url
|
29
39
|
}.compact
|
30
40
|
end
|
31
41
|
|
@@ -2,8 +2,12 @@ module Mail
|
|
2
2
|
class Message
|
3
3
|
attr_accessor :govuk_notify_template
|
4
4
|
attr_accessor :govuk_notify_reference
|
5
|
+
attr_accessor :govuk_notify_email_reply_to
|
6
|
+
attr_accessor :govuk_notify_one_click_unsubscribe_url
|
7
|
+
|
5
8
|
attr_accessor :govuk_notify_personalisation
|
9
|
+
|
6
10
|
attr_accessor :govuk_notify_response
|
7
|
-
attr_accessor :
|
11
|
+
attr_accessor :govuk_notify_responses
|
8
12
|
end
|
9
13
|
end
|
@@ -6,6 +6,7 @@ module GovukNotifyRails
|
|
6
6
|
attr_accessor :govuk_notify_reference
|
7
7
|
attr_accessor :govuk_notify_personalisation
|
8
8
|
attr_accessor :govuk_notify_email_reply_to
|
9
|
+
attr_accessor :govuk_notify_one_click_unsubscribe_url
|
9
10
|
|
10
11
|
protected
|
11
12
|
|
@@ -19,6 +20,7 @@ module GovukNotifyRails
|
|
19
20
|
message.govuk_notify_reference = govuk_notify_reference
|
20
21
|
message.govuk_notify_personalisation = govuk_notify_personalisation
|
21
22
|
message.govuk_notify_email_reply_to = govuk_notify_email_reply_to
|
23
|
+
message.govuk_notify_one_click_unsubscribe_url = govuk_notify_one_click_unsubscribe_url
|
22
24
|
end
|
23
25
|
|
24
26
|
def set_template(template)
|
@@ -37,6 +39,10 @@ module GovukNotifyRails
|
|
37
39
|
self.govuk_notify_email_reply_to = address
|
38
40
|
end
|
39
41
|
|
42
|
+
def set_one_click_unsubscribe_url(url)
|
43
|
+
self.govuk_notify_one_click_unsubscribe_url = url
|
44
|
+
end
|
45
|
+
|
40
46
|
def _default_body
|
41
47
|
'This is a GOV.UK Notify email with template %s and personalisation: %s' % [govuk_notify_template, govuk_notify_personalisation]
|
42
48
|
end
|
@@ -2,6 +2,9 @@ class NotifyMailer < GovukNotifyRails::Mailer
|
|
2
2
|
def test_email(user)
|
3
3
|
set_template('9661d08a-486d-4c67-865e-ad976f17871d')
|
4
4
|
set_reference('my_reference')
|
5
|
+
set_email_reply_to('527c131f-ef4b-4b5b-8f9b-3202581af277')
|
6
|
+
set_one_click_unsubscribe_url('https://example.com/unsubscribe?token=123456')
|
7
|
+
|
5
8
|
set_personalisation(
|
6
9
|
full_name: user.name
|
7
10
|
)
|
@@ -181,3 +181,291 @@ NotifyMailer#test_email: processed outbound mail in 0.5ms
|
|
181
181
|
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
182
182
|
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
183
183
|
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
184
|
+
NotifyMailer#test_email: processed outbound mail in 4.8ms
|
185
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
186
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
187
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
188
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
189
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
190
|
+
NotifyMailer#test_email: processed outbound mail in 3.5ms
|
191
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
192
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
193
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
194
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
195
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
196
|
+
NotifyMailer#test_email: processed outbound mail in 3.6ms
|
197
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
198
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
199
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
200
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
201
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
202
|
+
NotifyMailer#test_email: processed outbound mail in 9.9ms
|
203
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
204
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
205
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
206
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
207
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
208
|
+
NotifyMailer#test_email: processed outbound mail in 9.1ms
|
209
|
+
NotifyMailer#test_email: processed outbound mail in 1.8ms
|
210
|
+
NotifyMailer#test_email: processed outbound mail in 1.5ms
|
211
|
+
NotifyMailer#test_email: processed outbound mail in 1.4ms
|
212
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
213
|
+
NotifyMailer#test_email: processed outbound mail in 1.3ms
|
214
|
+
NotifyMailer#test_email: processed outbound mail in 3.5ms
|
215
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
216
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
217
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
218
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
219
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
220
|
+
NotifyMailer#test_email: processed outbound mail in 3.8ms
|
221
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
222
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
223
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
224
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
225
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
226
|
+
NotifyMailer#test_email: processed outbound mail in 3.6ms
|
227
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
228
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
229
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
230
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
231
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
232
|
+
NotifyMailer#test_email: processed outbound mail in 3.6ms
|
233
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
234
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
235
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
236
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
237
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
238
|
+
NotifyMailer#test_email: processed outbound mail in 10.9ms
|
239
|
+
NotifyMailer#test_email: processed outbound mail in 1.8ms
|
240
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
241
|
+
NotifyMailer#test_email: processed outbound mail in 0.9ms
|
242
|
+
NotifyMailer#test_email: processed outbound mail in 1.0ms
|
243
|
+
NotifyMailer#test_email: processed outbound mail in 1.2ms
|
244
|
+
NotifyMailer#test_email: processed outbound mail in 3.5ms
|
245
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
246
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
247
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
248
|
+
NotifyMailer#test_email: processed outbound mail in 0.6ms
|
249
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
250
|
+
NotifyMailer#test_email: processed outbound mail in 3.5ms
|
251
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
252
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
253
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
254
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
255
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
256
|
+
NotifyMailer#test_email: processed outbound mail in 3.9ms
|
257
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
258
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
259
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
260
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
261
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
262
|
+
NotifyMailer#test_email: processed outbound mail in 3.7ms
|
263
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
264
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
265
|
+
NotifyMailer#test_email: processed outbound mail in 0.9ms
|
266
|
+
NotifyMailer#test_email: processed outbound mail in 0.7ms
|
267
|
+
NotifyMailer#test_email: processed outbound mail in 0.8ms
|
268
|
+
NotifyMailer#test_email: processed outbound mail in 3.5ms
|
269
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
270
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
271
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
272
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
273
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
274
|
+
NotifyMailer#test_email: processed outbound mail in 9.4ms
|
275
|
+
NotifyMailer#test_email: processed outbound mail in 1.6ms
|
276
|
+
NotifyMailer#test_email: processed outbound mail in 1.3ms
|
277
|
+
NotifyMailer#test_email: processed outbound mail in 1.2ms
|
278
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
279
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
280
|
+
NotifyMailer#test_email: processed outbound mail in 3.5ms
|
281
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
282
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
283
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
284
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
285
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
286
|
+
NotifyMailer#test_email: processed outbound mail in 3.6ms
|
287
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
288
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
289
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
290
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
291
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
292
|
+
NotifyMailer#test_email: processed outbound mail in 3.9ms
|
293
|
+
NotifyMailer#test_email: processed outbound mail in 0.6ms
|
294
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
295
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
296
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
297
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
298
|
+
NotifyMailer#test_email: processed outbound mail in 3.4ms
|
299
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
300
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
301
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
302
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
303
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
304
|
+
NotifyMailer#test_email: processed outbound mail in 3.3ms
|
305
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
306
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
307
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
308
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
309
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
310
|
+
NotifyMailer#test_email: processed outbound mail in 3.7ms
|
311
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
312
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
313
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
314
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
315
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
316
|
+
NotifyMailer#test_email: processed outbound mail in 10.0ms
|
317
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
318
|
+
NotifyMailer#test_email: processed outbound mail in 1.2ms
|
319
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
320
|
+
NotifyMailer#test_email: processed outbound mail in 1.1ms
|
321
|
+
NotifyMailer#test_email: processed outbound mail in 1.1ms
|
322
|
+
NotifyMailer#test_email: processed outbound mail in 8.3ms
|
323
|
+
NotifyMailer#test_email: processed outbound mail in 1.3ms
|
324
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
325
|
+
NotifyMailer#test_email: processed outbound mail in 1.2ms
|
326
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
327
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
328
|
+
NotifyMailer#test_email: processed outbound mail in 5.5ms
|
329
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
330
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
331
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
332
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
333
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
334
|
+
NotifyMailer#test_email: processed outbound mail in 3.2ms
|
335
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
336
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
337
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
338
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
339
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
340
|
+
NotifyMailer#test_email: processed outbound mail in 3.4ms
|
341
|
+
NotifyMailer#test_email: processed outbound mail in 8.4ms
|
342
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
343
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
344
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
345
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
346
|
+
NotifyMailer#test_email: processed outbound mail in 3.5ms
|
347
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
348
|
+
NotifyMailer#test_email: processed outbound mail in 0.6ms
|
349
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
350
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
351
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
352
|
+
NotifyMailer#test_email: processed outbound mail in 4.1ms
|
353
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
354
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
355
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
356
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
357
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
358
|
+
NotifyMailer#test_email: processed outbound mail in 3.3ms
|
359
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
360
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
361
|
+
NotifyMailer#test_email: processed outbound mail in 1.1ms
|
362
|
+
NotifyMailer#test_email: processed outbound mail in 0.9ms
|
363
|
+
NotifyMailer#test_email: processed outbound mail in 0.7ms
|
364
|
+
NotifyMailer#test_email: processed outbound mail in 3.5ms
|
365
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
366
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
367
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
368
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
369
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
370
|
+
NotifyMailer#test_email: processed outbound mail in 3.6ms
|
371
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
372
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
373
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
374
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
375
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
376
|
+
NotifyMailer#test_email: processed outbound mail in 3.6ms
|
377
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
378
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
379
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
380
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
381
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
382
|
+
NotifyMailer#test_email: processed outbound mail in 24.5ms
|
383
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
384
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
385
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
386
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
387
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
388
|
+
NotifyMailer#test_email: processed outbound mail in 26.1ms
|
389
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
390
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
391
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
392
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
393
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
394
|
+
NotifyMailer#test_email: processed outbound mail in 26.2ms
|
395
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
396
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
397
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
398
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
399
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
400
|
+
NotifyMailer#test_email: processed outbound mail in 30.0ms
|
401
|
+
NotifyMailer#test_email: processed outbound mail in 0.6ms
|
402
|
+
NotifyMailer#test_email: processed outbound mail in 5.5ms
|
403
|
+
NotifyMailer#test_email: processed outbound mail in 0.7ms
|
404
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
405
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
406
|
+
NotifyMailer#test_email: processed outbound mail in 0.8ms
|
407
|
+
NotifyMailer#test_email: processed outbound mail in 0.6ms
|
408
|
+
NotifyMailer#test_email: processed outbound mail in 28.0ms
|
409
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
410
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
411
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
412
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
413
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
414
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
415
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
416
|
+
NotifyMailer#test_email: processed outbound mail in 18.1ms
|
417
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
418
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
419
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
420
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
421
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
422
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
423
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
424
|
+
NotifyMailer#test_email: processed outbound mail in 17.5ms
|
425
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
426
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
427
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
428
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
429
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
430
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
431
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
432
|
+
NotifyMailer#test_email: processed outbound mail in 23.8ms
|
433
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
434
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
435
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
436
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
437
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
438
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
439
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
440
|
+
NotifyMailer#test_email: processed outbound mail in 26.0ms
|
441
|
+
NotifyMailer#test_email: processed outbound mail in 0.6ms
|
442
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
443
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
444
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
445
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
446
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
447
|
+
NotifyMailer#test_email: processed outbound mail in 0.3ms
|
448
|
+
NotifyMailer#test_email: processed outbound mail in 32.4ms
|
449
|
+
NotifyMailer#test_email: processed outbound mail in 0.6ms
|
450
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
451
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
452
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
453
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
454
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
455
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
456
|
+
NotifyMailer#test_email: processed outbound mail in 36.9ms
|
457
|
+
NotifyMailer#test_email: processed outbound mail in 1.4ms
|
458
|
+
NotifyMailer#test_email: processed outbound mail in 0.8ms
|
459
|
+
NotifyMailer#test_email: processed outbound mail in 0.6ms
|
460
|
+
NotifyMailer#test_email: processed outbound mail in 1.0ms
|
461
|
+
NotifyMailer#test_email: processed outbound mail in 0.7ms
|
462
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
463
|
+
NotifyMailer#test_email: processed outbound mail in 0.6ms
|
464
|
+
NotifyMailer#test_email: processed outbound mail in 24.2ms
|
465
|
+
NotifyMailer#test_email: processed outbound mail in 0.5ms
|
466
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
467
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
468
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
469
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
470
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
471
|
+
NotifyMailer#test_email: processed outbound mail in 0.4ms
|
@@ -5,19 +5,23 @@ describe GovukNotifyRails::Delivery do
|
|
5
5
|
describe '#deliver!' do
|
6
6
|
let(:api_key) { 'api-key' }
|
7
7
|
let(:notify_client) { double('NotifyClient') }
|
8
|
-
let(:
|
8
|
+
let(:to) { ['email@example.com'] }
|
9
9
|
|
10
|
-
let(:personalisation) { { name: 'John' } }
|
11
10
|
let(:reference) { 'my_reference' }
|
11
|
+
let(:reply_to) { 'email_reply_to_uuid' }
|
12
|
+
let(:unsubscribe_url) { 'https://example.com/unsubscribe?token=123456' }
|
13
|
+
|
14
|
+
let(:personalisation) { { name: 'John' } }
|
12
15
|
|
13
16
|
let(:message) do
|
14
17
|
instance_double(
|
15
18
|
Mail::Message,
|
16
|
-
to:
|
19
|
+
to: to,
|
17
20
|
govuk_notify_template: 'template-123',
|
18
21
|
govuk_notify_reference: reference,
|
19
|
-
|
20
|
-
|
22
|
+
govuk_notify_email_reply_to: reply_to,
|
23
|
+
govuk_notify_one_click_unsubscribe_url: unsubscribe_url,
|
24
|
+
govuk_notify_personalisation: personalisation
|
21
25
|
)
|
22
26
|
end
|
23
27
|
|
@@ -26,6 +30,7 @@ describe GovukNotifyRails::Delivery do
|
|
26
30
|
before(:each) do
|
27
31
|
allow(notify_client).to receive(:new).with(api_key).and_return(notify_client)
|
28
32
|
allow(subject).to receive(:notify_client).and_return(notify_client)
|
33
|
+
allow(message).to receive(:govuk_notify_responses=)
|
29
34
|
allow(message).to receive(:govuk_notify_response=)
|
30
35
|
end
|
31
36
|
|
@@ -35,10 +40,12 @@ describe GovukNotifyRails::Delivery do
|
|
35
40
|
email_address: 'email@example.com',
|
36
41
|
template_id: 'template-123',
|
37
42
|
reference: reference,
|
38
|
-
|
39
|
-
|
43
|
+
email_reply_to_id: reply_to,
|
44
|
+
one_click_unsubscribe_url: unsubscribe_url,
|
45
|
+
personalisation: personalisation
|
40
46
|
}
|
41
47
|
)
|
48
|
+
|
42
49
|
subject.deliver!(message)
|
43
50
|
end
|
44
51
|
|
@@ -48,7 +55,12 @@ describe GovukNotifyRails::Delivery do
|
|
48
55
|
end
|
49
56
|
|
50
57
|
it 'returns the client response' do
|
51
|
-
expect(subject.deliver!(message)).to eq('response')
|
58
|
+
expect(subject.deliver!(message)).to eq(['response'])
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'assigns the client responses for later inspection' do
|
62
|
+
subject.deliver!(message)
|
63
|
+
expect(message).to have_received(:govuk_notify_responses=).with(['response'])
|
52
64
|
end
|
53
65
|
|
54
66
|
it 'assigns the client response for later inspection' do
|
@@ -57,6 +69,37 @@ describe GovukNotifyRails::Delivery do
|
|
57
69
|
end
|
58
70
|
end
|
59
71
|
|
72
|
+
context 'multiple to addresses' do
|
73
|
+
let(:to) { ['email1@example.com', 'email2@example.com'] }
|
74
|
+
|
75
|
+
it 'supports messages without personalisation' do
|
76
|
+
expect(notify_client).to receive(:send_email).with(
|
77
|
+
a_hash_including(email_address: 'email1@example.com')
|
78
|
+
)
|
79
|
+
|
80
|
+
expect(notify_client).to receive(:send_email).with(
|
81
|
+
a_hash_including(email_address: 'email2@example.com')
|
82
|
+
)
|
83
|
+
|
84
|
+
subject.deliver!(message)
|
85
|
+
end
|
86
|
+
|
87
|
+
context 'client response' do
|
88
|
+
before do
|
89
|
+
allow(notify_client).to receive(:send_email).and_return('response1', 'response2')
|
90
|
+
subject.deliver!(message)
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'assigns the client responses for later inspection' do
|
94
|
+
expect(message).to have_received(:govuk_notify_responses=).with(['response1', 'response2'])
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'assigns the first client response for later inspection' do
|
98
|
+
expect(message).to have_received(:govuk_notify_response=).with('response1')
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
60
103
|
context 'no personalisation set' do
|
61
104
|
let(:personalisation) { nil }
|
62
105
|
|
@@ -66,7 +109,8 @@ describe GovukNotifyRails::Delivery do
|
|
66
109
|
email_address: 'email@example.com',
|
67
110
|
template_id: 'template-123',
|
68
111
|
reference: reference,
|
69
|
-
email_reply_to_id:
|
112
|
+
email_reply_to_id: reply_to,
|
113
|
+
one_click_unsubscribe_url: unsubscribe_url
|
70
114
|
}
|
71
115
|
)
|
72
116
|
subject.deliver!(message)
|
@@ -82,7 +126,8 @@ describe GovukNotifyRails::Delivery do
|
|
82
126
|
email_address: 'email@example.com',
|
83
127
|
template_id: 'template-123',
|
84
128
|
personalisation: personalisation,
|
85
|
-
email_reply_to_id:
|
129
|
+
email_reply_to_id: reply_to,
|
130
|
+
one_click_unsubscribe_url: unsubscribe_url
|
86
131
|
}
|
87
132
|
)
|
88
133
|
subject.deliver!(message)
|
@@ -98,7 +143,25 @@ describe GovukNotifyRails::Delivery do
|
|
98
143
|
email_address: 'email@example.com',
|
99
144
|
template_id: 'template-123',
|
100
145
|
personalisation: personalisation,
|
101
|
-
reference: reference
|
146
|
+
reference: reference,
|
147
|
+
one_click_unsubscribe_url: unsubscribe_url
|
148
|
+
}
|
149
|
+
)
|
150
|
+
subject.deliver!(message)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
context 'no unsubscribe url set' do
|
155
|
+
let(:unsubscribe_url) { nil }
|
156
|
+
|
157
|
+
it 'supports messages without unsubscribe url' do
|
158
|
+
expect(notify_client).to receive(:send_email).with(
|
159
|
+
{
|
160
|
+
email_address: 'email@example.com',
|
161
|
+
template_id: 'template-123',
|
162
|
+
reference: reference,
|
163
|
+
email_reply_to_id: reply_to,
|
164
|
+
personalisation: personalisation
|
102
165
|
}
|
103
166
|
)
|
104
167
|
subject.deliver!(message)
|
@@ -5,6 +5,9 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|
5
5
|
describe 'new_message_test_email' do
|
6
6
|
let(:template) { '9661d08a-486d-4c67-865e-ad976f17871d' }
|
7
7
|
let(:reference) { 'my_reference' }
|
8
|
+
let(:reply_to) { '527c131f-ef4b-4b5b-8f9b-3202581af277' }
|
9
|
+
let(:unsubscribe_url) { 'https://example.com/unsubscribe?token=123456' }
|
10
|
+
|
8
11
|
let(:user) { double('User', name: 'Test Name', email: 'test@example.com') }
|
9
12
|
let(:mail) { described_class.test_email(user) }
|
10
13
|
|
@@ -28,6 +31,14 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|
28
31
|
expect(mail.govuk_notify_reference).to eq(reference)
|
29
32
|
end
|
30
33
|
|
34
|
+
it 'sets the reply_to' do
|
35
|
+
expect(mail.govuk_notify_email_reply_to).to eq(reply_to)
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'sets the unsubscribe url' do
|
39
|
+
expect(mail.govuk_notify_one_click_unsubscribe_url).to eq(unsubscribe_url)
|
40
|
+
end
|
41
|
+
|
31
42
|
it 'sets the personalisation' do
|
32
43
|
expect(mail.govuk_notify_personalisation.keys).to eq([:full_name])
|
33
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_notify_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesus Laiz
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '6.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '6.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '2.2'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '2.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 3.0.5
|
97
|
-
description:
|
97
|
+
description:
|
98
98
|
email:
|
99
99
|
- zheileman@users.noreply.github.com
|
100
100
|
executables: []
|
@@ -166,7 +166,7 @@ homepage: https://github.com/ministryofjustice/govuk_notify_rails
|
|
166
166
|
licenses:
|
167
167
|
- MIT
|
168
168
|
metadata: {}
|
169
|
-
post_install_message:
|
169
|
+
post_install_message:
|
170
170
|
rdoc_options: []
|
171
171
|
require_paths:
|
172
172
|
- lib
|
@@ -181,12 +181,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
- !ruby/object:Gem::Version
|
182
182
|
version: '0'
|
183
183
|
requirements: []
|
184
|
-
rubygems_version: 3.
|
185
|
-
signing_key:
|
184
|
+
rubygems_version: 3.4.10
|
185
|
+
signing_key:
|
186
186
|
specification_version: 4
|
187
187
|
summary: Custom ActionMailer delivery method for sending emails via GOV.UK Notify
|
188
188
|
API
|
189
189
|
test_files:
|
190
|
+
- spec/dummy/README.md
|
191
|
+
- spec/dummy/Rakefile
|
190
192
|
- spec/dummy/app/assets/config/manifest.js
|
191
193
|
- spec/dummy/app/assets/javascripts/application.js
|
192
194
|
- spec/dummy/app/assets/javascripts/cable.js
|
@@ -237,8 +239,6 @@ test_files:
|
|
237
239
|
- spec/dummy/public/apple-touch-icon.png
|
238
240
|
- spec/dummy/public/favicon.ico
|
239
241
|
- spec/dummy/public/robots.txt
|
240
|
-
- spec/dummy/Rakefile
|
241
|
-
- spec/dummy/README.md
|
242
242
|
- spec/govuk_notify_delivery/delivery_spec.rb
|
243
243
|
- spec/mailers/notify_mailer_spec.rb
|
244
244
|
- spec/spec_helper.rb
|