app/models/voltron/notification/sms_notification.rb in voltron-notify-0.2.0 vs app/models/voltron/notification/sms_notification.rb in voltron-notify-0.2.1

- old
+ new

@@ -4,11 +4,11 @@ include Rails.application.routes.url_helpers has_many :attachments - belongs_to :notification + belongs_to :notification, inverse_of: :sms_notifications after_initialize :setup before_create :send_now, unless: :use_queue? @@ -60,11 +60,11 @@ def valid_phone? begin to_formatted true - rescue => e + rescue ::Twilio::REST::RequestError => e Voltron.log e.message, 'Notify', Voltron::Notify::LOG_COLOR false end end @@ -154,11 +154,11 @@ format from end def format(input) # Try to format the number via Twilio's api - # raises an exception if the input was invalid - number = lookup.phone_numbers.get input + raise ::Twilio::REST::RequestError.new('Phone number cannot be blank') if input.blank? + number = lookup.phone_numbers.get input.to_s number.phone_number end def client @client ||= ::Twilio::REST::Client.new Voltron.config.notify.sms_account_sid, Voltron.config.notify.sms_auth_token