govuk_notify_rails 2.0.0 → 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
- SHA1:
3
- metadata.gz: f18695b6e10853e1315086f370905884654a58a1
4
- data.tar.gz: 7b966ffaec4bb686445c5e4a04805ab56a42baea
2
+ SHA256:
3
+ metadata.gz: abdf654cc620b9c9aa426a4c4ba430b1b184ca520beefa3fba2ce757b3386bb4
4
+ data.tar.gz: 5f5d4218fa5f5666223cde48afc80f270d7147cf3eba98cafe0937cc271cc551
5
5
  SHA512:
6
- metadata.gz: bdf44697db9f0e8d68a27829fe9f049b9f0a6b6d286fd73382945677a03355c6bfcb036d8d91ecbfc98d586847706c49c289a39019f9c2596e6c887dcee9db51
7
- data.tar.gz: 354f76b28d13dc315f7a6c50c82805fa314779e9b42b5586ec9c885991e2289e48e26899fd1754147c7e748fcce90ca2ef666d964bb1b53b6ea3934f5bb7c182
6
+ metadata.gz: 8633e7d482581a0bd074dbe0fd829c07d1ad69bf9076a6bd4653543128601a5839fc2fd1388dea84331b017dba0d2167bc896903a1135fdde13a0a4b6daa138f
7
+ data.tar.gz: 8837528eacad8ec681f1526ff7d9ce24f5097a42b39e503d1e8a9a1a4530eaf3e5c61ae6cd03d4754ff0eb73200f138f1a23d45eb3d2a0d8265aaea23a5c4b6b
@@ -7,7 +7,20 @@ module GovukNotifyRails
7
7
  end
8
8
 
9
9
  def deliver!(message)
10
- notify_client.send_email(payload_for(message))
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
11
24
  end
12
25
 
13
26
  private
@@ -18,10 +31,10 @@ module GovukNotifyRails
18
31
 
19
32
  def payload_for(message)
20
33
  {
21
- email_address: message.to.first,
22
34
  template_id: message.govuk_notify_template,
23
35
  reference: message.govuk_notify_reference,
24
- personalisation: message.govuk_notify_personalisation
36
+ personalisation: message.govuk_notify_personalisation,
37
+ email_reply_to_id: message.govuk_notify_email_reply_to
25
38
  }.compact
26
39
  end
27
40
 
@@ -3,5 +3,8 @@ module Mail
3
3
  attr_accessor :govuk_notify_template
4
4
  attr_accessor :govuk_notify_reference
5
5
  attr_accessor :govuk_notify_personalisation
6
+ attr_accessor :govuk_notify_response
7
+ attr_accessor :govuk_notify_responses
8
+ attr_accessor :govuk_notify_email_reply_to
6
9
  end
7
10
  end
@@ -5,6 +5,7 @@ module GovukNotifyRails
5
5
  attr_accessor :govuk_notify_template
6
6
  attr_accessor :govuk_notify_reference
7
7
  attr_accessor :govuk_notify_personalisation
8
+ attr_accessor :govuk_notify_email_reply_to
8
9
 
9
10
  protected
10
11
 
@@ -17,6 +18,7 @@ module GovukNotifyRails
17
18
  message.govuk_notify_template = govuk_notify_template
18
19
  message.govuk_notify_reference = govuk_notify_reference
19
20
  message.govuk_notify_personalisation = govuk_notify_personalisation
21
+ message.govuk_notify_email_reply_to = govuk_notify_email_reply_to
20
22
  end
21
23
 
22
24
  def set_template(template)
@@ -31,6 +33,10 @@ module GovukNotifyRails
31
33
  self.govuk_notify_personalisation = personalisation
32
34
  end
33
35
 
36
+ def set_email_reply_to(address)
37
+ self.govuk_notify_email_reply_to = address
38
+ end
39
+
34
40
  def _default_body
35
41
  'This is a GOV.UK Notify email with template %s and personalisation: %s' % [govuk_notify_template, govuk_notify_personalisation]
36
42
  end
@@ -1,3 +1,3 @@
1
1
  module GovukNotifyRails
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.2.0'.freeze
3
3
  end
@@ -29,8 +29,6 @@ Rails.application.configure do
29
29
  # Don't care if the mailer can't send.
30
30
  config.action_mailer.raise_delivery_errors = false
31
31
 
32
- config.action_mailer.perform_caching = false
33
-
34
32
  # Print deprecation notices to the Rails logger.
