notification-pusher-actionmailer 3.0.2 → 3.0.3
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 +4 -4
- data/README.md +43 -75
- data/lib/notifications-rails.rb +6 -0
- metadata +9 -13
- 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.rb +0 -38
- data/lib/notification_pusher/delivery_method/action_mailer/engine.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 216fcf578fa6d6f23e905e5b93f4d8f445292774769846f41abed3433305d174
|
4
|
+
data.tar.gz: 1d45e2ad34ab053ef7100a7ad0720d6910a8bfff263ec74f69dc50eb22516ce2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6010c7096d7485ce0959e9c30bb382db9317e94000414bb423999ddf5d824db723a6b65773d2bb32ec20c192782e3f5ccd56e903edfa660f8b89feed3d647570
|
7
|
+
data.tar.gz: 8799c90c313cb7057b62d29564e61f1322e9e2193981edf9206cf77c9c43846b6d776da37cdc4d8ce6fb4382d4b4d3ea1c17651abfb0887d5e1cb41d34dbf520
|
data/README.md
CHANGED
@@ -1,116 +1,84 @@
|
|
1
|
-
#
|
1
|
+
# notifications-rails
|
2
2
|
|
3
|
-
|
3
|
+
notifications-rails is the most powerful notification library for Rails. It offers not only simple APIs to create and render notifications but also supports user-integration and cross-platform delivery of notifications.
|
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: 3.0.
|
4
|
+
version: 3.0.3
|
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: 2020-12-06 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: 3.0.
|
33
|
+
version: 3.0.3
|
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: 3.0.
|
40
|
+
version: 3.0.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: railties
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,19 +150,15 @@ 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
|
@@ -183,8 +179,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
179
|
- !ruby/object:Gem::Version
|
184
180
|
version: '0'
|
185
181
|
requirements: []
|
186
|
-
rubygems_version: 3.
|
182
|
+
rubygems_version: 3.1.4
|
187
183
|
signing_key:
|
188
184
|
specification_version: 4
|
189
|
-
summary: A
|
185
|
+
summary: A delivery method to send your notifications via email using ActionMailer
|
190
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
|