lib/contactable.rb in twilio_contactable-0.7.1 vs lib/contactable.rb in twilio_contactable-0.7.2
- old
+ new
@@ -112,11 +112,11 @@
return true if voice_confirmed?
return false if _TC_phone_number.blank?
confirmation_code = TwilioContactable.generate_confirmation_code
- response = TwilioContactable::Gateway.initiate_voice_call(self, _TC_phone_number)
+ response = TwilioContactable::Gateway.initiate_voice_call(self, _TC_formatted_phone_number)
if response.success?
update_twilio_contactable_voice_confirmation confirmation_code
else
false
@@ -127,42 +127,42 @@
# code. If they match then the current phone number is set
# as confirmed by the user.
def sms_confirm_with(code)
if _TC_sms_confirmation_code.to_s.downcase == code.downcase
# save the phone number into the 'confirmed phone number' attribute
- self._TC_sms_confirmed_phone_number = _TC_phone_number
+ self._TC_sms_confirmed_phone_number = _TC_formatted_phone_number
save
else
false
end
end
# Returns true if the current phone number has been confirmed by
# the user for recieving TXT messages.
def sms_confirmed?
return false if _TC_sms_confirmed_phone_number.blank?
- self._TC_sms_confirmed_phone_number == _TC_phone_number
+ self._TC_sms_confirmed_phone_number == _TC_formatted_phone_number
end
# Compares user-provided code with the stored confirmation
# code. If they match then the current phone number is set
# as confirmed by the user.
def voice_confirm_with(code)
if _TC_voice_confirmation_code.to_s.downcase == code.downcase
# save the phone number into the 'confirmed phone number' attribute
- self._TC_voice_confirmed_phone_number = _TC_phone_number
+ self._TC_voice_confirmed_phone_number = _TC_formatted_phone_number
save
else
false
end
end
# Returns true if the current phone number has been confirmed by
# the user by receiving a phone call
def voice_confirmed?
return false if _TC_voice_confirmed_phone_number.blank?
- self._TC_voice_confirmed_phone_number == _TC_phone_number
+ self._TC_voice_confirmed_phone_number == _TC_formatted_phone_number
end
# Sends one or more TXT messages to the contactable record's
# mobile number (if the number has been confirmed).
# Any messages longer than 160 characters will need to be accompanied
@@ -175,10 +175,10 @@
return false if msg.to_s.strip.blank? || _TC_sms_blocked
return false unless sms_confirmed?
# split into pieces that fit as individual messages.
msg.to_s.scan(/.{1,160}/m).map do |text|
- if TwilioContactable::Gateway.deliver_sms(text, _TC_phone_number).success?
+ if TwilioContactable::Gateway.deliver_sms(text, _TC_formatted_phone_number).success?
text.size
else
false
end
end
\ No newline at end of file