35
33
  config.active_support.deprecation = :log
36
34
 
@@ -47,8 +45,4 @@ Rails.application.configure do
47
45
 
48
46
  # Raises error for missing translations
49
47
  # config.action_view.raise_on_missing_translations = true
50
-
51
- # Use an evented file watcher to asynchronously detect changes in source code,
52
- # routes, locales, etc. This feature depends on the listen gem.
53
- config.file_watcher = ActiveSupport::EventedFileUpdateChecker
54
48
  end
@@ -55,7 +55,6 @@ Rails.application.configure do
55
55
  # Use a real queuing backend for Active Job (and separate queues per environment)
56
56
  # config.active_job.queue_adapter = :resque
57
57
  # config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
58
- config.action_mailer.perform_caching = false
59
58
 
60
59
  # Ignore bad email addresses and do not raise email delivery errors.
61
60
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
@@ -27,7 +27,6 @@ Rails.application.configure do
27
27
 
28
28
  # Disable request forgery protection in test environment.
29
29
  config.action_controller.allow_forgery_protection = false
30
- config.action_mailer.perform_caching = false
31
30
 
32
31
  # Tell Action Mailer not to deliver emails to the real world.
33
32
  # The :test delivery method accumulates sent emails in the
@@ -10,15 +10,8 @@ Rails.application.config.action_controller.per_form_csrf_tokens = true
10
10
  # Enable origin-checking CSRF mitigation. Previous versions had false.
11
11
  Rails.application.config.action_controller.forgery_protection_origin_check = true
12
12
 
13
- # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
14
- # Previous versions had false.
15
- ActiveSupport.to_time_preserves_timezone = true
16
-
17
13
  # Require `belongs_to` associations by default. Previous versions had false.
18
14
  Rails.application.config.active_record.belongs_to_required_by_default = true
19
15
 
20
- # Do not halt callback chains when a callback returns false. Previous versions had true.
21
- ActiveSupport.halt_callback_chains_on_return_false = false
22
-
23
16
  # Configure SSL options to enable HSTS with subdomains. Previous versions had false.
24
17
  Rails.application.config.ssl_options = { hsts: { subdomains: true } }
@@ -37,3 +37,351 @@ NotifyMailer#test_email: processed outbound mail in 0.5ms
37
37
  NotifyMailer#test_email: processed outbound mail in 0.5ms
38
38
  NotifyMailer#test_email: processed outbound mail in 0.4ms
39
39
  NotifyMailer#test_email: processed outbound mail in 0.4ms
