Qiao was here
678d798b3be4d93c66c2c1583cb26451a1f29241
NICHOLAS WAS HERE
This is a working Rails 4.2 template that you can use as a platform to build applications using Twilio's API via the Twilio gem with Rspec tests. It includes:
- A working PostgreSQL database.
- Full, if minimal, "User CRUD" using BCrypt and sessions.
- The Dotenv gem to manage environmental variables.
- The Twilio gem and a simple example of routes that use it.
- An example for testing Twilio integrations using the SMS Spec gem.
- Fork the project on GitHub.
- Download the application and its gems, and set up the database.
$ git clone git@github.com:<your_github_handle>/mcclane_minihack.git
$ cd mcclane_minihack && bundle install
$ rake db:create && rake db:migrate && rake db:seed
- Sign up for an "API key" from Twilio.
- Add any number you wish to text or call from your Trial Account to the list of verified numbers; you'll need access to the phones to do this.
- Add the "API key" information to your environmental variables:*
$ cd <the_base_of_this_repo>
$ touch .env
$ echo "TWILIO_ACCT_SID=<your_twilio_account_sid>" >> .env
$ echo "TWILIO_AUTH_TOKEN=<your_twilio_auth_token>" >> .env
$ echo "TWILIO_PHONE_NO=<your_twilio_phone_no>" >> .env
- Run your tests:
$ rake db:migrate RAILS_ENV=test && bundle exec rspec
- …, or run Rails!
$ rails s
Good luck! For more examples of using the Twilio gem, see their GitHub page.
* — The "API key" is in fact two numbers: an Account SID and an Auth Token.
(If you do not see them on Twilio's page, look for "Show API Credentials" on
the upper right corner of the page.) These will be globally accessible to
your app in the environmental variables TWILIO_ACCT_SID
and
TWILIO_AUTH_TOKEN
. Also available will be your TWILIO_PHONE_NO
. Make
sure that the phone number is only numbers, without symbols or spaces,
and has no leading 1!
Eg: (440) 543-4041
is bad, but 4405434041
is good.