twilio-ruby 3.12.3 → 3.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGES.md +12 -0
- data/README.md +14 -14
- data/Rakefile +2 -2
- data/docs/faq.rst +3 -3
- data/docs/getting-started.rst +17 -12
- data/docs/usage/accounts.rst +6 -6
- data/docs/usage/applications.rst +5 -5
- data/docs/usage/basics.rst +1 -1
- data/docs/usage/caller-ids.rst +4 -2
- data/docs/usage/conferences.rst +1 -1
- data/docs/usage/errors.rst +3 -3
- data/docs/usage/messages.rst +24 -16
- data/docs/usage/phone-calls.rst +10 -8
- data/docs/usage/phone-numbers.rst +15 -11
- data/docs/usage/sip.rst +9 -8
- data/docs/usage/twiml.rst +2 -2
- data/examples/examples.rb +44 -20
- data/lib/rack/twilio_webhook_authentication.rb +5 -1
- data/lib/twilio-ruby/rest/calls.rb +4 -4
- data/lib/twilio-ruby/rest/client.rb +25 -23
- data/lib/twilio-ruby/rest/conferences/participants.rb +2 -2
- data/lib/twilio-ruby/rest/incoming_phone_numbers.rb +1 -1
- data/lib/twilio-ruby/rest/instance_resource.rb +9 -5
- data/lib/twilio-ruby/rest/list_resource.rb +18 -10
- data/lib/twilio-ruby/rest/outgoing_caller_ids.rb +1 -1
- data/lib/twilio-ruby/rest/queues/members.rb +1 -1
- data/lib/twilio-ruby/rest/sip.rb +1 -3
- data/lib/twilio-ruby/rest/utils.rb +11 -3
- data/lib/twilio-ruby/util/capability.rb +4 -4
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/rack/twilio_webhook_authentication_spec.rb +18 -6
- data/spec/rest/account_spec.rb +24 -8
- data/spec/rest/call_spec.rb +6 -2
- data/spec/rest/client_spec.rb +37 -14
- data/spec/rest/conference_spec.rb +3 -1
- data/spec/rest/instance_resource_spec.rb +1 -1
- data/spec/rest/numbers_spec.rb +18 -6
- data/spec/rest/queue_spec.rb +3 -1
- data/spec/rest/recording_spec.rb +3 -1
- data/spec/util/url_encode_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDRmNTExMjMzZmVlZGE4ODU1OTAyMjM4YzU2ZjViYjY0ZjA5ODBiMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjhkMTg4ODMyNzU4ZjJlODU3YmZjZDJhNDkyZjI1MWMwOTlkMmNhNA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzMxNzNmNWViMDI5M2E3Yjk4MGUwMzRlZjhkZjY0YzQ5NGE2ODA4OTZkYjU4
|
10
|
+
MTA5MzdjNTk2YWU5NzgzMzYxZjZmNTZiY2Y3MmI3ZWJjNDQyYjc0MDdlMzQw
|
11
|
+
ODE0N2RkZTA1NzM1ZGNmYzYyMDQyMWQ2MzkzNGM0Y2Y4NDY0NzU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWY4YWVhYjEzZjYwZmMwMGNhZjM2YzE3MWExZmY0YzFkZWYxZDg0MDk0ZDcw
|
14
|
+
NWE1MGJmNjdmZWI3MGQyNGY2M2I2NDU3NTNlY2ZmNzNhMjUwNGNlMmJhNjdj
|
15
|
+
NDI3OTE1ZTg1MDFkMDFmNjE0NjgxOWUzMjE1ZmU0NmI4ZjgxOGM=
|
data/CHANGES.md
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
twilio-ruby changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
+
Version 3.13.0
|
5
|
+
--------------
|
6
|
+
|
7
|
+
Released September 23, 2014
|
8
|
+
|
9
|
+
- Deprecates 1.8.7 support
|
10
|
+
- Internal code style changes including:
|
11
|
+
- change symbol hash syntax to Ruby 1.9 style
|
12
|
+
- remove curly braces from hash arguments to methods
|
13
|
+
- add spaces around curly braces in blocks
|
14
|
+
- reduces all lines to less than 80 characters
|
15
|
+
|
4
16
|
Version 3.12.3
|
5
17
|
--------------
|
6
18
|
|
data/README.md
CHANGED
@@ -57,9 +57,9 @@ end
|
|
57
57
|
|
58
58
|
``` ruby
|
59
59
|
@client.messages.create(
|
60
|
-
:
|
61
|
-
:
|
62
|
-
:
|
60
|
+
from: '+14159341234',
|
61
|
+
to: '+16105557069',
|
62
|
+
body: 'Hey there!'
|
63
63
|
)
|
64
64
|
```
|
65
65
|
|
@@ -67,10 +67,10 @@ end
|
|
67
67
|
|
68
68
|
``` ruby
|
69
69
|
@client.messages.create(
|
70
|
-
:
|
71
|
-
:
|
72
|
-
:
|
73
|
-
:
|
70
|
+
from: '+14159341234',
|
71
|
+
to: '+16105557069',
|
72
|
+
body: 'Hey there!',
|
73
|
+
media_url: 'http://example.com/smileyface.jpg'
|
74
74
|
)
|
75
75
|
```
|
76
76
|
|
@@ -79,9 +79,9 @@ end
|
|
79
79
|
``` ruby
|
80
80
|
# make a new outgoing call
|
81
81
|
@call = @client.calls.create(
|
82
|
-
:
|
83
|
-
:
|
84
|
-
:
|
82
|
+
from: '+14159341234',
|
83
|
+
to: '+18004567890',
|
84
|
+
url: 'http://example.com/call-handler'
|
85
85
|
)
|
86
86
|
|
87
87
|
# hangup a ringing call, but don't touch it if it's connected
|
@@ -109,13 +109,13 @@ end
|
|
109
109
|
``` ruby
|
110
110
|
# print some available numbers
|
111
111
|
@numbers = @client.available_phone_numbers.get('US').local.list(
|
112
|
-
:
|
112
|
+
contains: 'AWESOME'
|
113
113
|
)
|
114
114
|
@numbers.each {|num| puts num.phone_number}
|
115
115
|
|
116
116
|
# buy the first one
|
117
117
|
@number = @numbers[0].phone_number
|
118
|
-
@client.incoming_phone_numbers.create(:
|
118
|
+
@client.incoming_phone_numbers.create(phone_number: @number)
|
119
119
|
```
|
120
120
|
|
121
121
|
## Getting Started With Client Capability Tokens
|
@@ -158,8 +158,8 @@ require 'twilio-ruby'
|
|
158
158
|
|
159
159
|
# build up a response
|
160
160
|
response = Twilio::TwiML::Response.new do |r|
|
161
|
-
r.Say 'hello there', :
|
162
|
-
r.Dial :
|
161
|
+
r.Say 'hello there', voice: 'alice'
|
162
|
+
r.Dial callerId: '+14159992222' do |d|
|
163
163
|
d.Client 'jenny'
|
164
164
|
end
|
165
165
|
end
|
data/Rakefile
CHANGED
data/docs/faq.rst
CHANGED
@@ -34,9 +34,9 @@ Then you can convert user input to phone numbers like this:
|
|
34
34
|
def convert_to_e164(raw_phone)
|
35
35
|
Phony.format(
|
36
36
|
raw_phone,
|
37
|
-
:
|
38
|
-
:
|
37
|
+
format: :international,
|
38
|
+
spaces: ''
|
39
39
|
).gsub(/\s+/, "") # Phony won't remove all spaces
|
40
|
-
end
|
40
|
+
end
|
41
41
|
|
42
42
|
puts convert_to_e164('212 555 1234') # prints +12125551234
|
data/docs/getting-started.rst
CHANGED
@@ -19,8 +19,11 @@ Make a Call
|
|
19
19
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
20
20
|
|
21
21
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
22
|
-
@call = @client.calls.create(
|
23
|
-
|
22
|
+
@call = @client.calls.create(
|
23
|
+
to: "9991231234",
|
24
|
+
from: "9991231234",
|
25
|
+
url: "http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient"
|
26
|
+
)
|
24
27
|
puts @call.length
|
25
28
|
puts @call.sid
|
26
29
|
|
@@ -38,10 +41,11 @@ Send an SMS
|
|
38
41
|
|
39
42
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
40
43
|
|
41
|
-
@message = @client.messages.create(
|
42
|
-
|
43
|
-
|
44
|
-
|
44
|
+
@message = @client.messages.create(
|
45
|
+
to: "+12316851234",
|
46
|
+
from: "+15555555555",
|
47
|
+
body: "Hello there!"
|
48
|
+
)
|
45
49
|
|
46
50
|
Send an MMS
|
47
51
|
===========
|
@@ -56,11 +60,12 @@ Send an MMS
|
|
56
60
|
|
57
61
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
58
62
|
|
59
|
-
@message = @client.messages.create(
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
63
|
+
@message = @client.messages.create(
|
64
|
+
to: "+15558676309",
|
65
|
+
from: "+15555555555",
|
66
|
+
body: "Jenny I need you!",
|
67
|
+
media_url: "http://twilio.com/heart.jpg"
|
68
|
+
)
|
64
69
|
|
65
70
|
Generating TwiML
|
66
71
|
=================
|
@@ -72,7 +77,7 @@ to easily create such responses.
|
|
72
77
|
.. code-block:: ruby
|
73
78
|
|
74
79
|
Twilio::TwiML::Response do |r|
|
75
|
-
r.Play "https://api.twilio.com/cowbell.mp3", :
|
80
|
+
r.Play "https://api.twilio.com/cowbell.mp3", loop: 5
|
76
81
|
end.text
|
77
82
|
|
78
83
|
.. code-block:: xml
|
data/docs/usage/accounts.rst
CHANGED
@@ -28,7 +28,7 @@ Right now the only valid attribute is :attr:`friendly_name`.
|
|
28
28
|
|
29
29
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
30
30
|
@account = @client.accounts.get(account_sid)
|
31
|
-
@account.update(
|
31
|
+
@account.update(friendly_name: "My Awesome Account")
|
32
32
|
|
33
33
|
|
34
34
|
Creating Subaccounts
|
@@ -45,7 +45,7 @@ Subaccounts are easy to make.
|
|
45
45
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
46
46
|
|
47
47
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
48
|
-
@subaccount = @client.accounts.create(
|
48
|
+
@subaccount = @client.accounts.create(name: "My Awesome SubAccount")
|
49
49
|
|
50
50
|
|
51
51
|
Managing Subaccounts
|
@@ -70,20 +70,20 @@ Client X hasn't paid you recently, so let's suspend their account.
|
|
70
70
|
|
71
71
|
.. code-block:: ruby
|
72
72
|
|
73
|
-
@subaccount.update(
|
73
|
+
@subaccount.update(status: 'suspended')
|
74
74
|
|
75
75
|
If it was just a misunderstanding, reenable their account.
|
76
76
|
|
77
77
|
.. code-block:: ruby
|
78
78
|
|
79
|
-
@subaccount.update(
|
79
|
+
@subaccount.update(status: 'active')
|
80
80
|
|
81
81
|
Otherwise, close their account permanently.
|
82
82
|
|
83
83
|
.. code-block:: ruby
|
84
84
|
|
85
|
-
@subaccount.update(
|
85
|
+
@subaccount.update(status: 'closed')
|
86
86
|
|
87
87
|
.. warning::
|
88
|
-
This action can't be undone.
|
88
|
+
This action can't be undone.
|
89
89
|
|
data/docs/usage/applications.rst
CHANGED
@@ -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.applications.list(
|
48
|
+
@client.applications.list(friendly_name: 'FOO').each do |app|
|
49
49
|
puts app.sid
|
50
50
|
end
|
51
51
|
|
@@ -66,8 +66,9 @@ 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.applications.create(
|
70
|
-
|
69
|
+
@application = @client.applications.create(
|
70
|
+
friendly_name: "My New App"
|
71
|
+
)
|
71
72
|
|
72
73
|
Updating an Application
|
73
74
|
------------------------
|
@@ -86,8 +87,7 @@ Updating an Application
|
|
86
87
|
app_sid = 'AP123' # the app you'd like to update
|
87
88
|
|
88
89
|
@application = @client.applications.get(app_sid)
|
89
|
-
@application.update(
|
90
|
-
|
90
|
+
@application.update(voice_url: url)
|
91
91
|
|
92
92
|
Deleting an Application
|
93
93
|
-------------------------
|
data/docs/usage/basics.rst
CHANGED
@@ -70,7 +70,7 @@ The following will return page 3 with page size of 25.
|
|
70
70
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
71
71
|
|
72
72
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
73
|
-
@calls = @client.calls.list(:
|
73
|
+
@calls = @client.calls.list(page: 3, page_size: 25)
|
74
74
|
|
75
75
|
|
76
76
|
Get an Individual Resource
|
data/docs/usage/caller-ids.rst
CHANGED
@@ -19,7 +19,9 @@ 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.outgoing_caller_ids.create(
|
22
|
+
@response = @client.outgoing_caller_ids.create(
|
23
|
+
phone_number: "+44 9876543212"
|
24
|
+
)
|
23
25
|
puts @response.validation_code
|
24
26
|
|
25
27
|
Twilio will call the provided number and wait for the validation code to be
|
@@ -40,6 +42,6 @@ Deleting a phone number is quick and easy.
|
|
40
42
|
|
41
43
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
42
44
|
|
43
|
-
@response = @client.outgoing_caller_ids.list(:
|
45
|
+
@response = @client.outgoing_caller_ids.list(phone_number: "+15555555555")
|
44
46
|
@callerid = response[0]
|
45
47
|
@callerid.delete()
|
data/docs/usage/conferences.rst
CHANGED
@@ -43,7 +43,7 @@ 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.conferences.list(
|
46
|
+
@conferences = @client.conferences.list(status: "in-progress")
|
47
47
|
|
48
48
|
@conference.each do |conference|
|
49
49
|
puts conference.friendly_name
|
data/docs/usage/errors.rst
CHANGED
@@ -20,9 +20,9 @@ handled appropriately.
|
|
20
20
|
begin
|
21
21
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
22
22
|
client.messages.create({
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:
|
23
|
+
from: '+1234567890',
|
24
|
+
to: '+1234567890',
|
25
|
+
body: 'Hello world'
|
26
26
|
})
|
27
27
|
rescue Twilio::REST::RequestError => e
|
28
28
|
puts e.message
|
data/docs/usage/messages.rst
CHANGED
@@ -24,9 +24,11 @@ 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.messages.create(
|
28
|
-
|
29
|
-
|
27
|
+
@message = @client.messages.create(
|
28
|
+
to: "+13216851234",
|
29
|
+
from: "+15555555555",
|
30
|
+
body: "Hello!"
|
31
|
+
)
|
30
32
|
|
31
33
|
If you want to send a message from a `short code
|
32
34
|
<http://www.twilio.com/api/sms/short-codes>`_ on Twilio, just set :attr:`from`
|
@@ -48,24 +50,27 @@ To send a picture, set :attr:`media_url` to the url of the picture you wish to s
|
|
48
50
|
|
49
51
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
50
52
|
|
51
|
-
@message = @client.messages.create(
|
52
|
-
|
53
|
-
|
54
|
-
|
53
|
+
@message = @client.messages.create(
|
54
|
+
to: "+15558676309",
|
55
|
+
from: "+15555555555",
|
56
|
+
body: "Jenny I need you!",
|
57
|
+
media_url: "http://twilio.com/heart.jpg"
|
58
|
+
)
|
55
59
|
|
56
60
|
You can send multiple pictures in the same message by setting :attr:`media_url` to
|
57
61
|
an array of urls.
|
58
62
|
|
59
63
|
.. code-block:: ruby
|
60
64
|
|
61
|
-
@message = @client.messages.create(
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
65
|
+
@message = @client.messages.create(
|
66
|
+
to: "+15558676309",
|
67
|
+
from: "+15555555555",
|
68
|
+
body: "Jenny I need you!",
|
69
|
+
media_url: [
|
70
|
+
"http://twilio.com/heart.jpg",
|
71
|
+
"http://twilio.com/rose.jpg"
|
72
|
+
]
|
73
|
+
)
|
69
74
|
|
70
75
|
Retrieving Sent Messages
|
71
76
|
-------------------------
|
@@ -101,7 +106,10 @@ The following will only show messages to "+5466758723" on January 1st, 2011.
|
|
101
106
|
|
102
107
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
103
108
|
|
104
|
-
@messages = @client.messages.list(
|
109
|
+
@messages = @client.messages.list(
|
110
|
+
to: "+5466758723",
|
111
|
+
date_sent: "2011-01-01"
|
112
|
+
)
|
105
113
|
|
106
114
|
@messages.each do |message|
|
107
115
|
puts message.body
|
data/docs/usage/phone-calls.rst
CHANGED
@@ -25,9 +25,11 @@ outputs valid `TwiML <http://www.twilio.com/docs/api/twiml/>`_.
|
|
25
25
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
26
26
|
|
27
27
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
28
|
-
@call = @client.calls.create(
|
29
|
-
|
30
|
-
|
28
|
+
@call = @client.calls.create(
|
29
|
+
to: "9991231234",
|
30
|
+
from: "9991231234",
|
31
|
+
url: "http://foo.com/call.xml"
|
32
|
+
)
|
31
33
|
puts @call.length
|
32
34
|
puts @call.sid
|
33
35
|
|
@@ -89,9 +91,9 @@ However, what if you only have a `CallSid`, and not the actual
|
|
89
91
|
|
90
92
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
91
93
|
sid = "CA24234"
|
92
|
-
puts @client.notifications.list(
|
93
|
-
puts @client.recordings.list(
|
94
|
-
puts @client.transcriptions.list(
|
94
|
+
puts @client.notifications.list(call: sid)
|
95
|
+
puts @client.recordings.list(call: sid)
|
96
|
+
puts @client.transcriptions.list(call: sid)
|
95
97
|
|
96
98
|
|
97
99
|
Modifying Live Calls
|
@@ -109,7 +111,7 @@ redirect them as necessary
|
|
109
111
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
110
112
|
|
111
113
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
112
|
-
@calls = @client.calls.list(
|
114
|
+
@calls = @client.calls.list(status: "in-progress")
|
113
115
|
|
114
116
|
@calls.each do |call|
|
115
117
|
call.redirect_to("http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient")
|
@@ -127,7 +129,7 @@ Ending all live calls is also possible
|
|
127
129
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
128
130
|
|
129
131
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
130
|
-
@calls = @client.calls.list(
|
132
|
+
@calls = @client.calls.list(status: "in-progress")
|
131
133
|
|
132
134
|
@calls.each do |call|
|
133
135
|
call.hangup()
|
@@ -27,7 +27,7 @@ Once we find one, we'll purchase it for our account.
|
|
27
27
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
28
28
|
|
29
29
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
30
|
-
numbers = @client.available_phone_numbers.list(:
|
30
|
+
numbers = @client.available_phone_numbers.list(area_code: "530")
|
31
31
|
|
32
32
|
if numbers:
|
33
33
|
numbers[0].purchase()
|
@@ -67,13 +67,13 @@ The following example will find any phone number with "FOO" in it.
|
|
67
67
|
|
68
68
|
.. code-block:: ruby
|
69
69
|
|
70
|
-
numbers = @client.available_phone_numbers.list(:
|
70
|
+
numbers = @client.available_phone_numbers.list(contains: "FOO")
|
71
71
|
|
72
72
|
You can use the ''*'' wildcard to match any character. The following example finds any phone number that matches the pattern ''D*D''.
|
73
73
|
|
74
74
|
.. code-block:: ruby
|
75
75
|
|
76
|
-
numbers = @client.available_phone_numbers.list(:
|
76
|
+
numbers = @client.available_phone_numbers.list(contains: "D*D")
|
77
77
|
|
78
78
|
|
79
79
|
International Numbers
|
@@ -85,7 +85,7 @@ international numbers.
|
|
85
85
|
|
86
86
|
.. code-block:: ruby
|
87
87
|
|
88
|
-
numbers = @client.available_phone_numbers.list(:
|
88
|
+
numbers = @client.available_phone_numbers.list(country: "FR")
|
89
89
|
|
90
90
|
|
91
91
|
:meth:`PhoneNumbers.search` method has plenty of other options to augment your search :
|
@@ -115,7 +115,9 @@ If you've found a phone number you want, you can purchase the number.
|
|
115
115
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
116
116
|
|
117
117
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
118
|
-
@number = @client.available_phone_numbers.purchase(
|
118
|
+
@number = @client.available_phone_numbers.purchase(
|
119
|
+
phone_number: "+15305431234"
|
120
|
+
)
|
119
121
|
|
120
122
|
However, it's easier to purchase numbers after finding them using search (as
|
121
123
|
shown in the first example).
|
@@ -138,11 +140,13 @@ listed in the `IncomingPhoneNumbers Resource documentation
|
|
138
140
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
139
141
|
|
140
142
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
141
|
-
@client.available_phone_numbers.list
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
143
|
+
@client.available_phone_numbers.list.each do |number|
|
144
|
+
number.update(
|
145
|
+
voice_url: "http://twimlets.com/holdmusic?" \
|
146
|
+
"Bucket=com.twilio.music.ambient",
|
147
|
+
status_callback: "http://example.com/callback"
|
148
|
+
)
|
149
|
+
end
|
146
150
|
|
147
151
|
Changing Applications
|
148
152
|
----------------------
|
@@ -162,7 +166,7 @@ An :class:`Application` encapsulates all necessary URLs for use with phone numbe
|
|
162
166
|
phone_sid = "PNXXXXXXXXXXXXXXXXX"
|
163
167
|
|
164
168
|
@number = @client.available_phone_numbers.get(phone_sid)
|
165
|
-
@number.update(:
|
169
|
+
@number.update(sms_application_sid: "APXXXXXXXXXXXXXXXXXX")
|
166
170
|
|
167
171
|
See :doc:`/usage/applications` for instructions on updating and maintaining Applications.
|
168
172
|
|