notification-pusher-actionmailer 3.0.2 → 3.0.3

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: 881a16de155938ff4c21d049f8aa5b48ff5fbd29e08a8cce6aee8ba323dcfacd
4
- data.tar.gz: 3ec3beeee2d7025e6ea04a1d79015c5fedad8cbecc0a7a49ff02b3f0ca9e1253
3
+ metadata.gz: 216fcf578fa6d6f23e905e5b93f4d8f445292774769846f41abed3433305d174
4
+ data.tar.gz: 1d45e2ad34ab053ef7100a7ad0720d6910a8bfff263ec74f69dc50eb22516ce2
5
5
  SHA512:
6
- metadata.gz: bd89e09b0f8fdd9689e1a24ee66d6c91dfad0e6c92c4d3de8dcc571f1b813985decf8f26c424ffa7f9a4f527c168daff00db1129ac626cb175f2e702a821d4d5
7
- data.tar.gz: e3f1b39b7bdb5563b2d099b53815f440bbd36963fdf79a00e6909b0068b45c944487c7f2a411c70180b452571ad8c7caff3af335050353ec8e6db2abf7fa2581
6
+ metadata.gz: 6010c7096d7485ce0959e9c30bb382db9317e94000414bb423999ddf5d824db723a6b65773d2bb32ec20c192782e3f5ccd56e903edfa660f8b89feed3d647570
7
+ data.tar.gz: 8799c90c313cb7057b62d29564e61f1322e9e2193981edf9206cf77c9c43846b6d776da37cdc4d8ce6fb4382d4b4d3ea1c17651abfb0887d5e1cb41d34dbf520
data/README.md CHANGED
@@ -1,116 +1,84 @@
1
- # NotificationPusher for ActionMailer
1
+ # notifications-rails
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/notification-pusher-actionmailer.svg)](https://badge.fury.io/rb/notification-pusher-actionmailer) ![Travis](https://travis-ci.com/jonhue/notifications-rails.svg?branch=master)
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
- A pusher to send your notifications via email utilizing ActionMailer.
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
- ## Table of Contents
9
+ **[notification-handler](notification-handler):** Create and modify your notifications through a simple API.
10
10
 
11
- * [Installation](#installation)
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
- ## Installation
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
- Register this pusher in your `NotificationPusher` configuration:
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
- ```ruby
43
- NotificationPusher.configure do |config|
44
- config.register_delivery_method :email, :ActionMailer
45
- end
46
- ```
19
+ ## Installation
47
20
 
48
- You can pass a `from` parameter, which will be used if you don't provide a `from` address when delivering:
21
+ You can add notifications-rails to your `Gemfile` with:
49
22
 
50
23
  ```ruby
51
- NotificationPusher.configure do |config|
52
- config.register_delivery_method :email, :ActionMailer, from: 'my@email.com'
53
- end
24
+ gem 'notifications-rails'
54
25
  ```
55
26
 
56
- Then add a renderer called `_actionmailer.html.erb` to every notification type you aim to support. Learn more [here](https://github.com/jonhue/notifications-rails/tree/master/notification-renderer).
57
-
58
- Now you can deliver your notifications:
59
-
60
- ```ruby
61
- require 'notification-renderer'
27
+ And then run:
62
28
 
63
- notification = Notification.create(target: User.first, object: Recipe.first)
64
- notification.deliver(:email, to: 'another@email.com')
65
- ```
29
+ $ bundle install
66
30
 
67
- **Note:** If the email address, you want to deliver to, is the same as `notification.target.email` you can omit the `to` parameter.
31
+ Or install it yourself as:
68
32
 
69
- It is also possible to override the email address sending this notification, by passing a `from` parameter.
33
+ $ gem install notifications-rails
70
34
 
71
- If you don't want to use [NotificationRenderer](https://github.com/jonhue/notifications-rails/tree/master/notification-renderer):
35
+ If you always want to be up to date fetch the latest from GitHub in your `Gemfile`:
72
36
 
73
37
  ```ruby
74
- notification = Notification.create(target: User.first, object: Recipe.first)
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
- `MyCustomMailer.deliver_notification` is then called with a `notification` as first argument and an options hash as second argument.
41
+ ## Usage
79
42
 
80
- ### Options
43
+ Details on usage are provided in the [documentation](#philosophy) of the specific modules.
81
44
 
82
- **`to`** Receiver email address. Takes a string.
45
+ ## Development
83
46
 
84
- **`from`** Sender email address. Takes a string.
47
+ To start development you first have to fork this repository and locally clone your fork.
85
48
 
86
- **`renderer`** Specify a renderer. Takes a string. Defaults to `'actionmailer'`.
49
+ Install the projects dependencies by running:
87
50
 
88
- **`layout`** Layout used for template rendering. Takes a string. Defaults to layout specified in `ApplicationMailer`.
51
+ $ bundle install
89
52
 
90
- **`mail_options`** A hash that is passed to `mail` (e.g. including `:subject`). Takes a hash. Defaults to `{}`.
53
+ ### Testing
91
54
 
92
- **`mailer`** ActionMailer class. Takes a constant. Defaults to `NotificationPusher::ActionMailer::NotificationMailer`.
55
+ Tests are written with RSpec. Integration tests are located in `/spec`, unit tests can be found in `<module>/spec`.
93
56
 
94
- **`action`** ActionMailer action. Takes a symbol. Defaults to `:push`.
57
+ To run all tests:
95
58
 
96
- **`deliver_method`** ActionMailer deliver_method (e.g. `:deliver_later`). Takes a symbol. Defaults to `:deliver`.
59
+ $ ./rspec
97
60
 
98
- ---
61
+ To run RuboCop:
99
62
 
100
- ## To Do
63
+ $ bundle exec rubocop
101
64
 
102
- We use [GitHub projects](https://github.com/jonhue/notifications-rails/projects/6) to coordinate the work on this project.
65
+ You can find all commands run by the CI workflow in `.github/workflows/ci.yml`.
103
66
 
104
- To propose your ideas, initiate the discussion by adding a [new issue](https://github.com/jonhue/notifications-rails/issues/new).
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
- ## Contributing
71
+ ## Releases
109
72
 
110
- We hope that you will consider contributing to NotificationPusher for ActionMailer. Please read this short overview for some information about how to get started:
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
- [Learn more about contributing to this repository](https://github.com/jonhue/notifications-rails/blob/master/CONTRIBUTING.md), [Code of Conduct](https://github.com/jonhue/notifications-rails/blob/master/CODE_OF_CONDUCT.md)
75
+ notifications-rails follows Semantic Versioning 2.0 as defined at http://semver.org. Reference our [security policy](SECURITY.md).
113
76
 
114
- ### Semantic Versioning
77
+ ### Publishing
115
78
 
116
- NotificationPusher for ActionMailer follows Semantic Versioning 2.0 as defined at http://semver.org.
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.
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'notification-handler'
4
+ require 'notification-renderer'
5
+ require 'notification-pusher'
6
+ require 'notification-settings'
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.2
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: 2019-10-10 00:00:00.000000000 Z
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.2
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.2
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 pusher to send your notifications via email utilizing ActionMailer.
154
- email: me@jonhue.me
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
- - app/mailers/notification_pusher/action_mailer/notification_mailer.rb
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.0.3
182
+ rubygems_version: 3.1.4
187
183
  signing_key:
188
184
  specification_version: 4
189
- summary: A pusher to send your notifications via email utilizing ActionMailer
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,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'notification-pusher'
4
- require_relative 'notification_pusher/delivery_method/action_mailer'
@@ -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
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rails/engine'
4
- require 'action_mailer'
5
-
6
- module NotificationPusher
7
- class ActionMailer
8
- class Engine < ::Rails::Engine
9
- end
10
- end
11
- end