This file contains hidden or 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
namespace :deploy do | |
desc "Deploy to Heroku" | |
task :heroku do | |
Rake::Task["deploy:precompile_assets_and_upload_to_s3"].invoke | |
Rake::Task["deploy:push_heroku"].invoke | |
end | |
desc "Precompile assets and upload to s3" | |
task :precompile_assets_and_upload_to_s3 do | |
storage = Fog::Storage.new :provider => 'AWS', :aws_access_key_id => "123", :aws_secret_access_key => "123" |
This file contains hidden or 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
def twilio_call | |
twilio_client = Twilio::REST::Client.new(TWILIO_CLIENT_ID, TWILIO_CLIENT_SECRET) | |
# Make the call | |
call = twilio_client.account.calls.create( :from => '12018774274', :to => user.mom_phone_number, :url => 'http://hashtagmom.com/handle_call' ) | |
# Store the SID from Twilio for use in later lookups | |
self.twilio_call_id = call.sid | |
save | |
end |
This file contains hidden or 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
def handle_call | |
call_sid = params["CallSid"] | |
checkin = Checkin.find_by_twilio_call_id(call_sid) | |
if checkin | |
response = Twilio::TwiML::Response.new do |r| | |
r.Pause :length => 1 # Found that people like to say "Hello" when they pick up | |
# Separate controller action 'directions' handles your button presses | |
r.Gather :action => directions_path, :numDigits => 1 do |r| |
This file contains hidden or 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
def directions | |
if params["Digits"] == '1' | |
response = Twilio::TwiML::Response.new do |r| | |
r.Record :action => '/handle_recording' | |
end | |
elsif params["Digits"] == '2' | |
# Need to return immediately after a redirect | |
redirect_to :action => 'handle_call' | |
return | |
else |
This file contains hidden or 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
def get_checkins() | |
foursquare_client = get_foursquare_client() | |
foursquare_client.user_checkins[:items].each do |checkin| | |
# Check if checkin already stored for de-dup purposes | |
next if Checkin.find( :first, :conditions => { :checkin_id => checkin.id }) | |
c = Checkin.new(:user => self, :action => action) | |
c.set_checkin_data(checkin) | |
c.save() | |
end | |
end |
This file contains hidden or 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
def foursquare_push | |
# params[:checkin] is a foursquare-provided JSON object | |
checkin_hash = ActiveSupport::JSON.decode(params[:checkin]) | |
# Look up the user based on foursquare ID | |
user = User.find_by_foursquare_id(checkin_hash["user"]["id"]) | |
if user | |
# Create a new checkin, set its parameters from the hash | |
# foursquare sent us. Check for dups |
This file contains hidden or 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 'rubygems' | |
require 'right_aws' | |
require 'yaml' | |
filename = ENV['FILE'].to_s | |
source = ENV['FROM'].to_s | |
destination = ENV['TO'].to_s | |
dry_run = true | |
puts "Please provide filename of s3 configuration" and exit(1) if filename == "" |
This file contains hidden or 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 'rubygems' | |
require 'right_aws' | |
require 'yaml' | |
filename = ENV['FILE'].to_s | |
source = ENV['FROM'].to_s | |
destination = ENV['TO'].to_s | |
dry_run = true | |
puts "Please provide filename of s3 configuration" and exit(1) if filename == "" |
This file contains hidden or 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 'rubygems' | |
require 'right_aws' | |
aws_access_key_id = '' | |
aws_secret_access_key = '' | |
target_bucket = 'bucket_with_data_to_copy' | |
destination_bucket = 'to_copy_into' | |
s3 = RightAws::S3Interface.new(aws_access_key_id, aws_secret_access_key) |
OlderNewer