twilio-ruby 3.11.5 → 3.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +13 -5
- data/.gitignore +1 -1
- data/.travis.yml +20 -8
- data/AUTHORS.md +29 -25
- data/{CHANGES → CHANGES.md} +45 -1
- data/Gemfile +8 -1
- data/{LICENSE → LICENSE.md} +1 -1
- data/Makefile +1 -2
- data/README.md +57 -26
- data/Rakefile +8 -10
- data/docs/getting-started.rst +3 -3
- data/docs/usage/applications.rst +5 -5
- data/docs/usage/basics.rst +17 -4
- data/docs/usage/caller-ids.rst +2 -2
- data/docs/usage/conferences.rst +5 -5
- data/docs/usage/errors.rst +1 -1
- data/docs/usage/messages.rst +6 -6
- data/docs/usage/notifications.rst +2 -2
- data/docs/usage/phone-calls.rst +7 -7
- data/docs/usage/phone-numbers.rst +12 -12
- data/docs/usage/queues.rst +6 -6
- data/docs/usage/recordings.rst +5 -5
- data/docs/usage/sip.rst +5 -5
- data/docs/usage/token-generation.rst +18 -3
- data/docs/usage/transcriptions.rst +1 -1
- data/docs/usage/twiml.rst +1 -1
- data/docs/usage/validation.rst +27 -1
- data/examples/print-call-log.rb +1 -1
- data/lib/rack/twilio_webhook_authentication.rb +40 -0
- data/lib/twilio-ruby/rest/call_feedback.rb +28 -0
- data/lib/twilio-ruby/rest/call_feedback_summary.rb +13 -0
- data/lib/twilio-ruby/rest/calls.rb +6 -1
- data/lib/twilio-ruby/rest/client.rb +43 -5
- data/lib/twilio-ruby/rest/list_resource.rb +10 -4
- data/lib/twilio-ruby/rest/usage/records.rb +2 -2
- data/lib/twilio-ruby/twiml/response.rb +1 -0
- data/lib/twilio-ruby/util/capability.rb +6 -3
- data/lib/twilio-ruby/util/configuration.rb +7 -0
- data/lib/twilio-ruby/util/request_validator.rb +3 -2
- data/lib/twilio-ruby/version.rb +1 -1
- data/lib/twilio-ruby.rb +25 -0
- data/spec/rack/twilio_webhook_authentication_spec.rb +76 -0
- data/spec/rest/account_spec.rb +20 -20
- data/spec/rest/call_feedback_spec.rb +12 -0
- data/spec/rest/call_feedback_summary_spec.rb +9 -0
- data/spec/rest/call_spec.rb +4 -4
- data/spec/rest/client_spec.rb +114 -38
- data/spec/rest/conference_spec.rb +2 -2
- data/spec/rest/instance_resource_spec.rb +3 -3
- data/spec/rest/message_spec.rb +2 -2
- data/spec/rest/numbers_spec.rb +12 -12
- data/spec/rest/queue_spec.rb +2 -2
- data/spec/rest/recording_spec.rb +2 -2
- data/spec/spec_helper.rb +12 -3
- data/spec/support/fakeweb.rb +2 -0
- data/spec/twilio_spec.rb +15 -0
- data/spec/util/capability_spec.rb +167 -118
- data/spec/util/configuration_spec.rb +13 -0
- data/spec/util/request_validator_spec.rb +31 -3
- data/spec/util/url_encode_spec.rb +1 -1
- data/twilio-ruby.gemspec +28 -27
- metadata +46 -71
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YTAxY2JmOWY5NjY3MTMyNTA1ZTVhMWE1NmMyZmIxYzI3NjNhYWVlYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NTQwYTVkMDFhMGUzNzAyMzE0NGQyN2U2YmJiMWQ5ZmE2NzZkZjVmNg==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZjY4MTY2ZmRlY2M0YzJhMzA3OTMxMTBlZmEwZjlkNzgxNWJmMTRiODQ4NDRh
|
10
|
+
OWUxYjEwOWQ5MDczNGI3MTEwZGM3ZmZkNWM5YzU1ZjNiY2NjZGI0ZTIwZTBl
|
11
|
+
N2JiOGQ1YTE5YTE0MDNkYWVjMjI3ZDRhMmQ3YzJhMmFiZGZlZDg=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YTA2ZWZhZDdiZDRiOWYwY2MxOThjM2RlNDkyMzZjOWUyNWI0ZjI5ZTQ3Mjc3
|
14
|
+
NjAxOWNjMjFlNmVhMWE3OGM5YzExNTJjNWNmNGUzMDFlMGZlYTRjMTk3MGZk
|
15
|
+
MDNlYTUxYzkwNDRiMWVjNDY1YjY3OGVlZjU5NDAwMWMxN2YwNTU=
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,13 +1,25 @@
|
|
1
1
|
language: ruby
|
2
|
-
|
2
|
+
cache: bundler
|
3
|
+
bundler_args: --without development
|
3
4
|
rvm:
|
4
|
-
-
|
5
|
-
-
|
6
|
-
- 1.9.3
|
7
|
-
- 2.0.0
|
5
|
+
- ruby-head
|
6
|
+
- ruby
|
8
7
|
- 2.1.0
|
9
|
-
-
|
8
|
+
- 2.0.0
|
9
|
+
- 1.9.3
|
10
|
+
- 1.8.7
|
11
|
+
- jruby-head
|
12
|
+
- jruby
|
10
13
|
- jruby-19mode
|
11
|
-
-
|
12
|
-
- rbx-
|
14
|
+
- jruby-18mode
|
15
|
+
- rbx-head
|
16
|
+
- rbx-2
|
13
17
|
- ree
|
18
|
+
matrix:
|
19
|
+
fast_finish: true
|
20
|
+
allow_failures:
|
21
|
+
- rvm: ruby-head
|
22
|
+
- rvm: ruby
|
23
|
+
- rvm: jruby-head
|
24
|
+
- rvm: jruby
|
25
|
+
- rvm: rbx-head
|
data/AUTHORS.md
CHANGED
@@ -4,28 +4,32 @@ Authors
|
|
4
4
|
A huge thanks to all of our contributors:
|
5
5
|
|
6
6
|
|
7
|
-
- Adam Ballai
|
8
|
-
- Alexander Murmann & Ryan Spore
|
9
|
-
- Andrew Benton
|
10
|
-
- Brian Levine
|
11
|
-
- Caley Woods
|
12
|
-
- Carlos Diaz-Padron
|
13
|
-
- Connor Montgomery
|
14
|
-
- Doug Black
|
15
|
-
- Elaine Tsai
|
16
|
-
- Fiona Tay & Will Read
|
17
|
-
- Geoff Petrie
|
18
|
-
- Guille Carlos
|
19
|
-
-
|
20
|
-
-
|
21
|
-
-
|
22
|
-
-
|
23
|
-
-
|
24
|
-
-
|
25
|
-
-
|
26
|
-
-
|
27
|
-
-
|
28
|
-
-
|
29
|
-
-
|
30
|
-
-
|
31
|
-
-
|
7
|
+
- Adam Ballai
|
8
|
+
- Alexander Murmann & Ryan Spore
|
9
|
+
- Andrew Benton
|
10
|
+
- Brian Levine
|
11
|
+
- Caley Woods
|
12
|
+
- Carlos Diaz-Padron
|
13
|
+
- Connor Montgomery
|
14
|
+
- Doug Black
|
15
|
+
- Elaine Tsai
|
16
|
+
- Fiona Tay & Will Read
|
17
|
+
- Geoff Petrie
|
18
|
+
- Guille Carlos
|
19
|
+
- Jeremy Franz
|
20
|
+
- Josh Hull
|
21
|
+
- Joël Franusic
|
22
|
+
- K Gautam Pai
|
23
|
+
- Karl Freeman
|
24
|
+
- Kevin Burke
|
25
|
+
- Kyle Conroy
|
26
|
+
- Leo Adamek
|
27
|
+
- Oscar
|
28
|
+
- Oscar Sanchez
|
29
|
+
- Phil Nash
|
30
|
+
- Rafael Chacon
|
31
|
+
- Ryan Spore
|
32
|
+
- Sam Kimbrel
|
33
|
+
- Torey Heinz
|
34
|
+
- Vipul A M
|
35
|
+
- vfrride
|
data/{CHANGES → CHANGES.md}
RENAMED
@@ -1,15 +1,58 @@
|
|
1
1
|
twilio-ruby changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
+
Version 3.12.3
|
5
|
+
--------------
|
6
|
+
|
7
|
+
Released September 23, 2014
|
8
|
+
|
9
|
+
- Added block configure syntax
|
10
|
+
|
11
|
+
Version 3.12.2
|
12
|
+
--------------
|
13
|
+
|
14
|
+
Released August 29, 2014
|
15
|
+
|
16
|
+
- `client.account.{resource}` can now be accessed with `client.{resource}`
|
17
|
+
- Many doc updates
|
18
|
+
|
19
|
+
Version 3.12.1
|
20
|
+
--------------
|
21
|
+
|
22
|
+
Released August 26, 2014
|
23
|
+
|
24
|
+
- Add support for new call feedback endpoints
|
25
|
+
|
26
|
+
Version 3.12.0
|
27
|
+
--------------
|
28
|
+
|
29
|
+
Released August 18, 2014
|
30
|
+
|
31
|
+
- Add Rack middleware for Twilio request-signature validation
|
32
|
+
- Upgrade dependencies and clean up project files
|
33
|
+
- Documentation fixes
|
34
|
+
- Add `text` alias for `to_xml` method on TwiML generator objects
|
35
|
+
|
36
|
+
Version 3.11.6
|
37
|
+
--------------
|
38
|
+
|
39
|
+
Released July 25, 2014
|
40
|
+
|
41
|
+
- Add #to_xml to TwiML Responses.
|
42
|
+
- Updated test / development dependencies.
|
43
|
+
- Updated to RSpec 3 syntax.
|
44
|
+
|
4
45
|
Version 3.11.5
|
46
|
+
--------------
|
5
47
|
|
6
|
-
Released February 4
|
48
|
+
Released February 4, 2014
|
7
49
|
|
8
50
|
- Add bangs for twilify to indicate it's a dangerous operation.
|
9
51
|
- Remove reference to deprecated OpenSSL Digest parameter.
|
10
52
|
- Encode dates properly before passing them to the Twilio API.
|
11
53
|
|
12
54
|
Version 3.11.4
|
55
|
+
--------------
|
13
56
|
|
14
57
|
Released October 21, 2013
|
15
58
|
|
@@ -18,6 +61,7 @@ Released October 21, 2013
|
|
18
61
|
both IncomingPhoneNumbers and AvailablePhoneNumbers.
|
19
62
|
|
20
63
|
Version 3.11.3
|
64
|
+
--------------
|
21
65
|
|
22
66
|
Released October 15, 2013
|
23
67
|
|
data/Gemfile
CHANGED
data/{LICENSE → LICENSE.md}
RENAMED
data/Makefile
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,20 @@
|
|
1
|
-
[][gem]
|
2
|
+
[][travis]
|
3
|
+
[][codeclimate]
|
3
4
|
|
4
5
|
# twilio-ruby
|
5
6
|
|
6
|
-
A module for using the Twilio REST API and generating valid
|
7
|
-
[TwiML](http://www.twilio.com/docs/api/twiml/ "TwiML - Twilio Markup Language").
|
8
|
-
[Click here to read the full documentation.][documentation]
|
7
|
+
A module for using the Twilio REST API and generating valid [TwiML](http://www.twilio.com/docs/api/twiml/ "TwiML - Twilio Markup Language"). [Click here to read the full documentation.][documentation]
|
9
8
|
|
10
|
-
##
|
9
|
+
## Installation
|
11
10
|
|
12
|
-
|
11
|
+
To install using [Bundler][bundler] grab the latest stable version:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'twilio-ruby', '~> 3.12'
|
15
|
+
```
|
16
|
+
|
17
|
+
To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
|
13
18
|
|
14
19
|
```bash
|
15
20
|
gem install twilio-ruby
|
@@ -37,12 +42,21 @@ auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
|
|
37
42
|
|
38
43
|
# set up a client to talk to the Twilio REST API
|
39
44
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
45
|
+
|
46
|
+
# alternatively, you can preconfigure the client like so
|
47
|
+
Twilio.configure do |config|
|
48
|
+
config.account_sid = account_sid
|
49
|
+
config.auth_token = auth_token
|
50
|
+
end
|
51
|
+
|
52
|
+
# and then you can create a new client without parameters
|
53
|
+
@client = Twilio::REST::Client.new
|
40
54
|
```
|
41
55
|
|
42
56
|
### Send an SMS
|
43
57
|
|
44
58
|
``` ruby
|
45
|
-
@client.
|
59
|
+
@client.messages.create(
|
46
60
|
:from => '+14159341234',
|
47
61
|
:to => '+16105557069',
|
48
62
|
:body => 'Hey there!'
|
@@ -52,7 +66,7 @@ auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
|
|
52
66
|
### Send an MMS
|
53
67
|
|
54
68
|
``` ruby
|
55
|
-
@client.
|
69
|
+
@client.messages.create(
|
56
70
|
:from => '+14159341234',
|
57
71
|
:to => '+16105557069',
|
58
72
|
:body => 'Hey there!',
|
@@ -64,7 +78,7 @@ auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
|
|
64
78
|
|
65
79
|
``` ruby
|
66
80
|
# make a new outgoing call
|
67
|
-
@call = @client.
|
81
|
+
@call = @client.calls.create(
|
68
82
|
:from => '+14159341234',
|
69
83
|
:to => '+18004567890',
|
70
84
|
:url => 'http://example.com/call-handler',
|
@@ -74,7 +88,7 @@ auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
|
|
74
88
|
@call.cancel
|
75
89
|
|
76
90
|
# if you have the call sid, you can fetch a call object via:
|
77
|
-
@call = @client.
|
91
|
+
@call = @client.calls.get('CA386025c9bf5d6052a1d1ea42b4d16662')
|
78
92
|
|
79
93
|
# redirect an in-progress call
|
80
94
|
@call.redirect_to('http://example.com/call-redirect')
|
@@ -87,21 +101,21 @@ auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
|
|
87
101
|
|
88
102
|
``` ruby
|
89
103
|
# list calls made or received on or after May 13, 2013
|
90
|
-
@client.
|
104
|
+
@client.calls.list("start_time>" => "2013-05-13") # Notice we omit the "=" in the "start_time>=" parameter because it is automatically added
|
91
105
|
```
|
92
106
|
|
93
107
|
### Buy a Phone Number
|
94
108
|
|
95
109
|
``` ruby
|
96
110
|
# print some available numbers
|
97
|
-
@numbers = @client.
|
111
|
+
@numbers = @client.available_phone_numbers.get('US').local.list(
|
98
112
|
:contains => 'AWESOME'
|
99
113
|
)
|
100
114
|
@numbers.each {|num| puts num.phone_number}
|
101
115
|
|
102
116
|
# buy the first one
|
103
117
|
@number = @numbers[0].phone_number
|
104
|
-
@client.
|
118
|
+
@client.incoming_phone_numbers.create(:phone_number => @number)
|
105
119
|
```
|
106
120
|
|
107
121
|
## Getting Started With Client Capability Tokens
|
@@ -135,7 +149,7 @@ section of the wiki.
|
|
135
149
|
|
136
150
|
## Getting Started With TwiML
|
137
151
|
|
138
|
-
TwiML support is based on the [
|
152
|
+
TwiML support is based on the [Builder][builder] library. You can construct a
|
139
153
|
TwiML response like this:
|
140
154
|
|
141
155
|
``` ruby
|
@@ -156,7 +170,7 @@ puts response.text
|
|
156
170
|
|
157
171
|
This will print the following (except for the whitespace):
|
158
172
|
|
159
|
-
```
|
173
|
+
``` xml
|
160
174
|
<?xml version="1.0" encoding="UTF-8"?>
|
161
175
|
<Response>
|
162
176
|
<Say voice="alice">hello there</Say>
|
@@ -166,16 +180,33 @@ This will print the following (except for the whitespace):
|
|
166
180
|
</Response>
|
167
181
|
```
|
168
182
|
|
169
|
-
##
|
183
|
+
## Supported Ruby Versions
|
170
184
|
|
171
|
-
|
172
|
-
|
185
|
+
This library supports and is [tested against][travis] the following Ruby
|
186
|
+
implementations:
|
173
187
|
|
174
|
-
|
188
|
+
- Ruby 2.1.0
|
189
|
+
- Ruby 2.0.0
|
190
|
+
- Ruby 1.9.3
|
191
|
+
- Ruby 1.8.7
|
192
|
+
- [JRuby][jruby]
|
193
|
+
- [Rubinius][rubinius]
|
175
194
|
|
176
|
-
|
177
|
-
|
178
|
-
[examples]
|
179
|
-
[
|
180
|
-
|
181
|
-
[
|
195
|
+
## More Information
|
196
|
+
|
197
|
+
There are more detailed examples in the included [examples][examples]
|
198
|
+
directory. Also for thoose upgrading, the [upgrade guide][upgrade] is available in the [twilio-ruby github wiki][wiki].
|
199
|
+
|
200
|
+
[capability]: https://github.com/twilio/twilio-ruby/wiki/Capability
|
201
|
+
[builder]: http://builder.rubyforge.org/
|
202
|
+
[examples]: https://github.com/twilio/twilio-ruby/blob/master/examples
|
203
|
+
[documentation]: http://twilio-ruby.readthedocs.org/en/latest
|
204
|
+
[upgrade]: https://github.com/twilio/twilio-ruby/wiki/UpgradeGuide
|
205
|
+
[wiki]: https://github.com/twilio/twilio-ruby/wiki
|
206
|
+
[bundler]: http://bundler.io
|
207
|
+
[rubygems]: http://rubygems.org
|
208
|
+
[gem]: https://rubygems.org/gems/twilio
|
209
|
+
[travis]: http://travis-ci.org/twilio/twilio-ruby
|
210
|
+
[codeclimate]: https://codeclimate.com/github/twilio/twilio-ruby
|
211
|
+
[jruby]: http://www.jruby.org
|
212
|
+
[rubinius]: http://rubini.us
|
data/Rakefile
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
spec = eval(File.read('twilio-ruby.gemspec'))
|
1
|
+
require 'bundler'
|
2
|
+
Bundler.setup
|
3
|
+
Bundler::GemHelper.install_tasks
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
desc 'Run all specs'
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
10
8
|
|
11
|
-
|
12
|
-
task :
|
9
|
+
task :default => :spec
|
10
|
+
task :test => :spec
|
data/docs/getting-started.rst
CHANGED
@@ -19,7 +19,7 @@ Make a Call
|
|
19
19
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
20
20
|
|
21
21
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
22
|
-
@call = @client.
|
22
|
+
@call = @client.calls.create({:to => "9991231234", :from => "9991231234",
|
23
23
|
:url => "http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient"})
|
24
24
|
puts @call.length
|
25
25
|
puts @call.sid
|
@@ -38,7 +38,7 @@ Send an SMS
|
|
38
38
|
|
39
39
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
40
40
|
|
41
|
-
@message = @client.
|
41
|
+
@message = @client.messages.create({:to => "+12316851234",
|
42
42
|
:from => "+15555555555",
|
43
43
|
:body => "Hello there!"})
|
44
44
|
|
@@ -56,7 +56,7 @@ Send an MMS
|
|
56
56
|
|
57
57
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
58
58
|
|
59
|
-
@message = @client.
|
59
|
+
@message = @client.messages.create({:to => "+15558676309",
|
60
60
|
:from => "+15555555555",
|
61
61
|
:body => "Jenny I need you!",
|
62
62
|
:media_url => "http://twilio.com/heart.jpg"})
|
data/docs/usage/applications.rst
CHANGED
@@ -26,7 +26,7 @@ The following code will print out the :attr:`friendly_name` for each :class:`App
|
|
26
26
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
27
27
|
|
28
28
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
29
|
-
@client.
|
29
|
+
@client.applications.each do |app|
|
30
30
|
puts app.friendly_name
|
31
31
|
end
|
32
32
|
|
@@ -45,7 +45,7 @@ You can filter applications by FriendlyName
|
|
45
45
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
46
46
|
|
47
47
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
48
|
-
@client.
|
48
|
+
@client.applications.list({:friendly_name => 'FOO'})}.each do |app|
|
49
49
|
puts app.sid
|
50
50
|
end
|
51
51
|
|
@@ -66,7 +66,7 @@ accepts many other arguments for url configuration.
|
|
66
66
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
67
67
|
|
68
68
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
69
|
-
@application = @client.
|
69
|
+
@application = @client.applications.create({:friendly_name => "My New App"})
|
70
70
|
|
71
71
|
|
72
72
|
Updating an Application
|
@@ -85,7 +85,7 @@ Updating an Application
|
|
85
85
|
url = "http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient"
|
86
86
|
app_sid = 'AP123' # the app you'd like to update
|
87
87
|
|
88
|
-
@application = @client.
|
88
|
+
@application = @client.applications.get(app_sid)
|
89
89
|
@application.update({:voice_url => url})
|
90
90
|
|
91
91
|
|
@@ -103,6 +103,6 @@ Deleting an Application
|
|
103
103
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
104
104
|
|
105
105
|
app_sid = 'AP123' # the app you'd like to delete
|
106
|
-
@client.
|
106
|
+
@client.applications.get(app_sid)
|
107
107
|
@application.delete()
|
108
108
|
|
data/docs/usage/basics.rst
CHANGED
@@ -27,6 +27,19 @@ Once you have your credentials, you can create create a new :class:`Client` and
|
|
27
27
|
|
28
28
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
29
29
|
|
30
|
+
You can also configure the client using the top level configure method, like so:
|
31
|
+
|
32
|
+
.. code-block:: ruby
|
33
|
+
|
34
|
+
require 'twilio-ruby'
|
35
|
+
|
36
|
+
Twilio.configure do |config|
|
37
|
+
config.account_sid = "ACXXXXXXXXXXXXXXXXX"
|
38
|
+
config.auth_token = "YYYYYYYYYYYYYYYYYY"
|
39
|
+
end
|
40
|
+
|
41
|
+
@client = Twilio::REST::Client.new
|
42
|
+
|
30
43
|
|
31
44
|
Listing Resources
|
32
45
|
-------------------
|
@@ -43,7 +56,7 @@ The :class:`Client` gives you access to various list resources.
|
|
43
56
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
44
57
|
|
45
58
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
46
|
-
@calls = @client.
|
59
|
+
@calls = @client.calls.list()
|
47
60
|
|
48
61
|
:meth:`ListResource.list` accepts paging arguments.
|
49
62
|
The following will return page 3 with page size of 25.
|
@@ -57,7 +70,7 @@ The following will return page 3 with page size of 25.
|
|
57
70
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
58
71
|
|
59
72
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
60
|
-
@calls = @client.
|
73
|
+
@calls = @client.calls.list(:page=>3, :page_size=>25)
|
61
74
|
|
62
75
|
|
63
76
|
Get an Individual Resource
|
@@ -76,7 +89,7 @@ Provide the :attr:`sid` of the resource you'd like to get.
|
|
76
89
|
|
77
90
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
78
91
|
|
79
|
-
@call = @client.
|
92
|
+
@call = @client.calls.get("CA123")
|
80
93
|
puts @call.to
|
81
94
|
|
82
95
|
|
@@ -97,6 +110,6 @@ and then call :meth:`delete` on it.
|
|
97
110
|
|
98
111
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
99
112
|
|
100
|
-
@recording = @client.
|
113
|
+
@recording = @client.recordings.get("RC123")
|
101
114
|
@recording.delete()
|
102
115
|
|
data/docs/usage/caller-ids.rst
CHANGED
@@ -19,7 +19,7 @@ Validating a phone number is quick and easy.
|
|
19
19
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
20
20
|
|
21
21
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
22
|
-
@response = @client.
|
22
|
+
@response = @client.outgoing_caller_ids.create(:phone_number => "+44 9876543212")
|
23
23
|
puts @response.validation_code
|
24
24
|
|
25
25
|
Twilio will call the provided number and wait for the validation code to be
|
@@ -40,6 +40,6 @@ Deleting a phone number is quick and easy.
|
|
40
40
|
|
41
41
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
42
42
|
|
43
|
-
@response = @client.
|
43
|
+
@response = @client.outgoing_caller_ids.list(:phone_number => "+15555555555")
|
44
44
|
@callerid = response[0]
|
45
45
|
@callerid.delete()
|
data/docs/usage/conferences.rst
CHANGED
@@ -20,7 +20,7 @@ Listing Conferences
|
|
20
20
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
21
21
|
|
22
22
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
23
|
-
@conferences = @client.
|
23
|
+
@conferences = @client.conferences.list()
|
24
24
|
|
25
25
|
@conferences.each do |conference|
|
26
26
|
puts conference.sid
|
@@ -43,8 +43,8 @@ will return a list of all in-progress conferences and print their friendly name.
|
|
43
43
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
44
44
|
|
45
45
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
46
|
-
@conferences = @client.
|
47
|
-
|
46
|
+
@conferences = @client.conferences.list({:status => "in-progress"})
|
47
|
+
|
48
48
|
@conference.each do |conference|
|
49
49
|
puts conference.friendly_name
|
50
50
|
end
|
@@ -64,7 +64,7 @@ Each :class:`Conference` has a :attr:`participants` instance which represents al
|
|
64
64
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
65
65
|
|
66
66
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
67
|
-
@conference = @client.
|
67
|
+
@conference = @client.conferences.get("CF123")
|
68
68
|
|
69
69
|
@conference.participants.list.each.do |paricipant|
|
70
70
|
puts participant.sid
|
@@ -94,7 +94,7 @@ code kicks out the first participant and mutes the rest.
|
|
94
94
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
95
95
|
|
96
96
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
97
|
-
@participants = @client.
|
97
|
+
@participants = @client.conferences.get("CF123").participants.list()
|
98
98
|
|
99
99
|
if @participants.empty?
|
100
100
|
return
|
data/docs/usage/errors.rst
CHANGED
data/docs/usage/messages.rst
CHANGED
@@ -24,7 +24,7 @@ Send a text message in only a few lines of code.
|
|
24
24
|
|
25
25
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
26
26
|
|
27
|
-
@message = @client.
|
27
|
+
@message = @client.messages.create({:to => "+13216851234",
|
28
28
|
:from => "+15555555555",
|
29
29
|
:body => "Hello!"})
|
30
30
|
|
@@ -48,7 +48,7 @@ To send a picture, set :attr:`media_url` to the url of the picture you wish to s
|
|
48
48
|
|
49
49
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
50
50
|
|
51
|
-
@message = @client.
|
51
|
+
@message = @client.messages.create({:to => "+15558676309",
|
52
52
|
:from => "+15555555555",
|
53
53
|
:body => "Jenny I need you!",
|
54
54
|
:media_url => "http://twilio.com/heart.jpg"})
|
@@ -58,7 +58,7 @@ an array of urls.
|
|
58
58
|
|
59
59
|
.. code-block:: ruby
|
60
60
|
|
61
|
-
@message = @client.
|
61
|
+
@message = @client.messages.create({:to => "+15558676309",
|
62
62
|
:from => "+15555555555",
|
63
63
|
:body => "Jenny I need you!",
|
64
64
|
:media_url => [
|
@@ -80,7 +80,7 @@ Retrieving Sent Messages
|
|
80
80
|
|
81
81
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
82
82
|
|
83
|
-
@client.
|
83
|
+
@client.messages.list.each do |message|
|
84
84
|
puts message.body
|
85
85
|
|
86
86
|
|
@@ -101,9 +101,9 @@ The following will only show messages to "+5466758723" on January 1st, 2011.
|
|
101
101
|
|
102
102
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
103
103
|
|
104
|
-
@messages = @client.
|
104
|
+
@messages = @client.messages.list({:to => "+5466758723", :date_sent => "2011-01-01"})
|
105
105
|
|
106
106
|
@messages.each do |message|
|
107
107
|
puts message.body
|
108
|
-
|
108
|
+
|
109
109
|
|
@@ -24,7 +24,7 @@ current :class:`Notification` resources.
|
|
24
24
|
|
25
25
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
26
26
|
|
27
|
-
@client.
|
27
|
+
@client.notifications.list().each do |notification|:
|
28
28
|
puts notification.more_info
|
29
29
|
|
30
30
|
You can filter transcriptions by :attr:`log` and :attr:`message_date`.
|
@@ -42,7 +42,7 @@ The :attr:`log` value is 0 for `ERROR` and 1 for `WARNING`.
|
|
42
42
|
|
43
43
|
ERROR = 0
|
44
44
|
|
45
|
-
@client.
|
45
|
+
@client.notifications.list(log=ERROR).each do |notification|:
|
46
46
|
puts notification.error_code
|
47
47
|
|
48
48
|
.. note:: Due to the potentially voluminous amount of data in a notification,
|