Skip to content

Instantly share code, notes, and snippets.

@jeanpaulsio
Created April 19, 2017 00:59
Show Gist options
  • Save jeanpaulsio/2044cc0e6259ff8086b1b9ff5f3fb19c to your computer and use it in GitHub Desktop.
Save jeanpaulsio/2044cc0e6259ff8086b1b9ff5f3fb19c to your computer and use it in GitHub Desktop.
class TwilioWrapper
attr_accessor :message, :phone, :from
def initialize
boot_twilio
end
def send_sms
@client.messages.create(
from: ENV['TWILIO_NUMBER'],
to: @phone,
body: "#{@from.upcase} WUPHF'D: " + @message
)
end
private
def boot_twilio
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new account_sid, auth_token
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment