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
path = File.join(Rails.root, "config/twilio.yml") | |
TWILIO_CONFIG = YAML.load(File.read(path))[Rails.env] || {'sid' => '', 'from' => '', 'token' => ''} |
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
class UsersController < ApplicationController | |
def new | |
@user = User.new | |
end | |
def create | |
@user = User.new(params[:user]) | |
if @user.save | |
render text: "Thank you! You will receive an SMS shortly with verification instructions." |
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
class VerificationsController < ApplicationController | |
before_filter :get_user | |
def create | |
@user.update_attribute(:verified, true) | |
# You could send another message acknowledging the verificaton | |
head :ok | |
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
{ | |
"AccountSid"=>"<string>", | |
"Body"=>"the message content", | |
"ToZip"=>"<string>", | |
"FromState"=>"<string>", | |
"ToCity"=>"<string>", | |
"SmsSid"=>"<string>", | |
"ToState"=>"<string>", | |
"To"=>"<string>", | |
"ToCountry"=>"<string>", |
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
# Manual install | |
gem install showoff-io | |
# Or via Bundle | |
gem 'showoff-io', group: :development | |
bundle install | |
# Sharing your localhost on port 3000 | |
show 3000 |
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
# Manual install | |
gem install tunnlr_connector | |
# Or via Bundle | |
gem 'tunnlr_connector', group: :development | |
bundle install | |
# Configure for the first time | |
rake tunnlr:configure |
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
group :test do | |
gem 'rr' | |
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
class ActiveSupport::TestCase | |
include RR::Adapters::TestUnit | |
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
require 'test_helper' | |
class UsersControllerTest < ActionController::TestCase | |
test "#new" do | |
get :new | |
assert_response :success | |
assert_template :new | |
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
class MockedTwilioClient | |
def method_missing(*args) | |
self | |
end | |
end |