mail-notify 1.0.4 → 1.0.5

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: 83591561892cd304770710a63d5145aad1a86ce819c7b6dfe6f0431b99aeefc8
4
- data.tar.gz: 071a88749849011adb299dd6cc744fcd228f8b8b401665e49cdd8c0ff49c2485
3
+ metadata.gz: 51dc46116d659f7d269b55bed4d05a6389cffb71c0da50e87610e7c491a35927
4
+ data.tar.gz: 853e9293faa4f7e9a913ad53922db154260b616a5fe1485c9e5ee0f65ca8f9f3
5
5
  SHA512:
6
- metadata.gz: 237d6e2670764a16251ffd67aa2bdf25da5c364ca48e0be07270b419dd463dc2341e01413674579387125ca7f8060d4f647c54fd6a2a0e000ee7f8f596a83bd3
7
- data.tar.gz: 75e92f88fc54f3878c97c1ac992f26ad404917203df08b43d6b58b297c9486b262f8e2d5699ae61627e02eeeb266cc53da5350444e1c707f5ceaf958a9af2fe5
6
+ metadata.gz: ddd4d70cd5779b20791014b66987179081070a5b8e5d709da816f4d883e111cf45f5da0235eab06a1ebdd5e8f5092c3269d64fee720e9847d675d49def12dbfa
7
+ data.tar.gz: 851594ef11849f363c241106508f1cb939911ac9cc8fd57fcd88588f0ca72ace91c859fa02b6ddb5297143002956880070164226b305325b1710281ab9561b47
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "bundler"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "daily"
7
+ - package-ecosystem: "github-actions"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "daily"
@@ -1,6 +1,6 @@
1
1
  #!/bin/bash
2
2
  set -e
3
3
 
4
- mkdir ~/.gem
4
+ mkdir -p ~/.gem
5
5
  echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
6
6
  chmod 0600 ~/.gem/credentials
@@ -8,11 +8,9 @@ jobs:
8
8
  runs-on: ubuntu-latest
9
9
 
10
10
  steps:
11
- - uses: actions/checkout@v1
12
- - name: Set up Ruby 2.6
13
- uses: actions/setup-ruby@v1
14
- with:
15
- ruby-version: 2.6.x
11
+ - uses: actions/checkout@v3
12
+ - name: Set up Ruby
13
+ uses: ruby/setup-ruby@v1
16
14
  - name: Set up cache
17
15
  uses: actions/cache@preview
18
16
  with:
@@ -9,11 +9,9 @@ jobs:
9
9
  build:
10
10
  runs-on: ubuntu-latest
11
11
  steps:
12
- - uses: actions/checkout@v1
13
- - name: Set up Ruby 2.6
14
- uses: actions/setup-ruby@v1
15
- with:
16
- ruby-version: 2.6.x
12
+ - uses: actions/checkout@v3
13
+ - name: Set up Ruby
14
+ uses: ruby/setup-ruby@v1
17
15
  - name: Setup Rubygems
18
16
  env:
19
17
  RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.0
