twilio-ruby 3.14.2 → 3.14.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/AUTHORS.md +1 -1
- data/CHANGES.md +4 -3
- data/docs/usage/addresses.rst +101 -0
- data/docs/usage/applications.rst +2 -2
- data/docs/usage/caller-ids.rst +1 -1
- data/docs/usage/conferences.rst +6 -6
- data/docs/usage/errors.rst +7 -7
- data/docs/usage/messages.rst +4 -3
- data/docs/usage/notifications.rst +6 -4
- data/docs/usage/phone-calls.rst +2 -2
- data/docs/usage/phone-numbers.rst +33 -23
- data/docs/usage/queues.rst +3 -3
- data/docs/usage/recordings.rst +8 -6
- data/docs/usage/sip.rst +1 -1
- data/docs/usage/transcriptions.rst +2 -1
- data/docs/usage/twiml.rst +7 -7
- data/docs/usage/validation.rst +2 -2
- data/lib/rack/twilio_webhook_authentication.rb +1 -1
- data/lib/twilio-ruby.rb +2 -0
- data/lib/twilio-ruby/rest/accounts.rb +1 -1
- data/lib/twilio-ruby/rest/addresses.rb +12 -0
- data/lib/twilio-ruby/rest/addresses/dependent_phone_numbers.rb +6 -0
- data/lib/twilio-ruby/rest/list_resource.rb +2 -1
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/rest/account_spec.rb +8 -0
- data/spec/rest/address_spec.rb +11 -0
- metadata +24 -19
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YTgwOTUyYWJhOTNjYjBmNzI0NmVhNTI4MzM4ZjU0NWExNDY2ZDM2ZA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 77bf7b770b0f8deeac38b2ed13ddade0f5c19c38
|
4
|
+
data.tar.gz: 84e2b0002a9c511296e1b57aab3a1d9ee4f857a3
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
Y2I3MzNiYWFkMmUwOWMyOGI5MDJiYWNkYjEyMWI2YWJlZDg2OTQzZmM4NjY2
|
11
|
-
OGJlMGRlODQ1ZjA4ZTAwMWFlMmU0ZGI0YzkzNDU1ODYyNmUyMDI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MGY0ZTJmZjFkOWM0NzU1NzMwYWFiMmZiZjQ3OTA2NDc3YmU1Mjg0YjYwNWUx
|
14
|
-
Y2U1ZWIyNjY3ODRiOGZlZjU5NGZmYTQ2MjUwM2MyNjllMWUxZDhjMjhhZjI1
|
15
|
-
ZjA5MjYyY2IxMDA1Mzg4MDc2N2FhMjM3YTExNDcwMTI4MjE0YWQ=
|
6
|
+
metadata.gz: 5ad94bb471b8adde9de5470dfd712e3c47f70c6b100db9ebe9d40000b8a58ccf23e2bc01f1b72f2e062ed3163a5297f15bec9ab26e7410976e7983f556c8913c
|
7
|
+
data.tar.gz: e96311fd80abb64ee1372fe08c912e42954f57f9d473ca351d6704268301f6610487e793ffce4a58619f8dbfe4e38335babda8097b873f5f13fbd2143b8e0463
|
data/AUTHORS.md
CHANGED
data/CHANGES.md
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
twilio-ruby changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
-
Version 3.14.
|
4
|
+
Version 3.14.3
|
5
5
|
--------------
|
6
6
|
|
7
|
-
Released
|
7
|
+
Released January 8, 2015
|
8
8
|
|
9
|
-
-
|
9
|
+
- Fix nil error in RequestValidator middleware
|
10
|
+
- Fix up docs
|
10
11
|
|
11
12
|
Version 3.14.1
|
12
13
|
--------------
|
@@ -0,0 +1,101 @@
|
|
1
|
+
.. module:: twilio.rest.resources
|
2
|
+
|
3
|
+
=========
|
4
|
+
Addresses
|
5
|
+
=========
|
6
|
+
|
7
|
+
An Address instance resource represents your or your customer’s physical
|
8
|
+
location within a country. Around the world, some local authorities require the
|
9
|
+
name and address of the user to be on file with Twilio to purchase and own a
|
10
|
+
phone number.
|
11
|
+
|
12
|
+
For more information, see the `Address REST Resource
|
13
|
+
<http://www.twilio.com/docs/api/rest/address`_ documentation.
|
14
|
+
|
15
|
+
Creating an Address
|
16
|
+
-------------------
|
17
|
+
|
18
|
+
Addresses contain the name of your company or your customer’s company in
|
19
|
+
addition to location information and an optional friendly name.
|
20
|
+
|
21
|
+
.. code-block:: ruby
|
22
|
+
|
23
|
+
require 'twilio-ruby'
|
24
|
+
|
25
|
+
# To find these visit https://www.twilio.com/user/account
|
26
|
+
account_sid = "ACXXXXXXXXXXXXXXXXX"
|
27
|
+
auth_token = "YYYYYYYYYYYYYYYYYY"
|
28
|
+
|
29
|
+
@client = Twilio::REST::Client.new account_sid, auth_token
|
30
|
+
@address = @client.addresses.create(
|
31
|
+
friendly_name: "Homer",
|
32
|
+
customer_name: "Homer Simpson",
|
33
|
+
street: "742 Evergreen Terrace",
|
34
|
+
city: "Springfield",
|
35
|
+
region "IL",
|
36
|
+
postal_code: "62701",
|
37
|
+
iso_country: "US"
|
38
|
+
)
|
39
|
+
|
40
|
+
Listing Addresses
|
41
|
+
-----------------
|
42
|
+
|
43
|
+
The following code will print out the :attr:`customer_name` for each :class:`Address`.
|
44
|
+
|
45
|
+
.. code-block:: ruby
|
46
|
+
|
47
|
+
@addresses = @client.addresses.list()
|
48
|
+
@addresses.each do |address|
|
49
|
+
puts address.customer_name
|
50
|
+
end
|
51
|
+
|
52
|
+
Filtering Addresses
|
53
|
+
-------------------
|
54
|
+
|
55
|
+
The list of Addresses can be filtered on :attr:`friendly_name`,
|
56
|
+
:attr:`customer_name`, and/or :attr:`iso_country`.
|
57
|
+
|
58
|
+
.. code-block:: ruby
|
59
|
+
|
60
|
+
@addresses = @client.addresses.list(iso_country: 'AU')
|
61
|
+
@addresses.each do |address|
|
62
|
+
puts address.customer_name
|
63
|
+
end
|
64
|
+
|
65
|
+
Updating an Address
|
66
|
+
-------------------
|
67
|
+
|
68
|
+
All Address attributes other than :attr:`iso_country` can be updated.
|
69
|
+
To create an Address with a different country, see the "Creating an Address" section.
|
70
|
+
|
71
|
+
.. code-block:: ruby
|
72
|
+
|
73
|
+
@sid = 'AD123' # the address you'd like to update
|
74
|
+
@address = @client.addresses.get(@sid)
|
75
|
+
@address.update(customer_name: "Marge Simpson")
|
76
|
+
|
77
|
+
Deleting an Address
|
78
|
+
-------------------
|
79
|
+
|
80
|
+
.. code-block:: ruby
|
81
|
+
|
82
|
+
address_sid = 'AD123'
|
83
|
+
@address = @client.addresses.get(address_sid)
|
84
|
+
@address.delete()
|
85
|
+
|
86
|
+
Listing Dependent Phone Numbers
|
87
|
+
-------------------------------
|
88
|
+
|
89
|
+
Twilio will not permit you to delete an Address if it is the sole
|
90
|
+
Address resource on your account that satisfies the address requirements
|
91
|
+
for one or more of your purchased phone numbers.
|
92
|
+
|
93
|
+
To see which phone numbers depend on a given address:
|
94
|
+
|
95
|
+
.. code-block:: ruby
|
96
|
+
|
97
|
+
address_sid = 'AD123'
|
98
|
+
@address = @client.addresses.get(address_sid)
|
99
|
+
@address.dependent_phone_numbers.list.each do |number|
|
100
|
+
puts number.sid
|
101
|
+
end
|
data/docs/usage/applications.rst
CHANGED
@@ -27,7 +27,7 @@ The following code will print out the :attr:`friendly_name` for each :class:`App
|
|
27
27
|
|
28
28
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
29
29
|
@client.applications.each do |app|
|
30
|
-
|
30
|
+
puts app.friendly_name
|
31
31
|
end
|
32
32
|
|
33
33
|
|
@@ -46,7 +46,7 @@ You can filter applications by FriendlyName
|
|
46
46
|
|
47
47
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
48
48
|
@client.applications.list(friendly_name: 'FOO').each do |app|
|
49
|
-
|
49
|
+
puts app.sid
|
50
50
|
end
|
51
51
|
|
52
52
|
|
data/docs/usage/caller-ids.rst
CHANGED
@@ -20,7 +20,7 @@ Validating a phone number is quick and easy.
|
|
20
20
|
|
21
21
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
22
22
|
@response = @client.outgoing_caller_ids.create(
|
23
|
-
|
23
|
+
phone_number: "+44 9876543212"
|
24
24
|
)
|
25
25
|
puts @response.validation_code
|
26
26
|
|
data/docs/usage/conferences.rst
CHANGED
@@ -23,7 +23,7 @@ Listing Conferences
|
|
23
23
|
@conferences = @client.conferences.list()
|
24
24
|
|
25
25
|
@conferences.each do |conference|
|
26
|
-
|
26
|
+
puts conference.sid
|
27
27
|
end
|
28
28
|
|
29
29
|
|
@@ -46,7 +46,7 @@ will return a list of all in-progress conferences and print their friendly name.
|
|
46
46
|
@conferences = @client.conferences.list(status: "in-progress")
|
47
47
|
|
48
48
|
@conference.each do |conference|
|
49
|
-
|
49
|
+
puts conference.friendly_name
|
50
50
|
end
|
51
51
|
|
52
52
|
|
@@ -67,7 +67,7 @@ Each :class:`Conference` has a :attr:`participants` instance which represents al
|
|
67
67
|
@conference = @client.conferences.get("CF123")
|
68
68
|
|
69
69
|
@conference.participants.list.each.do |paricipant|
|
70
|
-
|
70
|
+
puts participant.sid
|
71
71
|
end
|
72
72
|
|
73
73
|
:class:`Conferences` and :class:`Participants` are subclasses of :class:`ListResource`.
|
@@ -96,13 +96,13 @@ code kicks out the first participant and mutes the rest.
|
|
96
96
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
97
97
|
@participants = @client.conferences.get("CF123").participants.list()
|
98
98
|
|
99
|
-
if @participants.empty?
|
100
|
-
return
|
99
|
+
return if @participants.empty?
|
101
100
|
|
102
101
|
# Kick the first person out
|
103
102
|
@participants.pop().kick()
|
104
103
|
|
105
104
|
# And mute the rest
|
106
105
|
@participants.each do |participant|
|
107
|
-
|
106
|
+
participant.mute()
|
107
|
+
end
|
108
108
|
|
data/docs/usage/errors.rst
CHANGED
@@ -18,12 +18,12 @@ handled appropriately.
|
|
18
18
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
19
19
|
|
20
20
|
begin
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
@client = Twilio::REST::Client.new account_sid, auth_token
|
22
|
+
client.messages.create({
|
23
|
+
from: '+1234567890',
|
24
|
+
to: '+1234567890',
|
25
|
+
body: 'Hello world'
|
26
|
+
})
|
27
27
|
rescue Twilio::REST::RequestError => e
|
28
|
-
|
28
|
+
puts e.message
|
29
29
|
end
|
data/docs/usage/messages.rst
CHANGED
@@ -86,7 +86,8 @@ Retrieving Sent Messages
|
|
86
86
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
87
87
|
|
88
88
|
@client.messages.list.each do |message|
|
89
|
-
|
89
|
+
puts message.body
|
90
|
+
end
|
90
91
|
|
91
92
|
Redacting or Deleting Messages
|
92
93
|
------------------------------
|
@@ -131,6 +132,6 @@ The following will only show messages to "+5466758723" on January 1st, 2011.
|
|
131
132
|
)
|
132
133
|
|
133
134
|
@messages.each do |message|
|
134
|
-
|
135
|
-
|
135
|
+
puts message.body
|
136
|
+
end
|
136
137
|
|
@@ -24,8 +24,9 @@ current :class:`Notification` resources.
|
|
24
24
|
|
25
25
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
26
26
|
|
27
|
-
@client.notifications.list
|
28
|
-
|
27
|
+
@client.notifications.list.each do |notification|
|
28
|
+
puts notification.more_info
|
29
|
+
end
|
29
30
|
|
30
31
|
You can filter transcriptions by :attr:`log` and :attr:`message_date`.
|
31
32
|
The :attr:`log` value is 0 for `ERROR` and 1 for `WARNING`.
|
@@ -42,8 +43,9 @@ The :attr:`log` value is 0 for `ERROR` and 1 for `WARNING`.
|
|
42
43
|
|
43
44
|
ERROR = 0
|
44
45
|
|
45
|
-
@client.notifications.list(log=ERROR).each do |notification
|
46
|
-
|
46
|
+
@client.notifications.list(log=ERROR).each do |notification|
|
47
|
+
puts notification.error_code
|
48
|
+
end
|
47
49
|
|
48
50
|
.. note:: Due to the potentially voluminous amount of data in a notification,
|
49
51
|
the full HTTP request and response data is only returned in the
|
data/docs/usage/phone-calls.rst
CHANGED
@@ -131,7 +131,7 @@ redirect them as necessary
|
|
131
131
|
@calls = @client.calls.list(status: "in-progress")
|
132
132
|
|
133
133
|
@calls.each do |call|
|
134
|
-
|
134
|
+
call.redirect_to("http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient")
|
135
135
|
end
|
136
136
|
|
137
137
|
|
@@ -149,7 +149,7 @@ Ending all live calls is also possible
|
|
149
149
|
@calls = @client.calls.list(status: "in-progress")
|
150
150
|
|
151
151
|
@calls.each do |call|
|
152
|
-
|
152
|
+
call.hangup()
|
153
153
|
end
|
154
154
|
|
155
155
|
Note that :meth:`hangup` will also cancel calls currently queued.
|
@@ -15,7 +15,7 @@ Searching and Buying a Number
|
|
15
15
|
--------------------------------
|
16
16
|
|
17
17
|
Finding numbers to buy couldn't be easier.
|
18
|
-
We first search for a number in area code 530.
|
18
|
+
We first search for a US number in area code 530.
|
19
19
|
Once we find one, we'll purchase it for our account.
|
20
20
|
|
21
21
|
.. code-block:: ruby
|
@@ -27,12 +27,13 @@ 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(area_code: "530")
|
30
|
+
numbers = @client.available_phone_numbers.get('US').list(area_code: "530")
|
31
31
|
|
32
|
-
if numbers
|
33
|
-
|
34
|
-
else
|
35
|
-
|
32
|
+
if numbers.any?
|
33
|
+
numbers[0].purchase()
|
34
|
+
else
|
35
|
+
puts "No numbers in 530 available"
|
36
|
+
end
|
36
37
|
|
37
38
|
|
38
39
|
Local, Toll-Free, and Mobile Numbers
|
@@ -51,13 +52,13 @@ You can search for numbers for a given type.
|
|
51
52
|
.. code-block:: ruby
|
52
53
|
|
53
54
|
# local
|
54
|
-
|
55
|
+
numbers = @client.available_phone_numbers.get('US').local.list()
|
55
56
|
|
56
57
|
# toll free
|
57
|
-
|
58
|
+
numbers = @client.available_phone_numbers.get('US').toll_free.list()
|
58
59
|
|
59
60
|
# mobile
|
60
|
-
|
61
|
+
numbers = @client.available_phone_numbers.get('UK').mobile.list()
|
61
62
|
|
62
63
|
Numbers Containing Words
|
63
64
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
@@ -67,26 +68,16 @@ The following example will find any phone number with "FOO" in it.
|
|
67
68
|
|
68
69
|
.. code-block:: ruby
|
69
70
|
|
70
|
-
|
71
|
+
numbers = @client.available_phone_numbers.get('US').list(contains: "FOO")
|
71
72
|
|
72
73
|
You can use the ''*'' wildcard to match any character. The following example finds any phone number that matches the pattern ''D*D''.
|
73
74
|
|
74
75
|
.. code-block:: ruby
|
75
76
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
International Numbers
|
80
|
-
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
81
|
-
|
82
|
-
By default, the client library will look for US numbers. Set the
|
83
|
-
:data:`country` keyword to a country code of your choice to search for
|
84
|
-
international numbers.
|
85
|
-
|
86
|
-
.. code-block:: ruby
|
87
|
-
|
88
|
-
numbers = @client.available_phone_numbers.list(country: "FR")
|
77
|
+
numbers = @client.available_phone_numbers.get('US').list(contains: "D*D")
|
89
78
|
|
79
|
+
Other Number Searches
|
80
|
+
^^^^^^^^^^^^^^^^^^^^^
|
90
81
|
|
91
82
|
:meth:`PhoneNumbers.search` method has plenty of other options to augment your search :
|
92
83
|
|
@@ -100,6 +91,25 @@ The `AvailablePhoneNumbers REST Resource
|
|
100
91
|
<http://www.twilio.com/docs/api/rest/available-phone-numbers>`_ documentation
|
101
92
|
has more information on the various search options.
|
102
93
|
|
94
|
+
Numbers Requiring Addresses
|
95
|
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
96
|
+
|
97
|
+
Some phone numbers require you to have an address on file with Twilio to satisfy legal
|
98
|
+
requirements before they can be purchased. By default, the client library will
|
99
|
+
include numbers in the result lists regardless of their address requirements; you can
|
100
|
+
filter these numbers out when searching for phone numbers to purchase.
|
101
|
+
|
102
|
+
.. code-block:: ruby
|
103
|
+
|
104
|
+
# Exclude all numbers requiring addresses
|
105
|
+
numbers = @client.available_phone_numbers.get('AU').list(exclude_all_address_required: true)
|
106
|
+
|
107
|
+
# Exclude numbers requiring local addresses
|
108
|
+
numbers = @client.available_phone_numbers.get('AU').list(exclude_local_address_required: true)
|
109
|
+
|
110
|
+
# Exclude numbers requiring foreign addresses
|
111
|
+
numbers = @client.available_phone_numbers.get('AU').list(exclude_foreign_address_required: true)
|
112
|
+
|
103
113
|
|
104
114
|
Buying a Number
|
105
115
|
---------------
|
data/docs/usage/queues.rst
CHANGED
@@ -22,10 +22,10 @@ Listing Queues
|
|
22
22
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
23
23
|
|
24
24
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
25
|
-
@queues = @client.queues.list
|
25
|
+
@queues = @client.queues.list
|
26
26
|
|
27
27
|
@queues.each do |queue|
|
28
|
-
|
28
|
+
puts queue.sid
|
29
29
|
end
|
30
30
|
|
31
31
|
|
@@ -47,7 +47,7 @@ represents all current calls in the queue.
|
|
47
47
|
@queue = @client.queues.get("QU123")
|
48
48
|
|
49
49
|
@queue.members.list().each do |member|
|
50
|
-
|
50
|
+
puts member.call_sid
|
51
51
|
end
|
52
52
|
|
53
53
|
|
data/docs/usage/recordings.rst
CHANGED
@@ -36,10 +36,11 @@ for each :class:`Recording`.
|
|
36
36
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
37
37
|
|
38
38
|
@client.recordings.list().each do |recording|
|
39
|
-
|
39
|
+
puts recording.duration
|
40
|
+
end
|
40
41
|
|
41
42
|
You can filter recordings by CallSid by passing the Sid as :attr:`call`.
|
42
|
-
Filter recordings using :attr:`
|
43
|
+
Filter recordings using :attr:`DateCreated<` and :attr:`DateCreated>` dates.
|
43
44
|
|
44
45
|
The following will only show recordings made before January 1, 2011.
|
45
46
|
|
@@ -52,9 +53,9 @@ The following will only show recordings made before January 1, 2011.
|
|
52
53
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
53
54
|
|
54
55
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
55
|
-
@client.recordings.list(
|
56
|
-
|
57
|
-
|
56
|
+
@client.recordings.list('DateCreated<' => '2011-01-01').each do |recording|
|
57
|
+
puts recording.duration
|
58
|
+
end
|
58
59
|
|
59
60
|
Deleting Recordings
|
60
61
|
---------------------
|
@@ -92,5 +93,6 @@ with this recording.
|
|
92
93
|
@recording = @client.recordings.get("RC123")
|
93
94
|
|
94
95
|
@recording.transcriptions.list().each do |transcription|
|
95
|
-
|
96
|
+
puts transcription.transcription_text
|
97
|
+
end
|
96
98
|
|
data/docs/usage/sip.rst
CHANGED
@@ -95,7 +95,7 @@ associate them. To do this, create an :class:`IpAccessControlListMapping`.
|
|
95
95
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
96
96
|
|
97
97
|
@ip_acl_mapping = @client.sip.domains.get(
|
98
|
-
|
98
|
+
"SD456", # SIP Domain sid
|
99
99
|
).ip_access_control_list_mappings.create(
|
100
100
|
ip_access_control_list_sid: "AL789"
|
101
101
|
)
|
@@ -27,5 +27,6 @@ The following code will print out the length of each :class:`Transcription`.
|
|
27
27
|
|
28
28
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
29
29
|
@client.transcriptions.list().each do |transcription|
|
30
|
-
|
30
|
+
puts transcription.duration
|
31
|
+
end
|
31
32
|
|
data/docs/usage/twiml.rst
CHANGED
@@ -18,7 +18,7 @@ which returns raw TwiML.
|
|
18
18
|
require 'twilio-ruby'
|
19
19
|
|
20
20
|
Twilio::TwiML::Response.new do |r|
|
21
|
-
|
21
|
+
r.Say "Hello"
|
22
22
|
end.text
|
23
23
|
|
24
24
|
.. code-block:: xml
|
@@ -35,14 +35,14 @@ All attributes are keyword arguments.
|
|
35
35
|
require 'twilio-ruby'
|
36
36
|
|
37
37
|
Twilio::TwiML::Response.new do |r|
|
38
|
-
|
38
|
+
r.Play "https://api.twilio.com/cowbell.mp3", loop: 5
|
39
39
|
end.text
|
40
40
|
|
41
41
|
.. code-block:: xml
|
42
42
|
|
43
43
|
<?xml version="1.0" encoding="utf-8"?>
|
44
44
|
<Response>
|
45
|
-
|
45
|
+
<Play loop="3">https://api.twilio.com/cowbell.mp3</Play>
|
46
46
|
<Response>
|
47
47
|
|
48
48
|
Any example of nesting nouns in verbs
|
@@ -52,10 +52,10 @@ Any example of nesting nouns in verbs
|
|
52
52
|
require 'twilio-ruby'
|
53
53
|
|
54
54
|
Twilio::TwiML::Response.new do |r|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
r.Say "hello"
|
56
|
+
r.Gather finishOnKey: => 4 do |g|
|
57
|
+
g.Say "world"
|
58
|
+
end
|
59
59
|
end.text
|
60
60
|
|
61
61
|
which returns the following
|
data/docs/usage/validation.rst
CHANGED
@@ -48,9 +48,9 @@ actually from Twilio.
|
|
48
48
|
signature = "HpS7PBa1Agvt4OtO+wZp75IuQa0=" # will look something like that
|
49
49
|
|
50
50
|
if @validator.validate(url, post_vars, signature)
|
51
|
-
|
51
|
+
puts "Confirmed to have come from Twilio."
|
52
52
|
else
|
53
|
-
|
53
|
+
puts "NOT VALID. It might have been spoofed!"
|
54
54
|
end
|
55
55
|
|
56
56
|
Trailing Slashes
|
@@ -29,7 +29,7 @@ module Rack
|
|
29
29
|
request = Rack::Request.new(env)
|
30
30
|
original_url = request.url
|
31
31
|
params = request.post? ? request.POST : {}
|
32
|
-
signature = env['HTTP_X_TWILIO_SIGNATURE']
|
32
|
+
signature = env['HTTP_X_TWILIO_SIGNATURE'] || ""
|
33
33
|
if validator.validate(original_url, params, signature)
|
34
34
|
@app.call(env)
|
35
35
|
else
|
data/lib/twilio-ruby.rb
CHANGED
@@ -60,6 +60,8 @@ require 'twilio-ruby/rest/recordings'
|
|
60
60
|
require 'twilio-ruby/rest/transcriptions'
|
61
61
|
require 'twilio-ruby/rest/tokens'
|
62
62
|
require 'twilio-ruby/rest/notifications'
|
63
|
+
require 'twilio-ruby/rest/addresses'
|
64
|
+
require 'twilio-ruby/rest/addresses/dependent_phone_numbers'
|
63
65
|
require 'twilio-ruby/rest/client'
|
64
66
|
require 'rack/twilio_webhook_authentication'
|
65
67
|
|
@@ -9,7 +9,7 @@ module Twilio
|
|
9
9
|
:calls, :outgoing_caller_ids, :conferences, :sms, :recordings,
|
10
10
|
:transcriptions, :notifications, :applications, :connect_apps,
|
11
11
|
:authorized_connect_apps, :queues, :usage, :messages, :media, :sip,
|
12
|
-
:tokens
|
12
|
+
:tokens, :addresses
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -7,7 +7,8 @@ module Twilio
|
|
7
7
|
custom_names = {
|
8
8
|
'Media' => 'MediaInstance',
|
9
9
|
'IpAddresses' => 'IpAddress',
|
10
|
-
'Feedback' => 'FeedbackInstance'
|
10
|
+
'Feedback' => 'FeedbackInstance',
|
11
|
+
'Addresses' => 'Address'
|
11
12
|
}
|
12
13
|
@path, @client = path, client
|
13
14
|
resource_name = self.class.name.split('::')[-1]
|
data/lib/twilio-ruby/version.rb
CHANGED
data/spec/rest/account_spec.rb
CHANGED
@@ -78,4 +78,12 @@ describe Twilio::REST::Account do
|
|
78
78
|
'someUri/Tokens'
|
79
79
|
)
|
80
80
|
end
|
81
|
+
|
82
|
+
it 'sets up an addresses resources object' do
|
83
|
+
expect(@account).to respond_to(:addresses)
|
84
|
+
expect(@account.addresses.instance_variable_get('@path')).to eq(
|
85
|
+
'someUri/Addresses'
|
86
|
+
)
|
87
|
+
end
|
88
|
+
|
81
89
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Twilio::REST::Address do
|
4
|
+
it 'should set up a dependent phone numbers resources object' do
|
5
|
+
address = Twilio::REST::Address.new('someUri', 'someClient')
|
6
|
+
expect(address).to respond_to(:dependent_phone_numbers)
|
7
|
+
expect(address.dependent_phone_numbers.instance_variable_get('@path')).to eq(
|
8
|
+
'someUri/DependentPhoneNumbers'
|
9
|
+
)
|
10
|
+
end
|
11
|
+
end
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twilio-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.14.
|
4
|
+
version: 3.14.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Benton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.3.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.3.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: builder
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 2.1.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.1.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: jwt
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 1.0.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.0.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.5'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.5'
|
69
69
|
description: A simple library for communicating with the Twilio REST API, building
|
@@ -76,8 +76,8 @@ extra_rdoc_files:
|
|
76
76
|
- README.md
|
77
77
|
- LICENSE.md
|
78
78
|
files:
|
79
|
-
- .gitignore
|
80
|
-
- .travis.yml
|
79
|
+
- ".gitignore"
|
80
|
+
- ".travis.yml"
|
81
81
|
- AUTHORS.md
|
82
82
|
- CHANGES.md
|
83
83
|
- Gemfile
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- docs/make.bat
|
107
107
|
- docs/src/pip-delete-this-directory.txt
|
108
108
|
- docs/usage/accounts.rst
|
109
|
+
- docs/usage/addresses.rst
|
109
110
|
- docs/usage/applications.rst
|
110
111
|
- docs/usage/basics.rst
|
111
112
|
- docs/usage/caller-ids.rst
|
@@ -127,6 +128,8 @@ files:
|
|
127
128
|
- lib/rack/twilio_webhook_authentication.rb
|
128
129
|
- lib/twilio-ruby.rb
|
129
130
|
- lib/twilio-ruby/rest/accounts.rb
|
131
|
+
- lib/twilio-ruby/rest/addresses.rb
|
132
|
+
- lib/twilio-ruby/rest/addresses/dependent_phone_numbers.rb
|
130
133
|
- lib/twilio-ruby/rest/applications.rb
|
131
134
|
- lib/twilio-ruby/rest/authorized_connect_apps.rb
|
132
135
|
- lib/twilio-ruby/rest/available_phone_numbers.rb
|
@@ -181,6 +184,7 @@ files:
|
|
181
184
|
- lib/twilio-ruby/version.rb
|
182
185
|
- spec/rack/twilio_webhook_authentication_spec.rb
|
183
186
|
- spec/rest/account_spec.rb
|
187
|
+
- spec/rest/address_spec.rb
|
184
188
|
- spec/rest/call_feedback_spec.rb
|
185
189
|
- spec/rest/call_feedback_summary_spec.rb
|
186
190
|
- spec/rest/call_spec.rb
|
@@ -207,27 +211,27 @@ licenses:
|
|
207
211
|
metadata: {}
|
208
212
|
post_install_message:
|
209
213
|
rdoc_options:
|
210
|
-
- --line-numbers
|
211
|
-
- --inline-source
|
212
|
-
- --title
|
214
|
+
- "--line-numbers"
|
215
|
+
- "--inline-source"
|
216
|
+
- "--title"
|
213
217
|
- twilio-ruby
|
214
|
-
- --main
|
218
|
+
- "--main"
|
215
219
|
- README.md
|
216
220
|
require_paths:
|
217
221
|
- lib
|
218
222
|
required_ruby_version: !ruby/object:Gem::Requirement
|
219
223
|
requirements:
|
220
|
-
- -
|
224
|
+
- - ">="
|
221
225
|
- !ruby/object:Gem::Version
|
222
226
|
version: 1.9.3
|
223
227
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
224
228
|
requirements:
|
225
|
-
- -
|
229
|
+
- - ">="
|
226
230
|
- !ruby/object:Gem::Version
|
227
231
|
version: '0'
|
228
232
|
requirements: []
|
229
233
|
rubyforge_project:
|
230
|
-
rubygems_version: 2.
|
234
|
+
rubygems_version: 2.2.2
|
231
235
|
signing_key:
|
232
236
|
specification_version: 4
|
233
237
|
summary: A simple library for communicating with the Twilio REST API, building TwiML,
|
@@ -235,6 +239,7 @@ summary: A simple library for communicating with the Twilio REST API, building T
|
|
235
239
|
test_files:
|
236
240
|
- spec/rack/twilio_webhook_authentication_spec.rb
|
237
241
|
- spec/rest/account_spec.rb
|
242
|
+
- spec/rest/address_spec.rb
|
238
243
|
- spec/rest/call_feedback_spec.rb
|
239
244
|
- spec/rest/call_feedback_summary_spec.rb
|
240
245
|
- spec/rest/call_spec.rb
|