public
Description: Twilio API client
Homepage: http://www.webficient.com
Clone URL: git://github.com/webficient/twilio.git
twilio /
name age message
file .gitignore Wed Jun 03 15:51:18 -0700 2009 Initial commit to twilio. [philm]
file LICENSE Thu Jun 04 04:10:18 -0700 2009 v1 release covers all of Twilio's REST API feat... [philm]
file README.rdoc Sat Nov 28 21:40:49 -0800 2009 added Contributors section [philm]
file Rakefile Thu Sep 03 16:51:30 -0700 2009 Removed rubygems and gem references per recomme... [philm]
file VERSION.yml Sat Nov 28 21:38:08 -0800 2009 Version bump to 2.5.0 [philm]
directory lib/ Sat Nov 28 19:11:16 -0800 2009 redirect REST action [titanous]
directory test/ Sat Nov 28 19:11:16 -0800 2009 redirect REST action [titanous]
file twilio.gemspec Sat Nov 28 21:39:15 -0800 2009 updated gemspec [philm]
README.rdoc

Twilio Gem

The Twilio gem provides two major pieces of functionality: (1) a Ruby wrapper for the Twilio REST API and (2) response handlers based on the Twilio Markup XML (TwiML).

See www.twilio.com/docs/index for Twilio’s API documentation.

For an overview of the Twilio Gem and a sample use case, check out www.webficient.com/2009/06/22/hello-this-is-your-rails-app-calling-you.

Calling the Twilio REST API

First set your credentials by calling the connect method:

  Twilio.connect('my_twilio_sid', 'my_auth_token')

Now call any of the Twilio classes:

  Twilio::Call.make('1234567890', '9876543210', 'http://mysite.com/connected_call')
  Twilio::Recording.list

Responding to Twilio

When Twilio calls your application URL, your response must use the Twilio Markup XML (www.twilio.com/docs/api_reference/TwiML/). The Twilio gem makes this very easy by providing a Twilio Verb class.

For example, in a Ruby on Rails application, you could do the following inside a controller class:

  Twilio::Verb.dial '415-123-4567'

and you can nest multiple verbs inside a block:

  verb = Twilio::Verb.new {
    say "The time is #{Time.now}"
    hangup
  }
  verb.response

Installation

  sudo gem install twilio -s http://gemcutter.org

If you need to tweak the source code, clone this repository and do a rake build and rake install.

Copyright

Copyright © 2009 Phil Misiowiec, Webficient LLC. See LICENSE for details.

Contributors

Jonathan Rudenberg