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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f40998b239e674599811dc3d0475cece3eaaf409
4
- data.tar.gz: fb0861979e0b54f0ed756aa3786baa5f598a85ef
3
+ metadata.gz: a1b9a8a1d9106c4b9f412d0fc0f8a2ed558c4e91
4
+ data.tar.gz: 271c9f674cf0222df82900f6a73c46af93fc3f13
5
5
  SHA512:
6
- metadata.gz: e8cdacc8ab03f2517e273789cb9c3644ff2b525896ed5a55d86f7bbf8abf8fe32bbc52364c138a822122949a8d6839b9b1c78e64c966c0659bf4b36829ff77fe
7
- data.tar.gz: bb4bde4aaef1f9fd545b4f1847f6a1beb0e694509d9eccb581858e18cd62400365191ae4d80d6beb0fef59374782728dbb040a8664876ac5b0fb81254dbd6a16
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` or an empty
49
- string) at the time the job is executed, the notification will not be delivered.
50
- This allows you to programmatically enable/disable email notifications for a
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
@@ -19,8 +19,7 @@ module Hertz
19
19
  end
20
20
 
21
21
  def deliver_notification(notification)
22
- Hertz::Courier::Email::NotificationDeliveryJob
23
- .perform_later(notification)
22
+ Hertz::Courier::Email::NotificationDeliveryJob.perform_later(notification)
24
23
  end
25
24
  end
26
25
  end
@@ -2,7 +2,7 @@
2
2
  module Hertz
3
3
  module Courier
4
4
  module Email
5
- VERSION = '1.0.2'
5
+ VERSION = '1.0.3'
6
6
  end
7
7
  end
8
8
  end
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.2
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-01-19 00:00:00.000000000 Z
11
+ date: 2017-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails