Skip to content
This repository

Move Rest API details to the top #18

Merged
merged 1 commit into from over 2 years ago

2 participants

Kevin Burke Andrew Benton
Kevin Burke
Owner

I don't have any data, but my guess would be that someone just starting out with Twilio is going to send an SMS or a voice call first, so it makes sense to put the details about how to do that closest to the top of the readme.

The people who need to find out how to do a client capability token are probably a little more familiar/sophisticated with our API.

Andrew Benton andrewmbenton merged commit a86a675 into from October 15, 2011
Andrew Benton andrewmbenton closed this October 15, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Oct 14, 2011
Kevin Burke move rest api details to top 8db543d
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 63 additions and 63 deletions. Show diff stats Hide diff stats

  1. 126  README.md
126  README.md
Source Rendered
@@ -16,68 +16,6 @@ $ rake gem
16 16
 $ gem install pkg/twilio-ruby-{version}
17 17
 ```
18 18
 
19  
-## Getting Started With Client Capability Tokens
20  
-
21  
-If you just need to generate a Capability Token for use with Twilio Client, you
22  
-can do this:
23  
-
24  
-``` ruby
25  
-require 'rubygems' # not necessary with ruby 1.9 but included for completeness
26  
-require 'twilio-ruby'
27  
-
28  
-# put your own account credentials here:
29  
-account_sid = 'AC043dcf9844e13758bc3a36a84c29761'
30  
-auth_token = '62ea81de3a5b413254eb263595357c69'
31  
-
32  
-# set up
33  
-capability = Twilio::Util::Capability.new account_sid, auth_token
34  
-
35  
-# allow outgoing calls to an application
36  
-capability.allow_client_outgoing 'AP89a0180a1a4ddf1da954efca349b7a20'
37  
-
38  
-# allow incoming calls to 'andrew'
39  
-capability.allow_client_incoming 'andrew'
40  
-
41  
-# generate the token string
42  
-@token = capability.generate
43  
-```
44  
-
45  
-There is a slightly more detailed document in the [Capability][capability]
46  
-section of the wiki.
47  
-
48  
-## Getting Started With TwiML
49  
-
50  
-TwiML support is based on the [builder][builder] library. You can construct a
51  
-TwiML response like this:
52  
-
53  
-``` ruby
54  
-require 'rubygems' # not necessary with ruby 1.9 but included for completeness
55  
-require 'twilio-ruby'
56  
-
57  
-# build up a response
58  
-response = Twilio::TwiML::Response.new do |r|
59  
-  r.Say 'hello there', :voice => 'woman'
60  
-  r.Dial :callerId => '+14159992222' do |d|
61  
-    d.Client 'jenny'
62  
-  end
63  
-end
64  
-
65  
-# print the result
66  
-puts response.text
67  
-```
68  
-
69  
-This will print the following (except for the whitespace):
70  
-
71  
-```
72  
-<?xml version="1.0" encoding="UTF-8"?>
73  
-<Response>
74  
-  <Say voice="woman">hello there</Say>
75  
-  <Dial callerId="+14159992222">
76  
-    <Client>jenny</Client>
77  
-  </Dial>
78  
-</Response>
79  
-```
80  
-
81 19
 ## Getting Started With REST
82 20
 
83 21
 ### Setup Work
@@ -142,6 +80,68 @@ auth_token = '62ea81de3a5b414154eb263595357c69'
142 80
 @client.account.incoming_phone_numbers.create(:phone_number => @number)
143 81
 ```
144 82
 
  83
+## Getting Started With Client Capability Tokens
  84
+
  85
+If you just need to generate a Capability Token for use with Twilio Client, you
  86
+can do this:
  87
+
  88
+``` ruby
  89
+require 'rubygems' # not necessary with ruby 1.9 but included for completeness
  90
+require 'twilio-ruby'
  91
+
  92
+# put your own account credentials here:
  93
+account_sid = 'AC043dcf9844e13758bc3a36a84c29761'
  94
+auth_token = '62ea81de3a5b413254eb263595357c69'
  95
+
  96
+# set up
  97
+capability = Twilio::Util::Capability.new account_sid, auth_token
  98
+
  99
+# allow outgoing calls to an application
  100
+capability.allow_client_outgoing 'AP89a0180a1a4ddf1da954efca349b7a20'
  101
+
  102
+# allow incoming calls to 'andrew'
  103
+capability.allow_client_incoming 'andrew'
  104
+
  105
+# generate the token string
  106
+@token = capability.generate
  107
+```
  108
+
  109
+There is a slightly more detailed document in the [Capability][capability]
  110
+section of the wiki.
  111
+
  112
+## Getting Started With TwiML
  113
+
  114
+TwiML support is based on the [builder][builder] library. You can construct a
  115
+TwiML response like this:
  116
+
  117
+``` ruby
  118
+require 'rubygems' # not necessary with ruby 1.9 but included for completeness
  119
+require 'twilio-ruby'
  120
+
  121
+# build up a response
  122
+response = Twilio::TwiML::Response.new do |r|
  123
+  r.Say 'hello there', :voice => 'woman'
  124
+  r.Dial :callerId => '+14159992222' do |d|
  125
+    d.Client 'jenny'
  126
+  end
  127
+end
  128
+
  129
+# print the result
  130
+puts response.text
  131
+```
  132
+
  133
+This will print the following (except for the whitespace):
  134
+
  135
+```
  136
+<?xml version="1.0" encoding="UTF-8"?>
  137
+<Response>
  138
+  <Say voice="woman">hello there</Say>
  139
+  <Dial callerId="+14159992222">
  140
+    <Client>jenny</Client>
  141
+  </Dial>
  142
+</Response>
  143
+```
  144
+
145 145
 ## More Information
146 146
 
147 147
 There are more detailed examples in the included [examples.rb][examples].
@@ -155,4 +155,4 @@ for users of the old twiliolib gem, is available in the
155 155
 [examples]:https://github.com/twilio/twilio-ruby/blob/master/examples.rb
156 156
 [documentation]:https://github.com/twilio/twilio-ruby/wiki/Documentation
157 157
 [upgrade]:https://github.com/twilio/twilio-ruby/wiki/UpgradeGuide
158  
-[wiki]:https://github.com/twilio/twilio-ruby/wiki
  158
+[wiki]:https://github.com/twilio/twilio-ruby/wiki
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.