Skip to content

Instantly share code, notes, and snippets.

@stefanobernardi
Created February 7, 2012 03:11

Revisions

  1. stefanobernardi revised this gist Feb 7, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion app.rb
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    require 'rubygems'
    require 'sinatra' # it's all about you
    # require 'stripe' -> stripe for payments
    require 'twilio-ruby' -> twilio to send sms
    require 'twilio-ruby' #-> twilio to send sms
    # require 'mail' -> with this I can send email

    # return some json stuff
  2. stefanobernardi revised this gist Feb 7, 2012. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion app.rb
    Original file line number Diff line number Diff line change
    @@ -19,4 +19,6 @@
    :to => '+1xxxyyyxxxx',
    :body => params[:from] + " sent: " + params[:body]
    )
    end
    end

    # way more cool stuff over here
  3. stefanobernardi revised this gist Feb 7, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion app.rb
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    require 'rubygems'
    require 'sinatra' # it's all about you
    # require 'stripe' -> stripe for payments
    # require 'twilio-ruby' -> twilio to send sms
    require 'twilio-ruby' -> twilio to send sms
    # require 'mail' -> with this I can send email

    # return some json stuff
  4. stefanobernardi revised this gist Feb 7, 2012. 1 changed file with 12 additions and 4 deletions.
    16 changes: 12 additions & 4 deletions app.rb
    Original file line number Diff line number Diff line change
    @@ -4,11 +4,19 @@
    # require 'twilio-ruby' -> twilio to send sms
    # require 'mail' -> with this I can send email

    # return some json stuff
    get "/" do

    content_type :json

    #I do some pretty cool stuff here.
    content_type :json
    # I do some pretty cool stuff here.
    cool_stuff.to_json
    end

    # receive a post request and send me an sms with the body of the request and the sender's number
    post "/stefano/sms" do
    @client = Twilio::REST::Client.new TWILIOSID, TWILIOTOKEN
    @client.account.sms.messages.create(
    :from => "+1xxxyyyzzzzz",
    :to => '+1xxxyyyxxxx',
    :body => params[:from] + " sent: " + params[:body]
    )
    end
  5. stefanobernardi created this gist Feb 7, 2012.
    14 changes: 14 additions & 0 deletions app.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    require 'rubygems'
    require 'sinatra' # it's all about you
    # require 'stripe' -> stripe for payments
    # require 'twilio-ruby' -> twilio to send sms
    # require 'mail' -> with this I can send email

    get "/" do

    content_type :json

    #I do some pretty cool stuff here.
    cool_stuff.to_json

    end