class Sms::Method::Twilio
POST /2010-04-01/Accounts/[AccountSid]/SMS/Messages.json with From, To, Body
Public Class Methods
new(account_sid, auth_token, default_from = nil)
click to toggle source
# File lib/sms/method/twilio.rb, line 9 def initialize(account_sid, auth_token, default_from = nil) @account_sid = account_sid @auth_token = auth_token @from = default_from end
Public Instance Methods
deliver!(sms)
click to toggle source
@param [Sms::Message] sms
# File lib/sms/method/twilio.rb, line 16 def deliver!(sms) from = sms.from || @from client.messages.create(from: from, to: sms.to, body: sms.text) end
Private Instance Methods
client()
click to toggle source
Set up a client to talk to the Twilio
REST API
# File lib/sms/method/twilio.rb, line 23 def client @client ||= ::Twilio::REST::Client.new(@account_sid, @auth_token) end