lib/contactable.rb
def send_sms_confirmation!
      return false if _TC_sms_blocked
      return true  if sms_confirmed?
      return false if _TC_phone_number.blank?

      format_phone_number
      confirmation_code = TwilioContactable.confirmation_code(self, :sms)

      # Use this class' confirmation_message method if it
      # exists, otherwise use the generic message
      message = (self.class.respond_to?(:confirmation_message) ?
                   self.class :
                   TwilioContactable).confirmation_message(confirmation_code)

      if message.to_s.size > 160
        raise ArgumentError, "SMS Confirmation Message is too long. Limit it to 160 characters of unescaped text."
      end

      response = TwilioContactable::Gateway.deliver_sms(message, _TC_formatted_phone_number)

      if response.success?
        update_twilio_contactable_sms_confirmation confirmation_code
      end

      response
    end
def send_sms_confirmation!
      return false if _TC_sms_blocked
      return true  if sms_confirmed?
      return false if _TC_phone_number.blank?

      format_phone_number
      confirmation_code = TwilioContactable.confirmation_code(self, :sms)

      # Use this class' confirmation_message method if it
      # exists, otherwise use the generic message
      message = (self.class.respond_to?(:confirmation_message) ?
                   self.class :
                   TwilioContactable).confirmation_message(confirmation_code)

      if message.to_s.size > 160
        raise ArgumentError, "SMS Confirmation Message is too long. Limit it to 160 characters of unescaped text."
      end

      response = TwilioContactable::Gateway.deliver_sms(message, _TC_formatted_phone_number)

      if response.success?
        update_twilio_contactable_sms_confirmation confirmation_code
      end

      response
    end
def send_sms_confirmation! return false if _TC_sms_blocked return true if sms_confirmed? return false if _TC_phone_number . blank? format_phone_number confirmation_code = TwilioContactable . confirmation_code ( self , :sms ) # Use this class' confirmation_message method if it # exists, otherwise use the generic message message = ( self . class . respond_to? ( :confirmation_message ) ? self . class : TwilioContactable ) . confirmation_message ( confirmation_code ) if message . to_s . size > 160 raise ArgumentError , "SMS Confirmation Message is too long. Limit it to 160 characters of unescaped text." end response = TwilioContactable :: Gateway . deliver_sms ( message , _TC_formatted_phone_number ) if response . success? update_twilio_contactable_sms_confirmation confirmation_code end response end
Sends an SMS validation request through the gateway
Sends an SMS validation request through the gateway