notification-pusher-actionmailer 2.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +43 -75
- data/lib/notifications-rails.rb +6 -0
- metadata +12 -15
- data/app/mailers/notification_pusher/action_mailer/notification_mailer.rb +0 -23
- data/app/views/notification_pusher/action_mailer/notification_mailer/push.html.erb +0 -1
- data/lib/notification-pusher-actionmailer.rb +0 -4
- data/lib/notification_pusher/delivery_method/action_mailer/engine.rb +0 -11
- data/lib/notification_pusher/delivery_method/action_mailer.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44f7dd73333ea65b1c8a9236d844f967eb6bc6722e9366af0f3d2523f780ed23
|
4
|
+
data.tar.gz: 222c35777e71e6467c866d87077e0f32b4a809880699f69197280c40b91874b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 753975de0a326ee5a90a0c9bdb474dba6477d524537e2586e715c53111cc8a64197de39c2c63effe4791fc97fad446025cb50ea8b8eacf1a5a639e95cdc1ed0a
|
7
|
+
data.tar.gz: 833ce9dd7096b76ab0fa8ec7057297fb19b31d4df9d849b630804dbad8b57eb02a4c772a97478c732931bc052cf4c18823bae63cb1f123adb547cbce4e4bbd5d
|
data/README.md
CHANGED
@@ -1,116 +1,84 @@
|
|
1
|
-
#
|
1
|
+
# notifications-rails
|
2
2
|
|
3
|
-
|
3
|
+
A flexible notification library supporting the delivery to external services, rendering in various environments, and user configuration by category.
|
4
4
|
|
5
|
-
|
5
|
+
## Philosophy
|
6
6
|
|
7
|
-
|
7
|
+
notifications-rails has been built with modularity in mind. It currently consists of four components each of which bringing one essential functionality to the integration of notifications in your Rails app.
|
8
8
|
|
9
|
-
|
9
|
+
**[notification-handler](notification-handler):** Create and modify your notifications through a simple API.
|
10
10
|
|
11
|
-
|
12
|
-
* [Usage](#usage)
|
13
|
-
* [Options](#options)
|
14
|
-
* [To Do](#to-do)
|
15
|
-
* [Contributing](#contributing)
|
16
|
-
* [Semantic versioning](#semantic-versioning)
|
11
|
+
**[notification-renderer](notification-renderer):** Render your notifications in various contexts.
|
17
12
|
|
18
|
-
|
13
|
+
**[notification-pusher](notification-pusher):** Deliver your notifications to various services, including [Email](notification-pusher/notification-pusher-actionmailer) and [OneSignal](notification-pusher/notification-pusher-onesignal).
|
19
14
|
|
20
|
-
|
21
|
-
|
22
|
-
NotificationPusher for ActionMailer works with Rails 5 onwards. You can add it to your `Gemfile` with:
|
23
|
-
|
24
|
-
```ruby
|
25
|
-
gem 'notification-pusher-actionmailer'
|
26
|
-
```
|
27
|
-
|
28
|
-
And then execute:
|
29
|
-
|
30
|
-
$ bundle
|
31
|
-
|
32
|
-
Or install it yourself as:
|
33
|
-
|
34
|
-
$ gem install notification-pusher-actionmailer
|
35
|
-
|
36
|
-
---
|
37
|
-
|
38
|
-
## Usage
|
15
|
+
**[notification-settings](notification-settings):** Integrates with your authentication solution to craft a personalized user notification platform.
|
39
16
|
|
40
|
-
|
17
|
+
You may just use the components you actually need, or instead use this gem to bundle everything for a complete notification solution.
|
41
18
|
|
42
|
-
|
43
|
-
NotificationPusher.configure do |config|
|
44
|
-
config.register_delivery_method :email, :ActionMailer
|
45
|
-
end
|
46
|
-
```
|
19
|
+
## Installation
|
47
20
|
|
48
|
-
You can
|
21
|
+
You can add notifications-rails to your `Gemfile` with:
|
49
22
|
|
50
23
|
```ruby
|
51
|
-
|
52
|
-
config.register_delivery_method :email, :ActionMailer, from: 'my@email.com'
|
53
|
-
end
|
24
|
+
gem 'notifications-rails'
|
54
25
|
```
|
55
26
|
|
56
|
-
|
57
|
-
|
58
|
-
Now you can deliver your notifications:
|
59
|
-
|
60
|
-
```ruby
|
61
|
-
require 'notification-renderer'
|
27
|
+
And then run:
|
62
28
|
|
63
|
-
|
64
|
-
notification.deliver(:email, to: 'another@email.com')
|
65
|
-
```
|
29
|
+
$ bundle install
|
66
30
|
|
67
|
-
|
31
|
+
Or install it yourself as:
|
68
32
|
|
69
|
-
|
33
|
+
$ gem install notifications-rails
|
70
34
|
|
71
|
-
If you
|
35
|
+
If you always want to be up to date fetch the latest from GitHub in your `Gemfile`:
|
72
36
|
|
73
37
|
```ruby
|
74
|
-
|
75
|
-
notification.deliver(:email, to: 'another@email.com', mailer: MyCustomMailer, action: :deliver_notification)
|
38
|
+
gem 'notifications-rails', github: 'jonhue/notifications-rails'
|
76
39
|
```
|
77
40
|
|
78
|
-
|
41
|
+
## Usage
|
79
42
|
|
80
|
-
|
43
|
+
Details on usage are provided in the [documentation](#philosophy) of the specific modules.
|
81
44
|
|
82
|
-
|
45
|
+
## Development
|
83
46
|
|
84
|
-
|
47
|
+
To start development you first have to fork this repository and locally clone your fork.
|
85
48
|
|
86
|
-
|
49
|
+
Install the projects dependencies by running:
|
87
50
|
|
88
|
-
|
51
|
+
$ bundle install
|
89
52
|
|
90
|
-
|
53
|
+
### Testing
|
91
54
|
|
92
|
-
|
55
|
+
Tests are written with RSpec. Integration tests are located in `/spec`, unit tests can be found in `<module>/spec`.
|
93
56
|
|
94
|
-
|
57
|
+
To run all tests:
|
95
58
|
|
96
|
-
|
59
|
+
$ ./rspec
|
97
60
|
|
98
|
-
|
61
|
+
To run RuboCop:
|
99
62
|
|
100
|
-
|
63
|
+
$ bundle exec rubocop
|
101
64
|
|
102
|
-
|
65
|
+
You can find all commands run by the CI workflow in `.github/workflows/ci.yml`.
|
103
66
|
|
104
|
-
|
67
|
+
## Contributing
|
105
68
|
|
106
|
-
|
69
|
+
We warmly welcome everyone who is intersted in contributing. Please reference our [contributing guidelines](CONTRIBUTING.md) and our [Code of Conduct](CODE_OF_CONDUCT.md).
|
107
70
|
|
108
|
-
##
|
71
|
+
## Releases
|
109
72
|
|
110
|
-
|
73
|
+
[Here](https://github.com/jonhue/notifications-rails/releases) you can find details on all past releases. Unreleased breaking changes that are on the current master can be found [here](CHANGELOG.md).
|
111
74
|
|
112
|
-
|
75
|
+
notifications-rails follows Semantic Versioning 2.0 as defined at http://semver.org. Reference our [security policy](SECURITY.md).
|
113
76
|
|
114
|
-
###
|
77
|
+
### Publishing
|
115
78
|
|
116
|
-
|
79
|
+
1. Review breaking changes and deprecations in `CHANGELOG.md`.
|
80
|
+
1. Change the gem version in `VERSION`.
|
81
|
+
1. Reset `CHANGELOG.md`.
|
82
|
+
1. Create a pull request to merge the changes into `master`.
|
83
|
+
1. After the pull request was merged, create a new release listing the breaking changes and commits on `master` since the last release.
|
84
|
+
1. The release workflow will publish the gems to RubyGems.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notification-pusher-actionmailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Hübotter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 4.0.0
|
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: 4.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: railties
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,23 +150,20 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
-
description: A
|
154
|
-
email:
|
153
|
+
description: A delivery method to send your notifications via email using ActionMailer.
|
154
|
+
email: jonas.huebotter@gmail.com
|
155
155
|
executables: []
|
156
156
|
extensions: []
|
157
157
|
extra_rdoc_files: []
|
158
158
|
files:
|
159
159
|
- LICENSE
|
160
160
|
- README.md
|
161
|
-
-
|
162
|
-
- app/views/notification_pusher/action_mailer/notification_mailer/push.html.erb
|
163
|
-
- lib/notification-pusher-actionmailer.rb
|
164
|
-
- lib/notification_pusher/delivery_method/action_mailer.rb
|
165
|
-
- lib/notification_pusher/delivery_method/action_mailer/engine.rb
|
161
|
+
- lib/notifications-rails.rb
|
166
162
|
homepage: https://github.com/jonhue/notifications-rails/tree/master/notification-pusher/notification-pusher-actionmailer
|
167
163
|
licenses:
|
168
164
|
- MIT
|
169
|
-
metadata:
|
165
|
+
metadata:
|
166
|
+
github_repo: ssh://github.com/jonhue/notifications-rails
|
170
167
|
post_install_message:
|
171
168
|
rdoc_options: []
|
172
169
|
require_paths:
|
@@ -175,15 +172,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
175
172
|
requirements:
|
176
173
|
- - ">="
|
177
174
|
- !ruby/object:Gem::Version
|
178
|
-
version: 2.
|
175
|
+
version: '2.7'
|
179
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
177
|
requirements:
|
181
178
|
- - ">="
|
182
179
|
- !ruby/object:Gem::Version
|
183
180
|
version: '0'
|
184
181
|
requirements: []
|
185
|
-
rubygems_version: 3.
|
182
|
+
rubygems_version: 3.3.7
|
186
183
|
signing_key:
|
187
184
|
specification_version: 4
|
188
|
-
summary: A
|
185
|
+
summary: A delivery method to send your notifications via email using ActionMailer
|
189
186
|
test_files: []
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module NotificationPusher
|
4
|
-
class ActionMailer
|
5
|
-
class NotificationMailer < ApplicationMailer
|
6
|
-
# rubocop:disable Metrics/ParameterLists
|
7
|
-
def push(notification,
|
8
|
-
from:, to: nil, renderer: 'actionmailer', layout: nil,
|
9
|
-
mail_options: {})
|
10
|
-
render(layout: layout) unless layout.nil?
|
11
|
-
|
12
|
-
@notification = notification
|
13
|
-
@renderer = renderer
|
14
|
-
|
15
|
-
mail({
|
16
|
-
to: to || notification.target.email,
|
17
|
-
from: from
|
18
|
-
}.merge(mail_options))
|
19
|
-
end
|
20
|
-
# rubocop:enable Metrics/ParameterLists
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= render_notification @notification, @renderer %>
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module NotificationPusher
|
4
|
-
module DeliveryMethod
|
5
|
-
class ActionMailer < NotificationPusher::DeliveryMethod::Base
|
6
|
-
require_relative 'action_mailer/engine'
|
7
|
-
|
8
|
-
DEFAULT_MAILER_ACTION = :push
|
9
|
-
DEFAULT_DELIVER_METHOD = :deliver
|
10
|
-
|
11
|
-
def call
|
12
|
-
mailer_class.send(mailer_action, notification, options)
|
13
|
-
.send(deliver_method)
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def mailer_class
|
19
|
-
return options[:mailer] if options.key?(:mailer)
|
20
|
-
if defined?(NotificationRenderer)
|
21
|
-
return ::NotificationPusher::ActionMailer::NotificationMailer
|
22
|
-
end
|
23
|
-
|
24
|
-
raise(ArgumentError,
|
25
|
-
'You have to pass the :mailer option explicitly or require ' \
|
26
|
-
"'notification-renderer'")
|
27
|
-
end
|
28
|
-
|
29
|
-
def mailer_action
|
30
|
-
options[:action] || DEFAULT_MAILER_ACTION
|
31
|
-
end
|
32
|
-
|
33
|
-
def deliver_method
|
34
|
-
options[:deliver_method] || DEFAULT_DELIVER_METHOD
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|