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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ace410bc0d4d02cffc46b368f7ac26ea7c05f23993e0db166cba968825c3788
4
- data.tar.gz: b9ab6323df47db214da68071743b788c092614c053daefa8093995e46b96a0ed
3
+ metadata.gz: 44f7dd73333ea65b1c8a9236d844f967eb6bc6722e9366af0f3d2523f780ed23
4
+ data.tar.gz: 222c35777e71e6467c866d87077e0f32b4a809880699f69197280c40b91874b1
5
5
  SHA512:
6
- metadata.gz: '068fc97838b7ef080a2aab91cdaa369639ebb135c4963e66c6e49bd28f19b69cab489147b05c24f70d4c581dd100f254a4fe0dfb8eb6a8297b2fa01492bc9d09'
7
- data.tar.gz: d0b3ed2a689975105498d757834b594d8bc32228ec451fcc53c4a45732e830c47edb4b327d6dadad4fa2eb8fed063eba0495f5d7662013a83cde5f5d1d414b79
6
+ metadata.gz: 753975de0a326ee5a90a0c9bdb474dba6477d524537e2586e715c53111cc8a64197de39c2c63effe4791fc97fad446025cb50ea8b8eacf1a5a639e95cdc1ed0a
7
+ data.tar.gz: 833ce9dd7096b76ab0fa8ec7057297fb19b31d4df9d849b630804dbad8b57eb02a4c772a97478c732931bc052cf4c18823bae63cb1f123adb547cbce4e4bbd5d
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
+ A flexible notification library supporting the delivery to external services, rendering in various environments, and user configuration by category.
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: 2.0.0
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: 2019-06-04 00:00:00.000000000 Z
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: 2.0.0
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: 2.0.0
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 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
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.2.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.0.3
182
+ rubygems_version: 3.3.7
186
183
  signing_key:
187
184
  specification_version: 4
188
- summary: A pusher to send your notifications via email utilizing ActionMailer
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,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'notification-pusher'
4
- require_relative 'notification_pusher/delivery_method/action_mailer'
@@ -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
@@ -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