Class: Sms::Method::Twilio

Inherits:
Object
  • Object
show all
Defined in:
lib/sms/method/twilio.rb

Overview

POST /2010-04-01/Accounts//SMS/Messages.json with From, To, Body

Instance Method Summary collapse

Constructor Details

#initialize(account_sid, auth_token, default_from = nil) ⇒ Twilio

Returns a new instance of Twilio.



9
10
11
12
13
# File 'lib/sms/method/twilio.rb', line 9

def initialize(, auth_token, default_from = nil)
  @account_sid = 
  @auth_token = auth_token
  @from = default_from
end

Instance Method Details

#deliver!(sms) ⇒ Object

Parameters:



16
17
18
19
# 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