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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96ca2326f9ce5a6c1124e2a58d562a6969ebad1ea464940413e638fe5a7b4213
4
- data.tar.gz: e5d02076848631d09ece955616b65a0c167eec463caad492037453a7ebf1cbff
3
+ metadata.gz: 73b6476688422e8dc2ec90dbb6283b7a2cf6a1b292a2e2ce8df03f9ade76fa76
4
+ data.tar.gz: df8844156e93c49667fe199f6f48541e7782e9962a0115988acd84ad6edd7628
5
5
  SHA512:
6
- metadata.gz: '090eed8f5a382930f3b21b359397605710f7e9108d5d9a2f6711e2d48185c93f22267604ced049d68580aa6250efe138f3d442a37af7eca98c84314f5ccf5545'
7
- data.tar.gz: 01152410ad1d43ff204f18e758625466bd773d331cb1bfb7d3ea68d61fd6861d06045db47e4525f8ff4fb733867c9817644889285943caa738d5924b0a41fde8
6
+ metadata.gz: c8e6ace1774b896aa6f7b6be2653039da301853c2d8a7381b77abe4cfdd4f0ef6147adbab7d7c32bbba68071d5065ee470f67972b286dbe58e7498f35dda50fa
7
+ data.tar.gz: d4fdf9308a1610611270403cc285358b377390f0de99bd769ba0a879df2cad9220ecb4e7096792e6d4913d1c3d2752d02c88f2f5a1207984ba3e8cd0ad5f55ee
@@ -1,3 +1,6 @@
1
+ #!/bin/bash
2
+ set -e
3
+
1
4
  mkdir ~/.gem
2
5
  echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
3
- chmod 0600 /home/circleci/.gem/credentials
6
+ chmod 0600 ~/.gem/credentials
@@ -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
@@ -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/project/github/pezholio/mail-notify.svg?style=flat-square)](https://circleci.com/gh/pezholio/mail-notify)
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
- notify_mail('YOUR_TEMPLATE_ID_GOES_HERE',
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Mail
4
4
  module Notify
5
- VERSION = '0.1.0'
5
+ VERSION = '0.2.0'
6
6
  end
7
7
  end
@@ -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', '~> 5.0'
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.1.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-05-07 00:00:00.000000000 Z
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.1
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
@@ -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: /.*/