sms-pager/app/workers/sms.rb

22 lines
447 B
Ruby
Raw 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
@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