40
+ NotifyMailer#test_email: processed outbound mail in 116.8ms
41
+ NotifyMailer#test_email: processed outbound mail in 0.6ms
42
+ NotifyMailer#test_email: processed outbound mail in 0.6ms
43
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
44
+ NotifyMailer#test_email: processed outbound mail in 0.6ms
45
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
46
+ NotifyMailer#test_email: processed outbound mail in 205.7ms
47
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
48
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
49
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
50
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
51
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
52
+
53
+ NotifyMailer#test_email: processed outbound mail in 149.8ms
54
+
55
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
56
+
57
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
58
+
59
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
60
+
61
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
62
+
63
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
64
+
65
+ NotifyMailer#test_email: processed outbound mail in 5.9ms
66
+
67
+ NotifyMailer#test_email: processed outbound mail in 1.7ms
68
+
69
+ NotifyMailer#test_email: processed outbound mail in 1.6ms
70
+
71
+ NotifyMailer#test_email: processed outbound mail in 1.6ms
72
+
73
+ NotifyMailer#test_email: processed outbound mail in 1.7ms
74
+
75
+ NotifyMailer#test_email: processed outbound mail in 1.6ms
76
+ NotifyMailer#test_email: processed outbound mail in 174.3ms
77
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
78
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
79
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
80
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
81
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
82
+ NotifyMailer#test_email: processed outbound mail in 188.2ms
83
+ NotifyMailer#test_email: processed outbound mail in 0.6ms
84
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
85
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
86
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
87
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
88
+ NotifyMailer#test_email: processed outbound mail in 176.9ms
89
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
90
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
91
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
92
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
93
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
94
+ NotifyMailer#test_email: processed outbound mail in 173.6ms
95
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
96
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
97
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
98
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
99
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
100
+ NotifyMailer#test_email: processed outbound mail in 3.7ms
101
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
102
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
103
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
104
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
105
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
106
+ NotifyMailer#test_email: processed outbound mail in 181.2ms
107
+ NotifyMailer#test_email: processed outbound mail in 0.7ms
108
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
109
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
110
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
111
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
112
+ NotifyMailer#test_email: processed outbound mail in 191.2ms
113
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
114
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
115
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
116
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
117
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
118
+ NotifyMailer#test_email: processed outbound mail in 179.9ms
119
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
120
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
121
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
122
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
123
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
124
+ NotifyMailer#test_email: processed outbound mail in 176.7ms
125
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
126
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
127
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
128
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
129
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
130
+ NotifyMailer#test_email: processed outbound mail in 180.3ms
131
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
132
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
133
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
134
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
135
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
136
+ NotifyMailer#test_email: processed outbound mail in 186.9ms
137
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
138
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
139
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
140
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
141
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
142
+ NotifyMailer#test_email: processed outbound mail in 180.3ms
143
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
144
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
145
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
146
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
147
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
148
+ NotifyMailer#test_email: processed outbound mail in 193.3ms
149
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
150
+ NotifyMailer#test_email: processed outbound mail in 0.6ms
151
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
152
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
153
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
154
+ NotifyMailer#test_email: processed outbound mail in 178.5ms
155
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
156
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
157
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
158
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
159
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
160
+ NotifyMailer#test_email: processed outbound mail in 199.4ms
161
+ NotifyMailer#test_email: processed outbound mail in 0.7ms
162
+ NotifyMailer#test_email: processed outbound mail in 0.6ms
163
+ NotifyMailer#test_email: processed outbound mail in 0.6ms
164
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
165
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
166
+ NotifyMailer#test_email: processed outbound mail in 206.7ms
167
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
168
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
169
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
170
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
171
+ NotifyMailer#test_email: processed outbound mail in 0.3ms
172
+ NotifyMailer#test_email: processed outbound mail in 213.9ms
173
+ NotifyMailer#test_email: processed outbound mail in 0.7ms
174
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
175
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
176
+ NotifyMailer#test_email: processed outbound mail in 0.7ms
177
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
178
+ NotifyMailer#test_email: processed outbound mail in 197.3ms
179
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
180
+ NotifyMailer#test_email: processed outbound mail in 0.5ms
181
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
182
+ NotifyMailer#test_email: processed outbound mail in 0.4ms
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
@@ -5,17 +5,20 @@ 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(:reply_to) { "email_reply_to_reference" }
8
9
 
10
+ let(:to) { ['email@example.com'] }
9
11
  let(:personalisation) { { name: 'John' } }
10
12
  let(:reference) { 'my_reference' }
11
13
 
12
14
  let(:message) do
13
15
  instance_double(
14
16
  Mail::Message,
15
- to: ['email@example.com'],
17
+ to: to,
16
18
  govuk_notify_template: 'template-123',
17
19
  govuk_notify_reference: reference,
18
- govuk_notify_personalisation: personalisation
20
+ govuk_notify_personalisation: personalisation,
21
+ govuk_notify_email_reply_to: reply_to
19
22
  )
20
23
  end
21
24
 
@@ -24,21 +27,86 @@ describe GovukNotifyRails::Delivery do
24
27
  before(:each) do
25
28
  allow(notify_client).to receive(:new).with(api_key).and_return(notify_client)
26
29
  allow(subject).to receive(:notify_client).and_return(notify_client)
30
+ allow(message).to receive(:govuk_notify_responses=)
31
+ allow(message).to receive(:govuk_notify_response=)
27
32
  end
28
33
 
29
34
  it 'should deliver the message payload' do
30
35
  expect(notify_client).to receive(:send_email).with(
31
- {email_address: 'email@example.com', template_id: 'template-123', reference: reference, personalisation: personalisation}
36
+ {
37
+ email_address: 'email@example.com',
38
+ template_id: 'template-123',
39
+ reference: reference,
40
+ personalisation: personalisation,
41
+ email_reply_to_id: reply_to
42
+ }
32
43
  )
44
+
33
45
  subject.deliver!(message)
34
46
  end
35
47
 
