Skip to content

Instantly share code, notes, and snippets.

@josephdburdick
Created November 15, 2013 22:51
Show Gist options
  • Save josephdburdick/7493061 to your computer and use it in GitHub Desktop.
Save josephdburdick/7493061 to your computer and use it in GitHub Desktop.
Running this returns the following error. Any ideas? /Users/jb/.rvm/gems/ruby-2.0.0-p247/gems/twilio-ruby-3.11.4/lib/twilio-ruby/rest/client.rb:139:in `initialize': undefined method `strip' for nil:NilClass (NoMethodError) from /Users/jb/Sites/code/class/BEWD_NYC_5_Homework/Joe_Burdick/midterm/Anti-Soshe-runner.rb:7:in `new' from /Users/jb/Sites…
class Call
def initialize name="Stranger"
@name = name
@account_sid = ENV["TWILIO_SID"]
@auth_token = ENV["TWILIO_TOKEN"]
@client = Twilio::REST::Client.new(@account_sid, @auth_token)
@account = @client.account
introduce
end
def name
@name
end
def name=(name)
@name = name
end
def makeCall
call = @account.calls.create({
:url => "http://joeylabs.com/projects/twilio/voice.xml",
:from => '+13473345606',
:to => '6466757303'
})
puts call.to
end
def introduce
puts "\nHello #{name}! Welcome to ANTI-SOSHE, your social eject button."
askMinutes
end
def askMinutes
puts "How many minutes from now would you like us to call you so you can excuse yourself?"
@minutes = gets.chomp.to_i
ask
end
def confirmMinutes
confirm = gets.chomp.downcase
if yesArray.include?(confirm)
if @minutes == 1
timeCondition = "a minute"
else
timeCondition = "#{@minutes} minutes."
end
puts "\nOkay, great! We'll schedule your call to occur #{timeCondition}"
queue
elsif noArray.include?(confirm)
askMinutes
else
puts "\n\nWe did not understand your command. Goodbye.\n"
end
end
def queue
sleep @minutes
makeCall
end
def yesArray
@yesArray = ["true", "t", "yes", "yeah", "yep", "ya", "yah", "y", "yea"]
end
def noArray
@noArray = ["false", "f", "no", "naw", "nope", "na", "nah", "n"]
end
def ask
if @minutes == 0
puts "\n\nSorry, we need at least a minute to schedule your call."
askMinutes
elsif @minutes == 1
puts "\n\nSchedule the call in #{@minutes} minute?"
confirmMinutes
else
puts "\n\nSchedule the call in #{@minutes} minutes?"
confirmMinutes
end
end
end
@billsinc
Copy link

billsinc commented Jul 9, 2014

Did you ever find a solution for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment