Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Rest API details to the top #18

Merged
merged 1 commit into from Oct 15, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
126 changes: 63 additions & 63 deletions README.md
Expand Up @@ -16,68 +16,6 @@ $ rake gem
$ gem install pkg/twilio-ruby-{version} $ gem install pkg/twilio-ruby-{version}
``` ```


## Getting Started With Client Capability Tokens

If you just need to generate a Capability Token for use with Twilio Client, you
can do this:

``` ruby
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'twilio-ruby'

# put your own account credentials here:
account_sid = 'AC043dcf9844e13758bc3a36a84c29761'
auth_token = '62ea81de3a5b413254eb263595357c69'

# set up
capability = Twilio::Util::Capability.new account_sid, auth_token

# allow outgoing calls to an application
capability.allow_client_outgoing 'AP89a0180a1a4ddf1da954efca349b7a20'

# allow incoming calls to 'andrew'
capability.allow_client_incoming 'andrew'

# generate the token string
@token = capability.generate
```

There is a slightly more detailed document in the [Capability][capability]
section of the wiki.

## Getting Started With TwiML

TwiML support is based on the [builder][builder] library. You can construct a
TwiML response like this:

``` ruby
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'twilio-ruby'

# build up a response
response = Twilio::TwiML::Response.new do |r|
r.Say 'hello there', :voice => 'woman'
r.Dial :callerId => '+14159992222' do |d|
d.Client 'jenny'
end
end

# print the result
puts response.text
```

This will print the following (except for the whitespace):

```
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="woman">hello there</Say>
<Dial callerId="+14159992222">
<Client>jenny</Client>
</Dial>
</Response>
```

## Getting Started With REST ## Getting Started With REST


### Setup Work ### Setup Work
Expand Down Expand Up @@ -142,6 +80,68 @@ auth_token = '62ea81de3a5b414154eb263595357c69'
@client.account.incoming_phone_numbers.create(:phone_number => @number) @client.account.incoming_phone_numbers.create(:phone_number => @number)
``` ```


## Getting Started With Client Capability Tokens

If you just need to generate a Capability Token for use with Twilio Client, you
can do this:

``` ruby
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'twilio-ruby'

# put your own account credentials here:
account_sid = 'AC043dcf9844e13758bc3a36a84c29761'
auth_token = '62ea81de3a5b413254eb263595357c69'

# set up
capability = Twilio::Util::Capability.new account_sid, auth_token

# allow outgoing calls to an application
capability.allow_client_outgoing 'AP89a0180a1a4ddf1da954efca349b7a20'

# allow incoming calls to 'andrew'
capability.allow_client_incoming 'andrew'

# generate the token string
@token = capability.generate
```

There is a slightly more detailed document in the [Capability][capability]
section of the wiki.

## Getting Started With TwiML

TwiML support is based on the [builder][builder] library. You can construct a
TwiML response like this:

``` ruby
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'twilio-ruby'

# build up a response
response = Twilio::TwiML::Response.new do |r|
r.Say 'hello there', :voice => 'woman'
r.Dial :callerId => '+14159992222' do |d|
d.Client 'jenny'
end
end

# print the result
puts response.text
```

This will print the following (except for the whitespace):

```
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="woman">hello there</Say>
<Dial callerId="+14159992222">
<Client>jenny</Client>
</Dial>
</Response>
```

## More Information ## More Information


There are more detailed examples in the included [examples.rb][examples]. There are more detailed examples in the included [examples.rb][examples].
Expand All @@ -155,4 +155,4 @@ for users of the old twiliolib gem, is available in the
[examples]:https://github.com/twilio/twilio-ruby/blob/master/examples.rb [examples]:https://github.com/twilio/twilio-ruby/blob/master/examples.rb
[documentation]:https://github.com/twilio/twilio-ruby/wiki/Documentation [documentation]:https://github.com/twilio/twilio-ruby/wiki/Documentation
[upgrade]:https://github.com/twilio/twilio-ruby/wiki/UpgradeGuide [upgrade]:https://github.com/twilio/twilio-ruby/wiki/UpgradeGuide
[wiki]:https://github.com/twilio/twilio-ruby/wiki [wiki]:https://github.com/twilio/twilio-ruby/wiki