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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e86ec351273a2ac1c0b5d3357fe2160847583bbd
4
- data.tar.gz: dc6470925b64bd33c026f8335bbca0661c2fa5e0
3
+ metadata.gz: 72362b424d8076956877d7ea054c7915476eafb6
4
+ data.tar.gz: 9e0a1d768e4b2e4bf3023bfb86d0d65443a74103
5
5
  SHA512:
6
- metadata.gz: 5e8889d19b128540b2df04afee8ac633c6ac04bbef6cae0564b00e438e3864db3e23c73dc548cedf404e201087e1220a626891a6f3ca34e220b139492160faa4
7
- data.tar.gz: d23331cc227890fe6c5413496d7f265f483dd07c51b4b077feffa0102e94443ff90c00aadef294c9cdbadc27366bee8902beced1805fcf2a60481fc123791ed9
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, from, sms, subject = nil)
6
+ def forward_sms(recipient, sms, subject = nil)
7
7
  subject ||= "SMS to #{sms.to.map(&:to_s).join(', ')}"
8
- from ||= "#{sms.from} <#{recipient}>"
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, :from
28
+ attr_accessor :recipient, :default_options
30
29
 
31
30
  # Public: Create a new ActionMailerTransport instance
32
- def initialize(recipient, from = nil)
31
+ def initialize(recipient, default_options = {})
33
32
  self.recipient = recipient
34
- self.from = from
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, from, message, options[:subject].presence).deliver_now
45
+ ActionMailerSMSMailer.forward_sms(to, message, options[:subject].presence).deliver_now
46
46
 
47
47
  message.to
48
48
  end
@@ -1,3 +1,3 @@
1
1
  module MoteSMS
2
- VERSION = '1.3.4'.freeze
2
+ VERSION = '1.3.5'.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.4
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Westermann