module StupidSMS::SMS

Public Class Methods

send(client: SMSClient.new, recipient:, body:) click to toggle source
# File lib/stupid_sms/sms.rb, line 3
def self.send(client: SMSClient.new, recipient:, body:)
  from_number = StupidSMS.configuration.from_number
  client.send_message(from: from_number, to: recipient, body: body)
  true
rescue Twilio::REST::RequestError => e # the user has unsubscribed
  puts "[StupidSMS ERROR] Twilio::REST::RequestError to: #{recipient} body: #{body}"
  puts e
  false
end