From 7f4d23b5442a1ded67a3e509b3ffc908dfa58548 Mon Sep 17 00:00:00 2001 From: Ralph Rooding Date: Thu, 1 Mar 2012 21:31:58 +0100 Subject: [PATCH] Calling from victim --- Gemfile.lock | 7 +++++++ app/models/victim.rb | 4 ++++ lib/{ringr.rb => callr.rb} | 6 +++--- 3 files changed, 14 insertions(+), 3 deletions(-) rename lib/{ringr.rb => callr.rb} (90%) diff --git a/Gemfile.lock b/Gemfile.lock index 5dd2de4..16c8ac2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -113,6 +113,8 @@ GEM railties (>= 3.2.0, < 5.0) thor (~> 0.14) json (1.6.5) + jwt (0.1.4) + json (>= 1.2.4) launchy (2.0.5) addressable (~> 2.2.6) libv8 (3.3.10.4) @@ -223,6 +225,10 @@ GEM treetop (1.4.10) polyglot polyglot (>= 0.3.1) + twilio-ruby (3.5.1) + builder (>= 2.1.2) + jwt (>= 0.1.2) + multi_json (>= 1.0.3) tzinfo (0.3.31) uglifier (1.2.3) execjs (>= 0.3.0) @@ -267,5 +273,6 @@ DEPENDENCIES shoulda (~> 2.11.3) therubyracer timecop + twilio-ruby uglifier (>= 1.0.3) uuid diff --git a/app/models/victim.rb b/app/models/victim.rb index 11d387b..e350ae4 100644 --- a/app/models/victim.rb +++ b/app/models/victim.rb @@ -11,6 +11,10 @@ def sanitize_mobile_numer self.telephone_number = self.telephone_number.gsub(/[^\d]+/, "") end + def call + Callr.new.call(self.telephone_number, self.name) + end + private def generate_mp3 return unless self.filename.blank? diff --git a/lib/ringr.rb b/lib/callr.rb similarity index 90% rename from lib/ringr.rb rename to lib/callr.rb index 1358117..778df9d 100644 --- a/lib/ringr.rb +++ b/lib/callr.rb @@ -1,6 +1,6 @@ require 'twilio-ruby' -class Ringr +class Callr def initialize account_sid = 'AC94571850a65e4706bb71b21cd9c6831a' auth_token = '0cb6a2e4127d2cdca4c51fcad1dfd925' @@ -15,5 +15,5 @@ def call(number,name) end end -x = Ringr.new -x.call("+31648121608") +#x = Ringr.new +#x.call("+31648121608")