Module: TwilioService
- Extended by:
- TwilioService
- Included in:
- TwilioService
- Defined in:
- lib/templates/twilio/twilio_service.rb
Instance Method Summary collapse
Instance Method Details
#logger ⇒ Object
18 19 20 |
# File 'lib/templates/twilio/twilio_service.rb', line 18 def logger @logger ||= Rails.logger end |
#send_text_message(phone_to, message) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/templates/twilio/twilio_service.rb', line 4 def (phone_to, ) client = Twilio::REST::Client.new client..create( from: ENV['TWILIO_PHONE_FROM'], to: phone_to, body: ) @logger.info { "Sent SMS to #{phone_to}." } rescue Twilio::REST::RequestError => err @logger.error do "ERROR in Twilio call for sending message to number #{phone_to}. Error: #{err.}" end end |