class SmsSender attr_accessor :from attr_accessor :to attr_accessor :message def initialize args_as_hash @from = args_as_hash["from"] ||= ENV["twilio_number"] @to = args_as_hash["to"] @message = args_as_hash["message"] end def send! twilio.messages.create(from: @from, to: @to, body: @message) end private def twilio Twilio::REST::Client.new ENV['twilio_sid'], ENV['twilio_token'] end end