mail-notify 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{.circleci → .github}/setup-rubygems.sh +4 -1
- data/.github/workflows/publish.yml +25 -0
- data/.github/workflows/ruby.yml +22 -0
- data/CHANGELOG.md +39 -0
- data/README.md +24 -2
- data/lib/mail/notify/delivery_method.rb +8 -2
- data/lib/mail/notify/version.rb +1 -1
- data/mail-notify.gemspec +1 -1
- metadata +15 -7
- data/.circleci/config.yml +0 -70
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73b6476688422e8dc2ec90dbb6283b7a2cf6a1b292a2e2ce8df03f9ade76fa76
|
4
|
+
data.tar.gz: df8844156e93c49667fe199f6f48541e7782e9962a0115988acd84ad6edd7628
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8e6ace1774b896aa6f7b6be2653039da301853c2d8a7381b77abe4cfdd4f0ef6147adbab7d7c32bbba68071d5065ee470f67972b286dbe58e7498f35dda50fa
|
7
|
+
data.tar.gz: d4fdf9308a1610611270403cc285358b377390f0de99bd769ba0a879df2cad9220ecb4e7096792e6d4913d1c3d2752d02c88f2f5a1207984ba3e8cd0ad5f55ee
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: Publish to rubygems
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- "*"
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
runs-on: ubuntu-latest
|
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
|
17
|
+
- name: Setup Rubygems
|
18
|
+
env:
|
19
|
+
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
20
|
+
run: |
|
21
|
+
bash .github/setup-rubygems.sh
|
22
|
+
- name: Publish to Rubygems
|
23
|
+
run: |
|
24
|
+
gem build mail-notify.gemspec
|
25
|
+
gem push "mail-notify-$(git describe --tags).gem"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
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
|
16
|
+
- name: Build and test with Rake
|
17
|
+
run: |
|
18
|
+
sudo apt-get update
|
19
|
+
sudo apt-get install sqlite3 libsqlite3-dev
|
20
|
+
gem install bundler
|
21
|
+
bundle install --jobs 4 --retry 3
|
22
|
+
bundle exec rake
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog]
|
6
|
+
|
7
|
+
## [Unreleased]
|
8
|
+
|
9
|
+
## [0.2.0] - 2019-08-30
|
10
|
+
|
11
|
+
- Add Rails 6 support
|
12
|
+
- Add optional `reply_to_id` and `reference` parameters
|
13
|
+
|
14
|
+
## [0.1.0] - 2019-05-07
|
15
|
+
|
16
|
+
- Add preview functionality
|
17
|
+
|
18
|
+
## [0.0.3] - 2019-02-05
|
19
|
+
|
20
|
+
- Allow response to be accessed
|
21
|
+
|
22
|
+
## [0.0.2] - 2019-02-01
|
23
|
+
|
24
|
+
- Support templated emails
|
25
|
+
- Change API so mailers inherit from our mailer
|
26
|
+
|
27
|
+
## [0.0.1] - 2019-02-01
|
28
|
+
|
29
|
+
- Inital release
|
30
|
+
|
31
|
+
[unreleased]:
|
32
|
+
https://github.com/DFE-Digital/dfe-teachers-payment-service/compare/0.1.0...HEAD
|
33
|
+
[0.2.0]: https://github.com/dxw/mail-notify/compare/0.1.0...0.2.0
|
34
|
+
[0.1.0]: https://github.com/dxw/mail-notify/compare/0.0.3...0.1.0
|
35
|
+
[0.0.3]: https://github.com/dxw/mail-notify/compare/0.0.2...0.0.3
|
36
|
+
[0.0.2]: https://github.com/dxw/mail-notify/compare/0.0.1...0.0.2
|
37
|
+
[0.0.2]: https://github.com/dxw/mail-notify/compare/0.0.1...0.0.2
|
38
|
+
[0.0.1]: https://github.com/dxw/mail-notify/compare/fdc830bbbc29df5998a49bf2920e23d1be6ac5e7...0.0.1
|
39
|
+
[keep a changelog]: https://keepachangelog.com/en/1.0.0/
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![CircleCI Status](https://img.shields.io/circleci/
|
1
|
+
[![CircleCI Status](https://img.shields.io/circleci/build/gh/dxw/mail-notify.svg?style=flat-square)](https://circleci.com/gh/dxw/mail-notify)
|
2
2
|
[![Coverage Status](https://img.shields.io/coveralls/github/pezholio/mail-notify.svg?style=flat-square)](https://coveralls.io/github/pezholio/mail-notify)
|
3
3
|
[![Gem Version](http://img.shields.io/gem/v/mail-notify.svg?style=flat-square)](https://rubygems.org/gems/mail-notify)
|
4
4
|
[![License](http://img.shields.io/:license-mit-blue.svg)](https://mit-license.org/)
|
@@ -54,7 +54,7 @@ Next, in your mailer you'll need to call `view_mail` with the first parameter be
|
|
54
54
|
```ruby
|
55
55
|
class MyMailer < Mail::Notify::Mailer
|
56
56
|
def send_email
|
57
|
-
|
57
|
+
view_mail('YOUR_TEMPLATE_ID_GOES_HERE',
|
58
58
|
to: 'mail@somewhere.com',
|
59
59
|
subject: 'Subject line goes here'
|
60
60
|
)
|
@@ -81,6 +81,28 @@ class MyMailer < Mail::Notify::Mailer
|
|
81
81
|
end
|
82
82
|
```
|
83
83
|
|
84
|
+
#### With optional Notify arguments
|
85
|
+
|
86
|
+
It's possible to pass two optional arguments to Notify:
|
87
|
+
|
88
|
+
- `reply_to_id`: This is an email reply-to address specified by you to receive replies from your users
|
89
|
+
- `reference`: A unique identifier you can create if necessary. This reference identifies a single unique notification or a batch of notifications
|
90
|
+
|
91
|
+
More information can be [found in the docs](https://docs.notifications.service.gov.uk/ruby.html#send-an-email-arguments-personalisation-optional)
|
92
|
+
|
93
|
+
```ruby
|
94
|
+
class MyMailer < Mail::Notify::Mailer
|
95
|
+
def send_email
|
96
|
+
view_mail('YOUR_TEMPLATE_ID_GOES_HERE',
|
97
|
+
to: 'mail@somewhere.com',
|
98
|
+
subject: 'Subject line goes here',
|
99
|
+
reply_to_id: 'YOUR_REPLY_TO_ID_GOES_HERE',
|
100
|
+
reference: 'ABC123XYZ'
|
101
|
+
)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
```
|
105
|
+
|
84
106
|
## Previews
|
85
107
|
|
86
108
|
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.
|
@@ -31,12 +31,18 @@ module Mail
|
|
31
31
|
{
|
32
32
|
email_address: @mail.to.first,
|
33
33
|
template_id: @mail[:template_id].to_s,
|
34
|
-
personalisation: @personalisation.to_h
|
34
|
+
personalisation: @personalisation.to_h,
|
35
|
+
email_reply_to_id: optional_param(:reply_to_id),
|
36
|
+
reference: optional_param(:reference)
|
35
37
|
}
|
36
38
|
end
|
37
39
|
|
40
|
+
def optional_param(name)
|
41
|
+
@mail[name].presence&.to_s
|
42
|
+
end
|
43
|
+
|
38
44
|
def send_email
|
39
|
-
@response = client.send_email(email_params)
|
45
|
+
@response = client.send_email(email_params.compact)
|
40
46
|
end
|
41
47
|
end
|
42
48
|
end
|
data/lib/mail/notify/version.rb
CHANGED
data/mail-notify.gemspec
CHANGED
@@ -32,6 +32,6 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency 'rubocop', '~> 0.63'
|
33
33
|
spec.add_development_dependency 'sqlite3', '~> 1.4.1'
|
34
34
|
|
35
|
-
spec.add_dependency 'actionmailer', '
|
35
|
+
spec.add_dependency 'actionmailer', '>= 5.0', '< 6.1'
|
36
36
|
spec.add_dependency 'notifications-ruby-client', '~> 3.1'
|
37
37
|
end
|
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: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stuart Harrison
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -126,16 +126,22 @@ dependencies:
|
|
126
126
|
name: actionmailer
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '5.0'
|
132
|
+
- - "<"
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '6.1'
|
132
135
|
type: :runtime
|
133
136
|
prerelease: false
|
134
137
|
version_requirements: !ruby/object:Gem::Requirement
|
135
138
|
requirements:
|
136
|
-
- - "
|
139
|
+
- - ">="
|
137
140
|
- !ruby/object:Gem::Version
|
138
141
|
version: '5.0'
|
142
|
+
- - "<"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '6.1'
|
139
145
|
- !ruby/object:Gem::Dependency
|
140
146
|
name: notifications-ruby-client
|
141
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,14 +163,16 @@ executables: []
|
|
157
163
|
extensions: []
|
158
164
|
extra_rdoc_files: []
|
159
165
|
files:
|
160
|
-
- ".circleci/config.yml"
|
161
|
-
- ".circleci/setup-rubygems.sh"
|
162
166
|
- ".coveralls.yml"
|
167
|
+
- ".github/setup-rubygems.sh"
|
168
|
+
- ".github/workflows/publish.yml"
|
169
|
+
- ".github/workflows/ruby.yml"
|
163
170
|
- ".gitignore"
|
164
171
|
- ".rspec"
|
165
172
|
- ".rubocop.yml"
|
166
173
|
- ".ruby-version"
|
167
174
|
- ".travis.yml"
|
175
|
+
- CHANGELOG.md
|
168
176
|
- CODE_OF_CONDUCT.md
|
169
177
|
- Gemfile
|
170
178
|
- LICENSE.txt
|
@@ -201,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
209
|
- !ruby/object:Gem::Version
|
202
210
|
version: '0'
|
203
211
|
requirements: []
|
204
|
-
rubygems_version: 3.0.
|
212
|
+
rubygems_version: 3.0.3
|
205
213
|
signing_key:
|
206
214
|
specification_version: 4
|
207
215
|
summary: ActionMailer support for the GOV.UK Notify API
|
data/.circleci/config.yml
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
# Ruby CircleCI 2.0 configuration file
|
2
|
-
#
|
3
|
-
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
-
#
|
5
|
-
version: 2
|
6
|
-
jobs:
|
7
|
-
build:
|
8
|
-
docker:
|
9
|
-
# specify the version you desire here
|
10
|
-
- image: circleci/ruby:2.6.0-node-browsers
|
11
|
-
|
12
|
-
working_directory: ~/repo
|
13
|
-
|
14
|
-
steps:
|
15
|
-
- checkout
|
16
|
-
|
17
|
-
# Install bundler
|
18
|
-
- run:
|
19
|
-
name: install bundler
|
20
|
-
command: gem install bundler
|
21
|
-
|
22
|
-
# Download and cache dependencies
|
23
|
-
- restore_cache:
|
24
|
-
keys:
|
25
|
-
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
26
|
-
# fallback to using the latest cache if no exact match is found
|
27
|
-
- v1-dependencies-
|
28
|
-
|
29
|
-
- run:
|
30
|
-
name: install dependencies
|
31
|
-
command: |
|
32
|
-
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
33
|
-
|
34
|
-
- save_cache:
|
35
|
-
paths:
|
36
|
-
- ./vendor/bundle
|
37
|
-
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
38
|
-
|
39
|
-
# run tests!
|
40
|
-
- run:
|
41
|
-
name: run tests
|
42
|
-
command: bundle exec rake
|
43
|
-
deploy:
|
44
|
-
docker:
|
45
|
-
- image: circleci/ruby:2.6.0-node-browsers
|
46
|
-
|
47
|
-
working_directory: ~/repo
|
48
|
-
|
49
|
-
steps:
|
50
|
-
- checkout
|
51
|
-
- run:
|
52
|
-
name: Setup Rubygems
|
53
|
-
command: bash .circleci/setup-rubygems.sh
|
54
|
-
|
55
|
-
- run:
|
56
|
-
name: Publish to Rubygems
|
57
|
-
command: |
|
58
|
-
gem build mail-notify.gemspec
|
59
|
-
gem push "mail-notify-$(git describe --tags).gem"
|
60
|
-
workflows:
|
61
|
-
version: 2
|
62
|
-
test-deploy:
|
63
|
-
jobs:
|
64
|
-
- build
|
65
|
-
- deploy:
|
66
|
-
filters:
|
67
|
-
tags:
|
68
|
-
only: /.*/
|
69
|
-
branches:
|
70
|
-
ignore: /.*/
|