Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c666c20
commit 18df741
Showing
12 changed files
with
97 additions
and
256 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
class ApplicationController < ActionController::Base | ||
protect_from_forgery | ||
before_filter :authenticate | ||
|
||
private | ||
def authenticate | ||
authenticate_or_request_with_http_basic do |username, password| | ||
username == Settings.user.email && password == Settings.user.password | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class HomeController < ApplicationController | ||
def index | ||
@capability_token = Twilio::CapabilityToken.create allow_outgoing: Settings.twilio.app_sid | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module HomeHelper | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
= form_tag('#', id: 'dialler') do | ||
= phone_field_tag 'number' | ||
= submit_tag 'Call', id: 'dial' | ||
= submit_tag 'Hangup', id: 'hangup', style: 'display:none;' | ||
|
||
= content_for :javascript do | ||
:javascript | ||
$(document).ready(function() { | ||
Twilio.Device.setup("#{@capability_token}") | ||
|
||
Twilio.Device.disconnect(function(connection) { | ||
$('#hangup').hide() | ||
$('#dial').show() | ||
}) | ||
|
||
$('#dialler').submit(function(ev) { | ||
ev.stopImmediatePropagation() | ||
ev.preventDefault() | ||
}) | ||
|
||
$('#number').click(function(ev) { | ||
$(this).val(null) | ||
}) | ||
|
||
$('#dial').click(function(ev) { | ||
var number = $('#number').val() | ||
if(number.match(/\+?\d{10,}/)) { | ||
Twilio.Device.connect({ 'phone_number' : number }) | ||
$(this).hide() | ||
$('#hangup').show() | ||
} else { | ||
alert('Please enter a legit phone number.') | ||
} | ||
ev.stopImmediatePropagation() | ||
ev.preventDefault() | ||
}) | ||
|
||
$('#hangup').click(function(ev) { | ||
Twilio.Device.disconnectAll() | ||
ev.stopImmediatePropagation() | ||
ev.preventDefault() | ||
}) | ||
|
||
}) |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
!!! | ||
%html | ||
%head | ||
%title | ||
CheapDate — Call your old lady back home using Twilio's LOW LOW international rates! | ||
= stylesheet_link_tag :all | ||
= javascript_include_tag :defaults | ||
= javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js' | ||
= javascript_include_tag 'http://static.twilio.com/libs/twiliojs/1.0/twilio.min.js' | ||
= csrf_meta_tag | ||
%body | ||
%header | ||
%h1 | ||
= link_to 'CheapDate', root_path | ||
= yield | ||
= yield :javascript | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Twilio::Config.setup do | ||
account_sid Settings.twilio.account_sid | ||
auth_token Settings.twilio.auth_token | ||
end |
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
Oops, something went wrong.