mote_sms 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mote_sms/transports/action_mailer_transport.rb +9 -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: e86ec351273a2ac1c0b5d3357fe2160847583bbd
|
4
|
+
data.tar.gz: dc6470925b64bd33c026f8335bbca0661c2fa5e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e8889d19b128540b2df04afee8ac633c6ac04bbef6cae0564b00e438e3864db3e23c73dc548cedf404e201087e1220a626891a6f3ca34e220b139492160faa4
|
7
|
+
data.tar.gz: d23331cc227890fe6c5413496d7f265f483dd07c51b4b077feffa0102e94443ff90c00aadef294c9cdbadc27366bee8902beced1805fcf2a60481fc123791ed9
|
@@ -3,9 +3,10 @@ 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, sms, subject = nil)
|
6
|
+
def forward_sms(recipient, from, sms, subject = nil)
|
7
7
|
subject ||= "SMS to #{sms.to.map(&:to_s).join(', ')}"
|
8
|
-
|
8
|
+
from ||= "#{sms.from} <#{recipient}>"
|
9
|
+
mail to: recipient, from: from, subject: subject, body: sms.body
|
9
10
|
end
|
10
11
|
end
|
11
12
|
|
@@ -23,24 +24,25 @@ module MoteSMS
|
|
23
24
|
#
|
24
25
|
class ActionMailerTransport
|
25
26
|
# Public: Read/change the recipient used when delivering the message.
|
27
|
+
# Read/change the from field used when delivering the message.
|
26
28
|
# Also accepts a Proc.
|
27
|
-
attr_accessor :recipient
|
29
|
+
attr_accessor :recipient, :from
|
28
30
|
|
29
31
|
# Public: Create a new ActionMailerTransport instance
|
30
|
-
def initialize(recipient)
|
32
|
+
def initialize(recipient, from = nil)
|
31
33
|
self.recipient = recipient
|
34
|
+
self.from = from
|
32
35
|
end
|
33
36
|
|
34
37
|
# Public: Sends message using ActionMailer to recipient.
|
35
38
|
#
|
36
39
|
# message - The MoteSMS::Message instance to deliver.
|
37
|
-
# options - The Hash with additional, transport specific options
|
38
|
-
# currently ignored.
|
40
|
+
# options - The Hash with additional, transport specific options.
|
39
41
|
#
|
40
42
|
# Returns nothing.
|
41
43
|
def deliver(message, options = {})
|
42
44
|
to = recipient.respond_to?(:call) ? recipient.call(message) : recipient
|
43
|
-
ActionMailerSMSMailer.forward_sms(to, message, options[:subject].presence).deliver_now
|
45
|
+
ActionMailerSMSMailer.forward_sms(to, from, message, options[:subject].presence).deliver_now
|
44
46
|
|
45
47
|
message.to
|
46
48
|
end
|
data/lib/mote_sms/version.rb
CHANGED