48
+ context 'client response' do
49
+ before do
50
+ allow(notify_client).to receive(:send_email).and_return('response')
51
+ end
52
+
53
+ it 'returns the client response' do
54
+ expect(subject.deliver!(message)).to eq(['response'])
55
+ end
56
+
57
+ it 'assigns the client responses for later inspection' do
58
+ subject.deliver!(message)
59
+ expect(message).to have_received(:govuk_notify_responses=).with(['response'])
60
+ end
61
+
62
+ it 'assigns the client response for later inspection' do
63
+ subject.deliver!(message)
64
+ expect(message).to have_received(:govuk_notify_response=).with('response')
65
+ end
66
+ end
67
+
68
+ context 'multiple to addresses' do
69
+ let(:to) { ['email1@example.com', 'email2@example.com'] }
70
+
71
+ it 'supports messages without personalisation' do
72
+ expect(notify_client).to receive(:send_email).with(
73
+ a_hash_including(email_address: 'email1@example.com')
74
+ )
75
+
76
+ expect(notify_client).to receive(:send_email).with(
77
+ a_hash_including(email_address: 'email2@example.com')
78
+ )
79
+
80
+ subject.deliver!(message)
81
+ end
82
+
83
+ context 'client response' do
84
+ before do
85
+ allow(notify_client).to receive(:send_email).and_return('response1', 'response2')
86
+ subject.deliver!(message)
87
+ end
88
+
89
+ it 'assigns the client responses for later inspection' do
90
+ expect(message).to have_received(:govuk_notify_responses=).with(['response1', 'response2'])
91
+ end
92
+
93
+ it 'assigns the first client response for later inspection' do
94
+ expect(message).to have_received(:govuk_notify_response=).with('response1')
95
+ end
96
+ end
97
+ end
98
+
36
99
  context 'no personalisation set' do
37
100
  let(:personalisation) { nil }
38
101
 
39
102
  it 'supports messages without personalisation' do
40
103
  expect(notify_client).to receive(:send_email).with(
41
- {email_address: 'email@example.com', template_id: 'template-123', reference: reference}
104
+ {
105
+ email_address: 'email@example.com',
106
+ template_id: 'template-123',
107
+ reference: reference,
108
+ email_reply_to_id: "email_reply_to_reference"
109
+ }
42
110
  )
43
111
  subject.deliver!(message)
44
112
  end
@@ -49,7 +117,28 @@ describe GovukNotifyRails::Delivery do
49
117
 
50
118
  it 'supports messages without a reference' do
51
119
  expect(notify_client).to receive(:send_email).with(
52
- {email_address: 'email@example.com', template_id: 'template-123', personalisation: personalisation}
120
+ {
121
+ email_address: 'email@example.com',
122
+ template_id: 'template-123',
123
+ personalisation: personalisation,
124
+ email_reply_to_id: "email_reply_to_reference"
125
+ }
126
+ )
127
+ subject.deliver!(message)
128
+ end
129
+ end
130
+
131
+ context 'no reply to address set' do
132
+ let(:reply_to) { nil }
133
+
134
+ it 'supports messages without reply to address' do
135
+ expect(notify_client).to receive(:send_email).with(
136
+ {
137
+ email_address: 'email@example.com',
138
+ template_id: 'template-123',
139
+ personalisation: personalisation,
140
+ reference: reference
141
+ }
53
142
  )
54
143
  subject.deliver!(message)
55
144
  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: 2.0.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesus Laiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-24 00:00:00.000000000 Z
11
+ date: 2021-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -28,30 +28,30 @@ dependencies:
28
28
  name: notifications-ruby-client
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.0.0
33
+ version: '5.1'
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: 2.0.0
40
+ version: '5.1'
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: '1.7'
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: '1.7'
54
+ version: '2.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -181,65 +181,64 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  - !ruby/object:Gem::Version
182
182
  version: '0'
183
183
  requirements: []
184
- rubyforge_project:
185
- rubygems_version: 2.5.1
184
+ rubygems_version: 3.0.3
186
185
  signing_key:
187
186
  specification_version: 4
188
187
  summary: Custom ActionMailer delivery method for sending emails via GOV.UK Notify
189
188
  API
190
189
  test_files:
191
- - spec/dummy/app/assets/config/manifest.js
192
- - spec/dummy/app/assets/javascripts/application.js
193
- - spec/dummy/app/assets/javascripts/cable.js
194
- - spec/dummy/app/assets/stylesheets/application.css
195
- - spec/dummy/app/controllers/application_controller.rb
196
- - spec/dummy/app/helpers/application_helper.rb
197
- - spec/dummy/app/jobs/application_job.rb
198
- - spec/dummy/app/mailers/application_mailer.rb
190
+ - spec/spec_helper.rb
199
191
  - spec/dummy/app/mailers/notify_mailer.rb
