Skip to content

Instantly share code, notes, and snippets.

View mecampbellsoup's full-sized avatar

Matt Campbell mecampbellsoup

View GitHub Profile
def update
if user.newfangled?
user.update_attributes(name: user_params[:Body])
elsif user.named?
#Twilio::TwiML::Response.new do |r|
#r.Say "Thank you, your PIN has been received."
#end
user.update_attributes(pin: user_params[:Digits])
end
module SMSWallet
class TwimlBuilder
def initialize(user)
@user = user
@response = Twilio::TwiML::Response.new do |r|
r.Gather method: method, action: action, numDigits: 4 do |g|
r.Say message
end
r.Say "We didn't receive any input. Goodbye!"
end
client.calls.create(
to: args[:to],
from: args[:from],
url: args[:url]
)
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather action="http://289c088.ngrok.com/sms_transactions" numDigits="4" timeout="10">
<Say voice="woman">Hello, and welcome to Atlas Card. Please set the 4-digit pin you'd like to use for your account and then press the pound key.</Say>
</Gather>
</Response>
" Press ? for help
.. (up a dir)
/Users/matthewcampbell/Sites/code/atlas-card/SMSWallet/
▸ app/
▸ bin/
▸ config/
▸ db/
▸ lib/
▸ log/
def terms_of_service
end
def update
if user.update_attributes(user_params)
redirect_to trips_path(region: session[:region])
else
render :terms_of_service
end
end
class FlybladeController < ApplicationController
def check_terms_of_service_version
return if request.path == edit_user_path(current_user)
version = Flyblade::TermsOfServicePolicy.current_version
unless current_user.terms_of_service_version == version
return redirect_to edit_user_path(current_user)
end
end
end
module Flyblade
class TermsOfServicePolicy
class << self
def current_version
OperatingPolicy.find_by_title("EULA / Terms of Service").try(:version) || "1.0.0"
end
end
def initialize(user)
@user = user
module Flyblade
class TermsOfServicePolicy
CURRENT_VERSION = current_version
def initialize(user)
@user = user
end
def accepted_current_version?
user.terms_of_service_version == CURRENT_VERSION
var anagram = require('./anagram');
describe('Anagram', function() {
it("no matches",function() {
var subject = anagram("diaper");
var matches = subject.matches([ "hello", "world", "zombies", "pants"]);
expect(matches).toEqual([]);
});