1
+ 2.7.6
data/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog]
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.0.5] - 2022-08-31
10
+
11
+ - Allow explicitly blank personalisations (https://github.com/dxw/mail-notify/pull/30)
12
+ - Fix Zeitwerk compatibility issue (https://github.com/dxw/mail-notify/pull/58)
13
+ - Dependency updates
14
+
9
15
  ## [1.0.4] - 2021-01-28
10
16
 
11
17
  - Remove pessimistic constraint on Rails version
@@ -55,6 +61,8 @@ The format is based on [Keep a Changelog]
55
61
  - Initial release
56
62
 
57
63
  [unreleased]: https://github.com/DFE-Digital/dfe-teachers-payment-service/compare/1.0.3...HEAD
64
+ [1.0.5]: https://github.com/dxw/mail-notify/compare/1.0.4...1.0.5
65
+ [1.0.4]: https://github.com/dxw/mail-notify/compare/1.0.3...1.0.4
58
66
  [1.0.3]: https://github.com/dxw/mail-notify/compare/1.0.2...1.0.3
59
67
  [1.0.2]: https://github.com/dxw/mail-notify/compare/1.0.1...1.0.2
60
68
  [1.0.1]: https://github.com/dxw/mail-notify/compare/1.0...1.0.1
data/README.md CHANGED
@@ -91,6 +91,23 @@ class MyMailer < Mail::Notify::Mailer
91
91
  end
92
92
  ```
93
93
 
94
+ By default, any blank personalisation are removed from the request, which will trigger mail template validation. This is to avoid accidental blanks in the email. If you want to send a blank value, you need to explicitly state that the personalization can be blank:
95
+
96
+ ```ruby
97
+ class MyMailer < Mail::Notify::Mailer
98
+ def send_email
99
+ template_mail('YOUR_TEMPLATE_ID_GOES_HERE',
100
+ to: 'mail@somewhere.com',
101
+ personalisation: {
102
+ foo: foo.name, # This will trigger template validation error when blank
103
+ bar: blank_allowed(bar.name) # This will inject empty string in the template when blank
104
+ }
105
+ )
106
+ end
107
+ end
108
+ ```
109
+
110
+
94
111
  #### With optional Notify arguments
95
112
 
96
113
  It's possible to pass two optional arguments to Notify:
@@ -113,13 +130,34 @@ class MyMailer < Mail::Notify::Mailer
113
130
  end
114
131
  ```
115
132
 
133
+ #### With Devise
134
+
135
+ If you're using [Devise](https://github.com/heartcombo/devise), you can overwrite your Devise mailer to use mail-notify for password reset emails etc.
136
+
137
+ In `config/initializers/devise.rb`:
138
+
139
+ ```ruby
140
+ config.mailer = 'DeviseMailer'
141
+ ```
142
+
143
+ in `app/mailers/devise_mailer.rb`:
144
+
145
+ ```ruby
146
+ class DeviseMailer < Devise::Mailer
147
+ def devise_mail(record, action, opts = {}, &block)
148
+ initialize_from_record(record)
149
+ view_mail(ENV['NOTIFY_TEMPLATE_ID'], headers_for(action, opts))
150
+ end
151
+ end
152
+ ```
153
+
116
154
  ## Previews
117
155
 
118
156
  If you're using ActionMailer with Rails, [previews](https://guides.rubyonrails.org/action_mailer_basics.html#previewing-emails) are supported too, and work in the same way as standard previews. Currently they're shown without any branding, but this may change in future.
119
157
 
120
158
  ## Development
121
159
 
122
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
160
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
123
161
 
124
162
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
125
163
 
@@ -14,6 +14,10 @@ module Mail
14
14
 
15
15
  mail(headers.merge(body: "", subject: "", template_id: template_id))
16
16
  end
17
+
18
+ def blank_allowed(value)
19
+ value.presence || Personalisation::BLANK
20
+ end
17
21
  end
18
22
  end
19
23
  end
@@ -3,6 +3,8 @@
3
3
  module Mail
4
4
  module Notify
5
5
  class Personalisation
6
+ BLANK = Object.new
7
+
6
8
  def initialize(mail)
7
9
  @body = mail.body.raw_source
8
10
  @subject = mail.subject
@@ -10,7 +12,9 @@ module Mail
10
12
  end
11
13
 
12
14
  def to_h
13
- merged_options.reject { |_k, v| v.blank? }
15
+ merged_options
16
+ .reject { |_k, v| v.blank? }
17
+ .transform_values { |value| value == BLANK ? "" : value }
14
18
  end
15
19
 
16
20
  private
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Mail
4
4
  module Notify
5
- VERSION = "1.0.4"
5
+ VERSION = "1.0.5"
6
6
  end
7
7
  end
File without changes
data/mail-notify.gemspec CHANGED
@@ -25,18 +25,18 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 2.0"
27
27
  spec.add_development_dependency "coveralls", "~> 0.8.22"
28
- spec.add_development_dependency "pry", "~> 0.12.0"
28
+ spec.add_development_dependency "pry", "~> 0.14.1"
29
29
  spec.add_development_dependency "rails", "~> 6.0"
30
- spec.add_development_dependency "rake", "~> 12.3.3"
31
- spec.add_development_dependency "rspec-rails", "~> 3.8"
30
+ spec.add_development_dependency "rake", "~> 13.0.6"
31
+ spec.add_development_dependency "rspec-rails", "~> 5.1"
32
32
  spec.add_development_dependency "standard", "0.4.7"
33
33
  spec.add_development_dependency "sqlite3", "~> 1.4.1"
34
- spec.add_development_dependency "webmock", "~> 3.7.6"
34
+ spec.add_development_dependency "webmock", "~> 3.16.0"
35
35
 
36
- spec.add_dependency "actionmailer", ">= 5.2.4.3"
37
- spec.add_dependency "activesupport", ">= 5.2.4.3"
38
- spec.add_dependency "actionpack", ">= 5.2.4.3"
39
- spec.add_dependency "actionview", ">= 5.2.4.3"
36
+ spec.add_dependency "actionmailer", ">= 5.2.4.6"
37
+ spec.add_dependency "activesupport", ">= 5.2.4.6"
38
+ spec.add_dependency "actionpack", ">= 5.2.7.1"
39
+ spec.add_dependency "actionview", ">= 5.2.7.1"
40
40
  spec.add_dependency "notifications-ruby-client", "~> 5.1"
41
- spec.add_dependency "rack", ">= 2.1.4"
41
+ spec.add_dependency "rack", ">= 2.1.4.1"
42
42
  end
data/renovate.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": [
4
+ "config:base"
5
+ ]
6
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail-notify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stuart Harrison
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-28 00:00:00.000000000 Z
11
+ date: 2022-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.12.0
47
+ version: 0.14.1
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: 0.12.0
54
+ version: 0.14.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rails
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,28 +72,28 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 12.3.3
75
+ version: 13.0.6
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 12.3.3
82
+ version: 13.0.6
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec-rails
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.8'
89
+ version: '5.1'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '3.8'
96
+ version: '5.1'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: standard
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -128,70 +128,70 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 3.7.6
131
+ version: 3.16.0
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 3.7.6
138
+ version: 3.16.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: actionmailer
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - ">="
144
144
  - !ruby/object:Gem::Version
145
- version: 5.2.4.3
145
+ version: 5.2.4.6
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
- version: 5.2.4.3
152
+ version: 5.2.4.6
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: activesupport
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: 5.2.4.3
159
+ version: 5.2.4.6
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: 5.2.4.3
166
+ version: 5.2.4.6
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: actionpack
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - ">="
172
172
  - !ruby/object:Gem::Version
173
- version: 5.2.4.3
173
+ version: 5.2.7.1
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
- version: 5.2.4.3
180
+ version: 5.2.7.1
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: actionview
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - ">="
186
186
  - !ruby/object:Gem::Version
187
- version: 5.2.4.3
187
+ version: 5.2.7.1
188
188
  type: :runtime
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
- version: 5.2.4.3
194
+ version: 5.2.7.1
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: notifications-ruby-client
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -212,14 +212,14 @@ dependencies:
212
212
  requirements:
213
213
  - - ">="
214
214
  - !ruby/object:Gem::Version
215
- version: 2.1.4
215
+ version: 2.1.4.1
216
216
  type: :runtime
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - ">="
221
221
  - !ruby/object:Gem::Version
222
- version: 2.1.4
222
+ version: 2.1.4.1
223
223
  description:
224
224
  email:
225
225
  - pezholio@gmail.com
@@ -228,6 +228,7 @@ extensions: []
228
228
  extra_rdoc_files: []
229
229
  files:
230
230
  - ".coveralls.yml"
231
+ - ".github/dependabot.yml"
231
232
  - ".github/setup-rubygems.sh"
232
233
  - ".github/workflows/build.yml"
233
234
  - ".github/workflows/publish.yml"
@@ -245,7 +246,6 @@ files:
245
246
  - bin/console
246
247
  - bin/setup
247
248
  - docs/screenshot.png
248
- - lib/mail/notify.rb
249
249
  - lib/mail/notify/delivery_method.rb
250
250
  - lib/mail/notify/layouts/govuk_notify_layout.html.erb
251
251
  - lib/mail/notify/mailer.rb
@@ -254,7 +254,9 @@ files:
254
254
  - lib/mail/notify/personalisation.rb
255
255
  - lib/mail/notify/railtie.rb
256
256
  - lib/mail/notify/version.rb
257
+ - lib/notify.rb
257
258
  - mail-notify.gemspec
259
+ - renovate.json
258
260
  homepage: https://github.com/dxw/mail-notify
259
261
  licenses:
260
262
  - MIT
@@ -274,7 +276,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
276
  - !ruby/object:Gem::Version
275
277
  version: '0'
276
278
  requirements: []
277
- rubygems_version: 3.0.3
279
+ rubygems_version: 3.1.6
278
280
  signing_key:
279
281
  specification_version: 4
280
282
  summary: ActionMailer support for the GOV.UK Notify API