mote_sms 1.3.4 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mote_sms/transports/action_mailer_transport.rb +7 -7
- data/lib/mote_sms/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72362b424d8076956877d7ea054c7915476eafb6
|
4
|
+
data.tar.gz: 9e0a1d768e4b2e4bf3023bfb86d0d65443a74103
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c72514b0dfc18d48a14c6bc40727e845ed90ad23d2a13f0c0bf989299b0dd1d715bd4153c1ca64e13dfa374b0e985e7539566cd5af96ca9580f3c3fad4fb54c4
|
7
|
+
data.tar.gz: a35f0a8fd3ccbe65d1b606b57468ba3b0a4eadcdaa8c877bd6c4612445eeeadac5de55df600b5565f4f16575bcb5b9e792b0ac40a30b119052a9f98312f08577
|
@@ -3,10 +3,9 @@ require 'action_mailer'
|
|
3
3
|
module MoteSMS
|
4
4
|
# Internal: ActionMailer class to forward SMS to recipient.
|
5
5
|
class ActionMailerSMSMailer < ::ActionMailer::Base
|
6
|
-
def forward_sms(recipient,
|
6
|
+
def forward_sms(recipient, sms, subject = nil)
|
7
7
|
subject ||= "SMS to #{sms.to.map(&:to_s).join(', ')}"
|
8
|
-
from
|
9
|
-
mail to: recipient, from: from, subject: subject, body: sms.body
|
8
|
+
mail to: recipient, from: "#{sms.from} <#{recipient}>", subject: subject, body: sms.body
|
10
9
|
end
|
11
10
|
end
|
12
11
|
|
@@ -26,12 +25,12 @@ module MoteSMS
|
|
26
25
|
# Public: Read/change the recipient used when delivering the message.
|
27
26
|
# Read/change the from field used when delivering the message.
|
28
27
|
# Also accepts a Proc.
|
29
|
-
attr_accessor :recipient, :
|
28
|
+
attr_accessor :recipient, :default_options
|
30
29
|
|
31
30
|
# Public: Create a new ActionMailerTransport instance
|
32
|
-
def initialize(recipient,
|
31
|
+
def initialize(recipient, default_options = {})
|
33
32
|
self.recipient = recipient
|
34
|
-
self.
|
33
|
+
self.default_options = default_options
|
35
34
|
end
|
36
35
|
|
37
36
|
# Public: Sends message using ActionMailer to recipient.
|
@@ -41,8 +40,9 @@ module MoteSMS
|
|
41
40
|
#
|
42
41
|
# Returns nothing.
|
43
42
|
def deliver(message, options = {})
|
43
|
+
options = options.reverse_merge default_options
|
44
44
|
to = recipient.respond_to?(:call) ? recipient.call(message) : recipient
|
45
|
-
ActionMailerSMSMailer.forward_sms(to,
|
45
|
+
ActionMailerSMSMailer.forward_sms(to, message, options[:subject].presence).deliver_now
|
46
46
|
|
47
47
|
message.to
|
48
48
|
end
|
data/lib/mote_sms/version.rb
CHANGED