192
+ - spec/dummy/app/mailers/application_mailer.rb
200
193
  - spec/dummy/app/models/application_record.rb
194
+ - spec/dummy/app/jobs/application_job.rb
195
+ - spec/dummy/app/controllers/application_controller.rb
201
196
  - spec/dummy/app/views/layouts/application.html.erb
202
197
  - spec/dummy/app/views/layouts/mailer.html.erb
203
198
  - spec/dummy/app/views/layouts/mailer.text.erb
204
- - spec/dummy/bin/bundle
205
- - spec/dummy/bin/rails
199
+ - spec/dummy/app/assets/config/manifest.js
200
+ - spec/dummy/app/assets/javascripts/cable.js
201
+ - spec/dummy/app/assets/javascripts/application.js
202
+ - spec/dummy/app/assets/stylesheets/application.css
203
+ - spec/dummy/app/helpers/application_helper.rb
204
+ - spec/dummy/bin/update
206
205
  - spec/dummy/bin/rake
207
206
  - spec/dummy/bin/setup
207
+ - spec/dummy/bin/bundle
208
208
  - spec/dummy/bin/spring
209
- - spec/dummy/bin/update
210
- - spec/dummy/config/application.rb
211
- - spec/dummy/config/boot.rb
212
- - spec/dummy/config/environment.rb
213
- - spec/dummy/config/environments/development.rb
209
+ - spec/dummy/bin/rails
210
+ - spec/dummy/config/secrets.yml
211
+ - spec/dummy/config/routes.rb
212
+ - spec/dummy/config/locales/en.yml
214
213
  - spec/dummy/config/environments/production.rb
214
+ - spec/dummy/config/environments/development.rb
215
215
  - spec/dummy/config/environments/test.rb
216
+ - spec/dummy/config/spring.rb
217
+ - spec/dummy/config/environment.rb
218
+ - spec/dummy/config/application.rb
219
+ - spec/dummy/config/puma.rb
220
+ - spec/dummy/config/boot.rb
216
221
  - spec/dummy/config/initializers/application_controller_renderer.rb
217
- - spec/dummy/config/initializers/assets.rb
218
222
  - spec/dummy/config/initializers/backtrace_silencers.rb
219
- - spec/dummy/config/initializers/cookies_serializer.rb
220
- - spec/dummy/config/initializers/filter_parameter_logging.rb
221
- - spec/dummy/config/initializers/govuk_notify_rails.rb
222
- - spec/dummy/config/initializers/inflections.rb
223
223
  - spec/dummy/config/initializers/mime_types.rb
224
- - spec/dummy/config/initializers/new_framework_defaults.rb
224
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
225
225
  - spec/dummy/config/initializers/session_store.rb
226
226
  - spec/dummy/config/initializers/wrap_parameters.rb
227
- - spec/dummy/config/locales/en.yml
228
- - spec/dummy/config/puma.rb
229
- - spec/dummy/config/routes.rb
230
- - spec/dummy/config/secrets.yml
231
- - spec/dummy/config/spring.rb
227
+ - spec/dummy/config/initializers/new_framework_defaults.rb
228
+ - spec/dummy/config/initializers/assets.rb
229
+ - spec/dummy/config/initializers/cookies_serializer.rb
230
+ - spec/dummy/config/initializers/govuk_notify_rails.rb
231
+ - spec/dummy/config/initializers/inflections.rb
232
232
  - spec/dummy/config.ru
233
- - spec/dummy/log/development.log
234
- - spec/dummy/public/404.html
233
+ - spec/dummy/README.md
234
+ - spec/dummy/Rakefile
235
+ - spec/dummy/public/favicon.ico
235
236
  - spec/dummy/public/422.html
237
+ - spec/dummy/public/apple-touch-icon.png
236
238
  - spec/dummy/public/500.html
239
+ - spec/dummy/public/404.html
237
240
  - spec/dummy/public/apple-touch-icon-precomposed.png
238
- - spec/dummy/public/apple-touch-icon.png
239
- - spec/dummy/public/favicon.ico
240
241
  - spec/dummy/public/robots.txt
241
- - spec/dummy/Rakefile
242
- - spec/dummy/README.md
242
+ - spec/dummy/log/development.log
243
243
  - spec/govuk_notify_delivery/delivery_spec.rb
244
244
  - spec/mailers/notify_mailer_spec.rb
245
- - spec/spec_helper.rb