Created
October 14, 2015 15:41
-
-
Save mehlah/d3c42db5fcf01f3d0936 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'time_diff' | |
require 'twilio-ruby' | |
TWILIO_SID = 'twilio_sid' | |
TWILIO_TOKEN = 'twilio_token' | |
TWILIO_PHONE_NUMBER = '+447903570595' | |
class TwilioApi | |
def client | |
@client ||= Twilio::REST::Client.new(TWILIO_SID, TWILIO_TOKEN) | |
end | |
def send_sms(recipient_phone:, message_body:) | |
client.messages.create( | |
from: TWILIO_PHONE_NUMBER, | |
to: recipient_phone, | |
body: message_body | |
) | |
end | |
end | |
twilio = TwilioApi.new | |
countdown = Time.diff(Time.now, Time.parse('2015-10-21 20:00'), '%d, %h hours and %m minutes') | |
twilio.send_sms(recipient_phone: '+33670031030', message_body: "In #{countdown[:diff]} you'll talk at Web en Vert!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment