mote_sms 1.3.3 → 1.3.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a9bbf42d15f7f0b5df31da51494a41b983150bb3
4
- data.tar.gz: 46ba38ee95b9372fcc9f983026a73e7d4c65baa2
3
+ metadata.gz: e86ec351273a2ac1c0b5d3357fe2160847583bbd
4
+ data.tar.gz: dc6470925b64bd33c026f8335bbca0661c2fa5e0
5
5
  SHA512:
6
- metadata.gz: 7011c599303d7679dbf8f1e831eb9de6acde334d8983f453da93eca93a8f720c8ff804226e7a41c6327272a4e3d5e672de679b95cf8a6577910b29453c7eca3b
7
- data.tar.gz: ab54555c1684698678ea72e731dd5e62c655293e955ac97859dc3fda9cef48bab495ccd77684623fa4b7f94238230f3222a415574bee2ea2d6d8e1e809d9de0f
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
- mail to: recipient, from: "#{sms.from} <#{recipient}>", subject: subject, body: sms.body
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
@@ -1,3 +1,3 @@
1
1
  module MoteSMS
2
- VERSION = '1.3.3'.freeze
2
+ VERSION = '1.3.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mote_sms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Westermann