class SmsSafe::Interceptors::ActionTexter
Interceptor
class for ActionTexter
Gem. Maps ActionTexter::Message into SmsSafe::Message
and back.
Public Instance Methods
Converts an ActionTexter::Message into an SmsSafe::Message
@param [ActionTexter::Message] message that is being sent by ActionTexter
gem @return [Message] the message converted into our own Message
class
# File lib/sms_safe/interceptors/action_texter.rb, line 17 def convert_message(message) SmsSafe::Message.new(from: message.from, to: message.to, text: message.text, original_message: message) end
This method will be called differently for each Texter Gem, it’s the one that the hook likes to call In all cases, it’s a one-liner that calls process_message in the superclass It could even be an alias, for all practical purposes @param [ActionTexter::Message] message that is being sent by ActionTexter
gem @return [ActionTexter::Message] modified message to send, or nil to cancel send
# File lib/sms_safe/interceptors/action_texter.rb, line 10 def delivering_sms(message) self.process_message(message) end
Returns a modified version of the original message with new recipient and text,
to give back to the texter gem to send.
@param [Message] message that is being sent, unmodified @return [ActionTexter::Message] modified message to send
# File lib/sms_safe/interceptors/action_texter.rb, line 27 def redirect(message) original_message = message.original_message original_message.to = redirect_phone_number(message) original_message.text = redirect_text(message) original_message end