hertz-courier-email 1.0.3 → 1.1.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
  SHA1:
3
- metadata.gz: a1b9a8a1d9106c4b9f412d0fc0f8a2ed558c4e91
4
- data.tar.gz: 271c9f674cf0222df82900f6a73c46af93fc3f13
3
+ metadata.gz: '08ef7e4eea8f5d9f83215c0eab906a09eaec33ab'
4
+ data.tar.gz: af9c7f1a665ad74a9168be2dd541e03132b3b141
5
5
  SHA512:
6
- metadata.gz: '066589d31e584cbed0b0669177f80ca00acf301e71b9c8e1557ceafac4d6c2b05ee109ad15394c20f10d64385ae84b0ca9a71b8a0c6c581b8111a731246993e7'
7
- data.tar.gz: b490e121720f2d7b1fc18399e7ac97754189c789bd074abdec610b4aad1fbd6c43ab9ab072ece474809d8c3e2ddf54d6cf876e691911f2c3c19c911fa36d3169
6
+ metadata.gz: 63494ba427e3dbf010dfa55ce995d7ed7ec52871e7090dbb8d77372cd37d3c1f769ded3fc0eef2e23b771079b8ab2a09ed835c87a293334abf10107b6517b191
7
+ data.tar.gz: 72915d4010dfba993c5e076884050935e6783bf984171f13c3fb9626ffb1dc5f26d91ac428c298dab298b0aea342c8442ebc3c7123245031decb2ed3f2919ddf
data/README.md CHANGED
@@ -93,6 +93,19 @@ class CommentNotification < Hertz::Notification
93
93
  end
94
94
  ```
95
95
 
96
+ You may also pass more options to the `#mail` method of the mailer by defining a `#email_options` method:
97
+
98
+ ```ruby
99
+ class CommentNotification < Hertz::Notification
100
+ def email_options
101
+ {
102
+ # generate a custom Reply-To address for the receiver
103
+ reply_to: "replies+#{receiver.id}@example.com"
104
+ }
105
+ end
106
+ end
107
+ ```
108
+
96
109
  Finally, you should create a template for every notification you send by email.
97
110
  For `CommentNotification` you'd create a template at
98
111
  `app/views/hertz/courier/email/notification_mailer/comment_notification.html.erb`:
@@ -5,15 +5,22 @@ module Hertz
5
5
  class NotificationMailer < Hertz::Courier::Email.base_mailer
6
6
  def notification_email(notification)
7
7
  @notification = notification
8
+ mail email_options_for(notification)
9
+ end
10
+
11
+ private
8
12
 
9
- mail(
13
+ def email_options_for(notification)
14
+ options = {
10
15
  to: notification.receiver.hertz_email,
11
16
  subject: notification.email_subject,
12
17
  template_name: view_for(notification)
13
- )
14
- end
18
+ }
15
19
 
16
- private
20
+ options = options.merge(notification.email_options) if notification.respond_to?(:email_options)
21
+
22
+ options
23
+ end
17
24
 
18
25
  def view_for(notification)
19
26
  if notification.respond_to?(:email_template)
@@ -2,7 +2,7 @@
2
2
  module Hertz
3
3
  module Courier
4
4
  module Email
5
- VERSION = '1.0.3'
5
+ VERSION = '1.1.0'
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.3
4
+ version: 1.1.0
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-03-24 00:00:00.000000000 Z
11
+ date: 2017-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails