class TwilioHelper

Constants

TWILIO_ACCOUNT_SID
TWILIO_AUTH_TOKEN
TWILIO_FROM_NUMBER

Public Class Methods

send_sms(message:, to:) click to toggle source
# File lib/twilio_helper.rb, line 9
def send_sms(message:, to:)
  Rails.logger.info "Sending Twilio message:[#{message}] to [#{to}]"
  msg = client.messages.create(
    from: TWILIO_FROM_NUMBER,
    to: to,
    body: message
  )

  Rails.logger.info("SID: #{msg.sid}")
end

Private Class Methods

client() click to toggle source
# File lib/twilio_helper.rb, line 22
def client
  @client ||= Twilio::REST::Client.new(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
end