twilio-ruby 3.12.1 → 3.12.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGES.md +24 -1
- data/README.md +9 -9
- data/docs/getting-started.rst +3 -3
- data/docs/usage/applications.rst +5 -5
- data/docs/usage/basics.rst +4 -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/transcriptions.rst +1 -1
- data/examples/print-call-log.rb +1 -1
- data/lib/twilio-ruby/rest/client.rb +29 -3
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/rest/call_feedback_spec.rb +2 -2
- data/spec/rest/call_feedback_summary_spec.rb +3 -3
- data/spec/rest/client_spec.rb +15 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OWM4YzFhOGQ2NjI1N2Q3NmQ1YjE0YzNlNDkxNjg5NTUzMzYzNzI4Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGZjMjdmZTFjMWE4YzhlYWJjNGQ4NTkzMTkzMjY2NDgyMDIwYWRjMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTQ2NDhjZDVhOTc0NTJlYjRkY2FlZTEzMDc1ZmQ5NzM1M2QxNWM0YmU2OThm
|
10
|
+
NzRiNzQzNTA1NWU4YzlhMmE3ZDkxNDJlMzJlOWEwYzcyZmVlYTdhODZlY2Mz
|
11
|
+
Mzc1ZDk5MzQxODQzNzY5MTY1ZTE0NzkyNGRkZmU3YjcyNGRhOGM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWM5NTE2Y2U0ZmUwNWFjOWQ2MmRjYWUzMWNjYmIxMDc5ZmM0YmQ4ZTQxZjQz
|
14
|
+
MWU2NTU3YjM4OWI5OWNiMjM1MTkzY2VlNmU4Y2I4NDMwZmM3NjA4MWEwNDQx
|
15
|
+
ZDdmMzcxYzU5YTA1MTI2NTIxZTViYTgzYmNlMjY4MzQ1ZGJhZTQ=
|
data/CHANGES.md
CHANGED
@@ -1,13 +1,33 @@
|
|
1
1
|
twilio-ruby changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
+
Version 3.12.2
|
5
|
+
--------------
|
6
|
+
|
7
|
+
Released August 29, 2014
|
8
|
+
|
9
|
+
- `client.account.{resource}` can now be accessed with `client.{resource}`
|
10
|
+
- Many doc updates
|
11
|
+
|
12
|
+
Version 3.12.1
|
13
|
+
--------------
|
14
|
+
|
15
|
+
Released August 26, 2014
|
16
|
+
|
17
|
+
- Add support for new call feedback endpoints
|
18
|
+
|
4
19
|
Version 3.12.0
|
20
|
+
--------------
|
21
|
+
|
22
|
+
Released August 18, 2014
|
23
|
+
|
5
24
|
- Add Rack middleware for Twilio request-signature validation
|
6
25
|
- Upgrade dependencies and clean up project files
|
7
26
|
- Documentation fixes
|
8
27
|
- Add `text` alias for `to_xml` method on TwiML generator objects
|
9
28
|
|
10
29
|
Version 3.11.6
|
30
|
+
--------------
|
11
31
|
|
12
32
|
Released July 25, 2014
|
13
33
|
|
@@ -16,14 +36,16 @@ Released July 25, 2014
|
|
16
36
|
- Updated to RSpec 3 syntax.
|
17
37
|
|
18
38
|
Version 3.11.5
|
39
|
+
--------------
|
19
40
|
|
20
|
-
Released February 4
|
41
|
+
Released February 4, 2014
|
21
42
|
|
22
43
|
- Add bangs for twilify to indicate it's a dangerous operation.
|
23
44
|
- Remove reference to deprecated OpenSSL Digest parameter.
|
24
45
|
- Encode dates properly before passing them to the Twilio API.
|
25
46
|
|
26
47
|
Version 3.11.4
|
48
|
+
--------------
|
27
49
|
|
28
50
|
Released October 21, 2013
|
29
51
|
|
@@ -32,6 +54,7 @@ Released October 21, 2013
|
|
32
54
|
both IncomingPhoneNumbers and AvailablePhoneNumbers.
|
33
55
|
|
34
56
|
Version 3.11.3
|
57
|
+
--------------
|
35
58
|
|
36
59
|
Released October 15, 2013
|
37
60
|
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ A module for using the Twilio REST API and generating valid [TwiML](http://www.t
|
|
11
11
|
To install using [Bundler][bundler] grab the latest stable version:
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
gem 'twilio-ruby', '~> 3.
|
14
|
+
gem 'twilio-ruby', '~> 3.12'
|
15
15
|
```
|
16
16
|
|
17
17
|
To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
|
@@ -47,7 +47,7 @@ auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
|
|
47
47
|
### Send an SMS
|
48
48
|
|
49
49
|
``` ruby
|
50
|
-
@client.
|
50
|
+
@client.messages.create(
|
51
51
|
:from => '+14159341234',
|
52
52
|
:to => '+16105557069',
|
53
53
|
:body => 'Hey there!'
|
@@ -57,7 +57,7 @@ auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
|
|
57
57
|
### Send an MMS
|
58
58
|
|
59
59
|
``` ruby
|
60
|
-
@client.
|
60
|
+
@client.messages.create(
|
61
61
|
:from => '+14159341234',
|
62
62
|
:to => '+16105557069',
|
63
63
|
:body => 'Hey there!',
|
@@ -69,7 +69,7 @@ auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
|
|
69
69
|
|
70
70
|
``` ruby
|
71
71
|
# make a new outgoing call
|
72
|
-
@call = @client.
|
72
|
+
@call = @client.calls.create(
|
73
73
|
:from => '+14159341234',
|
74
74
|
:to => '+18004567890',
|
75
75
|
:url => 'http://example.com/call-handler',
|
@@ -79,7 +79,7 @@ auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
|
|
79
79
|
@call.cancel
|
80
80
|
|
81
81
|
# if you have the call sid, you can fetch a call object via:
|
82
|
-
@call = @client.
|
82
|
+
@call = @client.calls.get('CA386025c9bf5d6052a1d1ea42b4d16662')
|
83
83
|
|
84
84
|
# redirect an in-progress call
|
85
85
|
@call.redirect_to('http://example.com/call-redirect')
|
@@ -92,21 +92,21 @@ auth_token = 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
|
|
92
92
|
|
93
93
|
``` ruby
|
94
94
|
# list calls made or received on or after May 13, 2013
|
95
|
-
@client.
|
95
|
+
@client.calls.list("start_time>" => "2013-05-13") # Notice we omit the "=" in the "start_time>=" parameter because it is automatically added
|
96
96
|
```
|
97
97
|
|
98
98
|
### Buy a Phone Number
|
99
99
|
|
100
100
|
``` ruby
|
101
101
|
# print some available numbers
|
102
|
-
@numbers = @client.
|
102
|
+
@numbers = @client.available_phone_numbers.get('US').local.list(
|
103
103
|
:contains => 'AWESOME'
|
104
104
|
)
|
105
105
|
@numbers.each {|num| puts num.phone_number}
|
106
106
|
|
107
107
|
# buy the first one
|
108
108
|
@number = @numbers[0].phone_number
|
109
|
-
@client.
|
109
|
+
@client.incoming_phone_numbers.create(:phone_number => @number)
|
110
110
|
```
|
111
111
|
|
112
112
|
## Getting Started With Client Capability Tokens
|
@@ -200,4 +200,4 @@ directory. Also for thoose upgrading, the [upgrade guide][upgrade] is available
|
|
200
200
|
[travis]: http://travis-ci.org/twilio/twilio-ruby
|
201
201
|
[codeclimate]: https://codeclimate.com/github/twilio/twilio-ruby
|
202
202
|
[jruby]: http://www.jruby.org
|
203
|
-
[rubinius]: http://rubini.us
|
203
|
+
[rubinius]: http://rubini.us
|
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
@@ -43,7 +43,7 @@ The :class:`Client` gives you access to various list resources.
|
|
43
43
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
44
44
|
|
45
45
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
46
|
-
@calls = @client.
|
46
|
+
@calls = @client.calls.list()
|
47
47
|
|
48
48
|
:meth:`ListResource.list` accepts paging arguments.
|
49
49
|
The following will return page 3 with page size of 25.
|
@@ -57,7 +57,7 @@ The following will return page 3 with page size of 25.
|
|
57
57
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
58
58
|
|
59
59
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
60
|
-
@calls = @client.
|
60
|
+
@calls = @client.calls.list(:page=>3, :page_size=>25)
|
61
61
|
|
62
62
|
|
63
63
|
Get an Individual Resource
|
@@ -76,7 +76,7 @@ Provide the :attr:`sid` of the resource you'd like to get.
|
|
76
76
|
|
77
77
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
78
78
|
|
79
|
-
@call = @client.
|
79
|
+
@call = @client.calls.get("CA123")
|
80
80
|
puts @call.to
|
81
81
|
|
82
82
|
|
@@ -97,6 +97,6 @@ and then call :meth:`delete` on it.
|
|
97
97
|
|
98
98
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
99
99
|
|
100
|
-
@recording = @client.
|
100
|
+
@recording = @client.recordings.get("RC123")
|
101
101
|
@recording.delete()
|
102
102
|
|
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,
|
data/docs/usage/phone-calls.rst
CHANGED
@@ -25,7 +25,7 @@ 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.
|
28
|
+
@call = @client.calls.create({:to => "9991231234",
|
29
29
|
:from => "9991231234",
|
30
30
|
:url => "http://foo.com/call.xml"})
|
31
31
|
puts @call.length
|
@@ -48,7 +48,7 @@ you can use the client to retrieve that record.
|
|
48
48
|
|
49
49
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
50
50
|
sid = "CA12341234"
|
51
|
-
@call = @client.
|
51
|
+
@call = @client.calls.get(sid)
|
52
52
|
|
53
53
|
|
54
54
|
Accessing Specific Call Resources
|
@@ -69,7 +69,7 @@ just like the :class:`Calls` resource itself.
|
|
69
69
|
|
70
70
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
71
71
|
sid = "CA12341234"
|
72
|
-
@call = @client.
|
72
|
+
@call = @client.calls.get(sid)
|
73
73
|
|
74
74
|
puts @call.notifications.list()
|
75
75
|
puts @call.recordings.list()
|
@@ -109,7 +109,7 @@ redirect them as necessary
|
|
109
109
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
110
110
|
|
111
111
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
112
|
-
@calls = @client.
|
112
|
+
@calls = @client.calls.list({:status => "in-progress"})
|
113
113
|
|
114
114
|
@calls.each do |call|
|
115
115
|
call.redirect_to("http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient")
|
@@ -127,7 +127,7 @@ Ending all live calls is also possible
|
|
127
127
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
128
128
|
|
129
129
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
130
|
-
@calls = @client.
|
130
|
+
@calls = @client.calls.list({:status => "in-progress"})
|
131
131
|
|
132
132
|
@calls.each do |call|
|
133
133
|
call.hangup()
|
@@ -148,7 +148,7 @@ resource to update the record without having to use :meth:`get` first.
|
|
148
148
|
|
149
149
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
150
150
|
sid = "CA12341234"
|
151
|
-
@client.
|
151
|
+
@client.calls.get(sid).redirect_to("http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient")
|
152
152
|
|
153
153
|
Hanging up the call also works.
|
154
154
|
|
@@ -162,5 +162,5 @@ Hanging up the call also works.
|
|
162
162
|
|
163
163
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
164
164
|
sid = "CA12341234"
|
165
|
-
@client.
|
165
|
+
@client.calls.get(sid).hangup()
|
166
166
|
|
@@ -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.
|
30
|
+
numbers = @client.available_phone_numbers.list(:area_code=>"530")
|
31
31
|
|
32
32
|
if numbers:
|
33
33
|
numbers[0].purchase()
|
@@ -51,13 +51,13 @@ You can search for numbers for a given type.
|
|
51
51
|
.. code-block:: ruby
|
52
52
|
|
53
53
|
# local
|
54
|
-
numbers = @client.
|
54
|
+
numbers = @client.available_phone_numbers.local.list()
|
55
55
|
|
56
56
|
# toll free
|
57
|
-
numbers = @client.
|
57
|
+
numbers = @client.available_phone_numbers.toll_free.list()
|
58
58
|
|
59
59
|
# mobile
|
60
|
-
numbers = @client.
|
60
|
+
numbers = @client.available_phone_numbers.mobile.list()
|
61
61
|
|
62
62
|
Numbers Containing Words
|
63
63
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
@@ -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.
|
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.
|
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.
|
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,7 @@ 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.
|
118
|
+
@number = @client.available_phone_numbers.purchase({:phone_number => "+15305431234"})
|
119
119
|
|
120
120
|
However, it's easier to purchase numbers after finding them using search (as
|
121
121
|
shown in the first example).
|
@@ -138,9 +138,9 @@ listed in the `IncomingPhoneNumbers Resource documentation
|
|
138
138
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
139
139
|
|
140
140
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
141
|
-
@client.
|
142
|
-
number.update({:voice_url => "http://twimlets.com/holdmusic?" +
|
143
|
-
"Bucket=com.twilio.music.ambient",
|
141
|
+
@client.available_phone_numbers.list(api_version="2010-04-01").each do |number|
|
142
|
+
number.update({:voice_url => "http://twimlets.com/holdmusic?" +
|
143
|
+
"Bucket=com.twilio.music.ambient",
|
144
144
|
:status_callback => "http://example.com/callback"})
|
145
145
|
|
146
146
|
|
@@ -161,7 +161,7 @@ An :class:`Application` encapsulates all necessary URLs for use with phone numbe
|
|
161
161
|
|
162
162
|
phone_sid = "PNXXXXXXXXXXXXXXXXX"
|
163
163
|
|
164
|
-
@number = @client.
|
164
|
+
@number = @client.available_phone_numbers.get(phone_sid)
|
165
165
|
@number.update(:sms_application_sid => "APXXXXXXXXXXXXXXXXXX")
|
166
166
|
|
167
167
|
See :doc:`/usage/applications` for instructions on updating and maintaining Applications.
|
data/docs/usage/queues.rst
CHANGED
@@ -22,8 +22,8 @@ Listing Queues
|
|
22
22
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
23
23
|
|
24
24
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
25
|
-
@queues = @client.
|
26
|
-
|
25
|
+
@queues = @client.queues.list()
|
26
|
+
|
27
27
|
@queues.each do |queue|
|
28
28
|
puts queue.sid
|
29
29
|
end
|
@@ -44,7 +44,7 @@ represents all current calls in the queue.
|
|
44
44
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
45
45
|
|
46
46
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
47
|
-
@queue = @client.
|
47
|
+
@queue = @client.queues.get("QU123")
|
48
48
|
|
49
49
|
@queue.members.list().each do |member|
|
50
50
|
print member.call_sid
|
@@ -74,8 +74,8 @@ first call in the queue.
|
|
74
74
|
|
75
75
|
queue_sid = "QUAAAAAAAAAAAAA"
|
76
76
|
call_sid = "CAXXXXXXXXXXXXXX"
|
77
|
-
|
78
|
-
@members = @client.
|
77
|
+
|
78
|
+
@members = @client.queues.get(queue_sid).members
|
79
79
|
|
80
80
|
# Get the first call in the queue
|
81
81
|
puts members.front.date_enqueued
|
@@ -106,7 +106,7 @@ default values are 'Front' and 'GET'
|
|
106
106
|
|
107
107
|
queue_sid = "QUAAAAAAAAAAAAA"
|
108
108
|
|
109
|
-
@members = @client.
|
109
|
+
@members = @client.queues.get(queue_sid).members
|
110
110
|
|
111
111
|
# Dequeue the first call in the queue
|
112
112
|
puts @members.dequeue('http://www.twilio.com/welcome/call')
|
data/docs/usage/recordings.rst
CHANGED
@@ -14,7 +14,7 @@ Audio Formats
|
|
14
14
|
|
15
15
|
Each :class:`Recording` has a few special methods. To get the url
|
16
16
|
for the wav format of this recording, use :meth:`Recording.wav`. For the
|
17
|
-
mp3 format, use :meth:`Recording.mp3`. To make requests for either of
|
17
|
+
mp3 format, use :meth:`Recording.mp3`. To make requests for either of
|
18
18
|
these formats use the same method with a '!' appended. These methods
|
19
19
|
both take a block to be executed as soon as the response returns.
|
20
20
|
|
@@ -35,7 +35,7 @@ for each :class:`Recording`.
|
|
35
35
|
|
36
36
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
37
37
|
|
38
|
-
@client.
|
38
|
+
@client.recordings.list().each do |recording|
|
39
39
|
puts recording.duration
|
40
40
|
|
41
41
|
You can filter recordings by CallSid by passing the Sid as :attr:`call`.
|
@@ -52,7 +52,7 @@ The following will only show recordings made before January 1, 2011.
|
|
52
52
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
53
53
|
|
54
54
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
55
|
-
@client.
|
55
|
+
@client.recordings.list(before=date(2011,1,1)).each do |recording|:
|
56
56
|
puts recording.duration
|
57
57
|
|
58
58
|
|
@@ -70,7 +70,7 @@ The :class:`Recordings` resource allows you to delete unnecessary recordings.
|
|
70
70
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
71
71
|
|
72
72
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
73
|
-
@client.
|
73
|
+
@client.recordings.get("RC123").delete()
|
74
74
|
|
75
75
|
|
76
76
|
Accessing Related Transcptions
|
@@ -89,7 +89,7 @@ with this recording.
|
|
89
89
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
90
90
|
|
91
91
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
92
|
-
@recording = @client.
|
92
|
+
@recording = @client.recordings.get("RC123")
|
93
93
|
|
94
94
|
@recording.transcriptions.list().each do |transcription|
|
95
95
|
puts transcription.transcription_text
|
data/docs/usage/sip.rst
CHANGED
@@ -26,7 +26,7 @@ under sip.twilio.com.
|
|
26
26
|
|
27
27
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
28
28
|
|
29
|
-
@domain = @client.
|
29
|
+
@domain = @client.sip.domains.create(
|
30
30
|
{:friendly_name => "The Office Domain",
|
31
31
|
:voice_url => "http://example.com/voice",
|
32
32
|
:domain_name => "dunder-mifflin-scranton.sip.twilio.com",}
|
@@ -38,7 +38,7 @@ Creating a new IpAccessControlList
|
|
38
38
|
|
39
39
|
To control access to your new domain, you'll need to explicitly grant access
|
40
40
|
to individual ip addresses. To do this, you'll first need to create an
|
41
|
-
:class:`IpAccessControlList` to hold the ip addresses you wish to allow.
|
41
|
+
:class:`IpAccessControlList` to hold the ip addresses you wish to allow.
|
42
42
|
|
43
43
|
.. code-block:: ruby
|
44
44
|
|
@@ -50,7 +50,7 @@ to individual ip addresses. To do this, you'll first need to create an
|
|
50
50
|
|
51
51
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
52
52
|
|
53
|
-
@ip_acl = @client.
|
53
|
+
@ip_acl = @client.sip.ip_access_control_lists.create(
|
54
54
|
{:friendly_name => "The Office IpAccessControlList",}
|
55
55
|
)
|
56
56
|
puts @ip_acl.sid
|
@@ -70,7 +70,7 @@ Now it's time to add an :class:`IpAddress` to your new :class:`IpAccessControlLi
|
|
70
70
|
|
71
71
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
72
72
|
|
73
|
-
@ip_address = @client.
|
73
|
+
@ip_address = @client.sip.ip_access_control_lists.get(
|
74
74
|
"AL456", # IpAccessControlList sid
|
75
75
|
).ip_addresses.create(
|
76
76
|
{:friendly_name => "Dwights's Computer",
|
@@ -94,7 +94,7 @@ associate them. To do this, create an :class:`IpAccessControlListMapping`.
|
|
94
94
|
|
95
95
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
96
96
|
|
97
|
-
@ip_acl_mapping = @client.
|
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"})
|
@@ -26,6 +26,6 @@ The following code will print out the length of each :class:`Transcription`.
|
|
26
26
|
auth_token = "YYYYYYYYYYYYYYYYYY"
|
27
27
|
|
28
28
|
@client = Twilio::REST::Client.new account_sid, auth_token
|
29
|
-
@client.
|
29
|
+
@client.transcriptions.list().each do |transcription|
|
30
30
|
puts transcription.duration
|
31
31
|
|
data/examples/print-call-log.rb
CHANGED
@@ -28,6 +28,12 @@ module Twilio
|
|
28
28
|
#
|
29
29
|
# @client.account.calls
|
30
30
|
#
|
31
|
+
# For convenience, the resources of the default account are also available
|
32
|
+
# on the client object. So the following call is equivalent to the example
|
33
|
+
# above
|
34
|
+
#
|
35
|
+
# @client.calls
|
36
|
+
#
|
31
37
|
# represents an account's call list.
|
32
38
|
#
|
33
39
|
# ==== @client.accounts
|
@@ -48,8 +54,8 @@ module Twilio
|
|
48
54
|
API_VERSION = '2010-04-01'
|
49
55
|
|
50
56
|
# 1.8.7 doesn't have the RUBY_ENGINE constant.
|
51
|
-
if defined?(RUBY_ENGINE)
|
52
|
-
engine = RUBY_ENGINE
|
57
|
+
if defined?(RUBY_ENGINE)
|
58
|
+
engine = RUBY_ENGINE
|
53
59
|
else
|
54
60
|
engine = 'ruby'
|
55
61
|
end
|
@@ -173,6 +179,26 @@ module Twilio
|
|
173
179
|
end
|
174
180
|
end
|
175
181
|
|
182
|
+
##
|
183
|
+
# Delegate account methods from the client. This saves having to call
|
184
|
+
# <tt>client.account</tt> every time for resources on the default
|
185
|
+
# account.
|
186
|
+
def method_missing(method_name, *args, &block)
|
187
|
+
if account.respond_to?(method_name)
|
188
|
+
account.send(method_name, *args, &block)
|
189
|
+
else
|
190
|
+
super
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def respond_to?(method_name, include_private=false)
|
195
|
+
if account.respond_to?(method_name, include_private)
|
196
|
+
true
|
197
|
+
else
|
198
|
+
super
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
176
202
|
private
|
177
203
|
|
178
204
|
##
|
@@ -186,7 +212,7 @@ module Twilio
|
|
186
212
|
@connection.open_timeout = @config[:timeout]
|
187
213
|
@connection.read_timeout = @config[:timeout]
|
188
214
|
end
|
189
|
-
|
215
|
+
|
190
216
|
##
|
191
217
|
# Set up the ssl properties of the <tt>@connection</tt> Net::HTTP object.
|
192
218
|
# This is a private method documented for completeness.
|
data/lib/twilio-ruby/version.rb
CHANGED
@@ -6,7 +6,7 @@ describe Twilio::REST::Feedback do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'sets up a feedback resources object' do
|
9
|
-
@call.
|
10
|
-
@call.feedback.instance_variable_get('@path').
|
9
|
+
expect(@call).to respond_to(:feedback)
|
10
|
+
expect(@call.feedback.instance_variable_get('@path')).to eq('someUri/Feedback')
|
11
11
|
end
|
12
12
|
end
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Twilio::REST::FeedbackSummary do
|
4
4
|
it 'creates a feedback summary object' do
|
5
5
|
calls = Twilio::REST::Calls.new('someUri', 'someClient')
|
6
|
-
calls.
|
7
|
-
calls.feedback_summary.instance_variable_get('@path').
|
6
|
+
expect(calls).to respond_to(:feedback_summary)
|
7
|
+
expect(calls.feedback_summary.instance_variable_get('@path')).to eq('someUri/FeedbackSummary')
|
8
8
|
end
|
9
|
-
end
|
9
|
+
end
|
data/spec/rest/client_spec.rb
CHANGED
@@ -20,7 +20,7 @@ describe Twilio::REST::Client do
|
|
20
20
|
expect(twilio.account_sid).to eq('someSid')
|
21
21
|
expect(twilio.instance_variable_get('@auth_token')).to eq('someToken')
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
it 'should set up the proper default http ssl connection' do
|
25
25
|
twilio = Twilio::REST::Client.new('someSid', 'someToken')
|
26
26
|
connection = twilio.instance_variable_get('@connection')
|
@@ -28,7 +28,7 @@ describe Twilio::REST::Client do
|
|
28
28
|
expect(connection.port).to eq(443)
|
29
29
|
expect(connection.use_ssl?).to eq(true)
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
it 'should set up the requested ssl verification ca_file if provided' do
|
33
33
|
twilio = Twilio::REST::Client.new('someSid', 'someToken', :ssl_ca_file => '/path/to/ca/file')
|
34
34
|
connection = twilio.instance_variable_get('@connection')
|
@@ -87,6 +87,19 @@ describe Twilio::REST::Client do
|
|
87
87
|
expect(twilio.account.instance_variable_get('@path')).to eq('/2010-04-01/Accounts/someSid')
|
88
88
|
end
|
89
89
|
|
90
|
+
[
|
91
|
+
:sandbox, :available_phone_numbers, :incoming_phone_numbers,
|
92
|
+
:calls, :outgoing_caller_ids, :conferences, :sms, :recordings,
|
93
|
+
:transcriptions, :notifications, :applications, :connect_apps,
|
94
|
+
:authorized_connect_apps, :queues, :usage, :messages, :media, :sip
|
95
|
+
].each do |method|
|
96
|
+
it "should delegate the client method #{method} to the account object" do
|
97
|
+
client = Twilio::REST::Client.new('someSid', 'someToken')
|
98
|
+
expect(client).to respond_to(method)
|
99
|
+
expect(client.send(method)).to eq(client.account.send(method))
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
90
103
|
it 'should convert all parameter names to Twilio-style names' do
|
91
104
|
twilio = Twilio::REST::Client.new('someSid', 'someToken')
|
92
105
|
untwilified = {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twilio-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.12.
|
4
|
+
version: 3.12.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Benton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|