hertz-courier-email 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -7
- data/app/jobs/hertz/courier/email/notification_delivery_job.rb +1 -3
- data/lib/hertz/courier/email.rb +1 -2
- data/lib/hertz/courier/email/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1b9a8a1d9106c4b9f412d0fc0f8a2ed558c4e91
|
4
|
+
data.tar.gz: 271c9f674cf0222df82900f6a73c46af93fc3f13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '066589d31e584cbed0b0669177f80ca00acf301e71b9c8e1557ceafac4d6c2b05ee109ad15394c20f10d64385ae84b0ca9a71b8a0c6c581b8111a731246993e7'
|
7
|
+
data.tar.gz: b490e121720f2d7b1fc18399e7ac97754189c789bd074abdec610b4aad1fbd6c43ab9ab072ece474809d8c3e2ddf54d6cf876e691911f2c3c19c911fa36d3169
|
data/README.md
CHANGED
@@ -33,7 +33,8 @@ Then, run the installer generator:
|
|
33
33
|
$ rails g hertz:courier:email:install
|
34
34
|
```
|
35
35
|
|
36
|
-
You will also need to expose the `hertz_email` method in your receiver class
|
36
|
+
You will also need to expose the `hertz_email` method in your receiver class.
|
37
|
+
This can be either a single email or an array of emails:
|
37
38
|
|
38
39
|
```ruby
|
39
40
|
class User < ActiveRecord::Base
|
@@ -45,10 +46,10 @@ class User < ActiveRecord::Base
|
|
45
46
|
end
|
46
47
|
```
|
47
48
|
|
48
|
-
If `#hertz_email` returns an empty value (i.e. `false`, `nil
|
49
|
-
string) at the time the job is executed, the notification
|
50
|
-
This allows you to programmatically enable/disable
|
51
|
-
user:
|
49
|
+
If `#hertz_email` returns an empty value (i.e. `false`, `nil`, an empty
|
50
|
+
string or an empty array) at the time the job is executed, the notification
|
51
|
+
will not be delivered. This allows you to programmatically enable/disable
|
52
|
+
email notifications for a user:
|
52
53
|
|
53
54
|
```ruby
|
54
55
|
class User
|
@@ -60,10 +61,21 @@ class User
|
|
60
61
|
end
|
61
62
|
```
|
62
63
|
|
64
|
+
Or even to choose what addresses they can receive emails to:
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
class User
|
68
|
+
include Hertz::Notifiable
|
69
|
+
|
70
|
+
def hertz_email
|
71
|
+
emails.select(&:verified?)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
```
|
75
|
+
|
63
76
|
## Usage
|
64
77
|
|
65
|
-
In order to use this courier, add `:email` to `deliver_by` in the notification
|
66
|
-
model(s):
|
78
|
+
In order to use this courier, add `:email` to `deliver_by` in the notification model(s):
|
67
79
|
|
68
80
|
```ruby
|
69
81
|
class CommentNotification < Hertz::Notification
|
@@ -9,9 +9,7 @@ module Hertz
|
|
9
9
|
return unless notification.receiver.hertz_email.present?
|
10
10
|
return if notification.delivered_with?(:email)
|
11
11
|
|
12
|
-
Hertz::Courier::Email::NotificationMailer
|
13
|
-
.notification_email(notification)
|
14
|
-
.deliver_now
|
12
|
+
Hertz::Courier::Email::NotificationMailer.notification_email(notification).deliver_now
|
15
13
|
|
16
14
|
notification.mark_delivered_with(:email)
|
17
15
|
end
|
data/lib/hertz/courier/email.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hertz-courier-email
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Desantis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|