sms-pager/app/workers/sms_sender.rb

22 lines
444 B
Ruby
Raw Permalink Normal View History

2015-09-12 15:37:05 -05:00
class SmsSender
attr_accessor :from
attr_accessor :to
attr_accessor :message
def initialize args_as_hash
2015-09-21 20:40:07 -05:00
@from = args_as_hash[:from] ||= ENV["twilio_number"]
@to = args_as_hash[:to]
@message = args_as_hash[:message]
2015-09-12 15:37:05 -05:00
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