twilio-ruby 3.11.3 → 3.11.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +7 -0
- data/docs/usage/phone-numbers.rst +18 -5
- data/lib/twilio-ruby.rb +4 -0
- data/lib/twilio-ruby/rest/available_phone_numbers/country.rb +1 -1
- data/lib/twilio-ruby/rest/available_phone_numbers/mobile.rb +11 -0
- data/lib/twilio-ruby/rest/incoming_phone_numbers.rb +6 -0
- data/lib/twilio-ruby/rest/incoming_phone_numbers/local.rb +13 -0
- data/lib/twilio-ruby/rest/incoming_phone_numbers/mobile.rb +13 -0
- data/lib/twilio-ruby/rest/incoming_phone_numbers/toll_free.rb +13 -0
- data/lib/twilio-ruby/rest/list_resource.rb +13 -0
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/rest/numbers_spec.rb +46 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60caf96e0be84c2a084bd580c8c181b92909f5c4
|
4
|
+
data.tar.gz: 4c46e3cce1c9828ce1245c50037fabc534734808
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 142f0aa26b716d745ca24bf6ee5ce6df21404d0298e90f8642a58c128ae0ac6c476eb038dfd156980cd57fa773852b11e5f284f4768763beabb19a00a7d10255
|
7
|
+
data.tar.gz: 84711f852670886bcffaa74a2d0394a6bcf58af0e93837872bf18df57c2484b95a431b03bf208bf5506e4ea3429cbc6e877dc6956b3e616076bb832a4c79daa1
|
data/CHANGES
CHANGED
@@ -5,6 +5,13 @@ Version 3.11.3
|
|
5
5
|
|
6
6
|
Released October 15, 2013
|
7
7
|
|
8
|
+
- Restore support for versions of Ruby other than 2.0.0, which the
|
9
|
+
previous release removed.
|
10
|
+
|
11
|
+
Version 3.11.2
|
12
|
+
|
13
|
+
Released October 15, 2013
|
14
|
+
|
8
15
|
- Restore ability of `sms.messages` to make requests to /SMS/Messages.
|
9
16
|
|
10
17
|
Version 3.11.1
|
@@ -35,16 +35,29 @@ Once we find one, we'll purchase it for our account.
|
|
35
35
|
print "No numbers in 530 available"
|
36
36
|
|
37
37
|
|
38
|
-
Toll
|
39
|
-
|
38
|
+
Local, Toll-Free, and Mobile Numbers
|
39
|
+
------------------------------------
|
40
40
|
|
41
|
-
By default, :meth:`PhoneNumbers.search` looks for local phone numbers.
|
42
|
-
|
41
|
+
By default, :meth:`PhoneNumbers.search` looks for local phone numbers. You can
|
42
|
+
search for different types of numbers by using a type subresource.
|
43
|
+
|
44
|
+
Available subresources for AvailablePhoneNumbers are:
|
45
|
+
- `local`
|
46
|
+
- `toll_free`
|
47
|
+
- `mobile`
|
48
|
+
|
49
|
+
You can search for numbers for a given type.
|
43
50
|
|
44
51
|
.. code-block:: ruby
|
45
52
|
|
46
|
-
|
53
|
+
# local
|
54
|
+
numbers = @client.account.available_phone_numbers.local.list()
|
55
|
+
|
56
|
+
# toll free
|
57
|
+
numbers = @client.account.available_phone_numbers.toll_free.list()
|
47
58
|
|
59
|
+
# mobile
|
60
|
+
numbers = @client.account.available_phone_numbers.mobile.list()
|
48
61
|
|
49
62
|
Numbers Containing Words
|
50
63
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
data/lib/twilio-ruby.rb
CHANGED
@@ -37,9 +37,13 @@ require 'twilio-ruby/rest/connect_apps'
|
|
37
37
|
require 'twilio-ruby/rest/authorized_connect_apps'
|
38
38
|
require 'twilio-ruby/rest/outgoing_caller_ids'
|
39
39
|
require 'twilio-ruby/rest/incoming_phone_numbers'
|
40
|
+
require 'twilio-ruby/rest/incoming_phone_numbers/local'
|
41
|
+
require 'twilio-ruby/rest/incoming_phone_numbers/toll_free'
|
42
|
+
require 'twilio-ruby/rest/incoming_phone_numbers/mobile'
|
40
43
|
require 'twilio-ruby/rest/available_phone_numbers'
|
41
44
|
require 'twilio-ruby/rest/available_phone_numbers/country'
|
42
45
|
require 'twilio-ruby/rest/available_phone_numbers/local'
|
46
|
+
require 'twilio-ruby/rest/available_phone_numbers/mobile'
|
43
47
|
require 'twilio-ruby/rest/available_phone_numbers/toll_free'
|
44
48
|
require 'twilio-ruby/rest/conferences'
|
45
49
|
require 'twilio-ruby/rest/conferences/participants'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Twilio
|
2
|
+
module REST
|
3
|
+
class Mobile < ListResource
|
4
|
+
def initialize(path, client)
|
5
|
+
@path, @client = path, client
|
6
|
+
@instance_class = Twilio::REST::AvailablePhoneNumber
|
7
|
+
@list_key, @instance_id_key = 'available_phone_numbers', 'sid'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Twilio
|
2
|
+
module REST
|
3
|
+
module NumberType
|
4
|
+
class Local < ListResource
|
5
|
+
def initialize(path, client)
|
6
|
+
@path, @client = path, client
|
7
|
+
@instance_class = Twilio::REST::IncomingPhoneNumber
|
8
|
+
@list_key, @instance_id_key = 'incoming_phone_numbers', 'sid'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Twilio
|
2
|
+
module REST
|
3
|
+
module NumberType
|
4
|
+
class Mobile < ListResource
|
5
|
+
def initialize(path, client)
|
6
|
+
@path, @client = path, client
|
7
|
+
@instance_class = Twilio::REST::IncomingPhoneNumber
|
8
|
+
@list_key, @instance_id_key = 'incoming_phone_numbers', 'sid'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Twilio
|
2
|
+
module REST
|
3
|
+
module NumberType
|
4
|
+
class TollFree < ListResource
|
5
|
+
def initialize(path, client)
|
6
|
+
@path, @client = path, client
|
7
|
+
@instance_class = Twilio::REST::IncomingPhoneNumber
|
8
|
+
@list_key, @instance_id_key = 'incoming_phone_numbers', 'sid'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -92,6 +92,19 @@ module Twilio
|
|
92
92
|
@instance_class.new "#{@path}/#{response[@instance_id_key]}", @client,
|
93
93
|
response
|
94
94
|
end
|
95
|
+
|
96
|
+
def resource(*resources)
|
97
|
+
custom_resource_names = {:sms => 'SMS', :sip => 'SIP'}
|
98
|
+
resources.each do |r|
|
99
|
+
resource = twilify r
|
100
|
+
relative_path = custom_resource_names.fetch(r, resource)
|
101
|
+
path = "#{@path}/#{relative_path}"
|
102
|
+
enclosing_module = @submodule == nil ? (Twilio::REST) : (Twilio::REST.const_get(@submodule))
|
103
|
+
resource_class = enclosing_module.const_get resource
|
104
|
+
instance_variable_set("@#{r}", resource_class.new(path, @client))
|
105
|
+
end
|
106
|
+
self.class.instance_eval {attr_reader *resources}
|
107
|
+
end
|
95
108
|
end
|
96
109
|
end
|
97
110
|
end
|
data/lib/twilio-ruby/version.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Twilio::REST::Country do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@country = Twilio::REST::Country.new('someUri', 'someClient')
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'sets up a local resources object' do
|
10
|
+
@country.should respond_to(:local)
|
11
|
+
@country.local.instance_variable_get('@path').should == 'someUri/Local'
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'sets up a toll_free resources object' do
|
15
|
+
@country.should respond_to(:toll_free)
|
16
|
+
@country.toll_free.instance_variable_get('@path').should == 'someUri/TollFree'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'sets up a mobile resources object' do
|
20
|
+
@country.should respond_to(:mobile)
|
21
|
+
@country.mobile.instance_variable_get('@path').should == 'someUri/Mobile'
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
describe Twilio::REST::NumberType do
|
27
|
+
|
28
|
+
before do
|
29
|
+
@incoming_phone_numbers = Twilio::REST::IncomingPhoneNumbers.new('someUri', 'someClient')
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'sets up a local resources object' do
|
33
|
+
@incoming_phone_numbers.should respond_to(:local)
|
34
|
+
@incoming_phone_numbers.local.instance_variable_get('@path').should == 'someUri/Local'
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'sets up a toll_free resources object' do
|
38
|
+
@incoming_phone_numbers.should respond_to(:toll_free)
|
39
|
+
@incoming_phone_numbers.toll_free.instance_variable_get('@path').should == 'someUri/TollFree'
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'sets up a mobile resources object' do
|
43
|
+
@incoming_phone_numbers.should respond_to(:mobile)
|
44
|
+
@incoming_phone_numbers.mobile.instance_variable_get('@path').should == 'someUri/Mobile'
|
45
|
+
end
|
46
|
+
end
|
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.11.
|
4
|
+
version: 3.11.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Benton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -172,6 +172,7 @@ files:
|
|
172
172
|
- lib/twilio-ruby/rest/available_phone_numbers.rb
|
173
173
|
- lib/twilio-ruby/rest/available_phone_numbers/country.rb
|
174
174
|
- lib/twilio-ruby/rest/available_phone_numbers/local.rb
|
175
|
+
- lib/twilio-ruby/rest/available_phone_numbers/mobile.rb
|
175
176
|
- lib/twilio-ruby/rest/available_phone_numbers/toll_free.rb
|
176
177
|
- lib/twilio-ruby/rest/calls.rb
|
177
178
|
- lib/twilio-ruby/rest/client.rb
|
@@ -180,6 +181,9 @@ files:
|
|
180
181
|
- lib/twilio-ruby/rest/connect_apps.rb
|
181
182
|
- lib/twilio-ruby/rest/errors.rb
|
182
183
|
- lib/twilio-ruby/rest/incoming_phone_numbers.rb
|
184
|
+
- lib/twilio-ruby/rest/incoming_phone_numbers/local.rb
|
185
|
+
- lib/twilio-ruby/rest/incoming_phone_numbers/mobile.rb
|
186
|
+
- lib/twilio-ruby/rest/incoming_phone_numbers/toll_free.rb
|
183
187
|
- lib/twilio-ruby/rest/instance_resource.rb
|
184
188
|
- lib/twilio-ruby/rest/list_resource.rb
|
185
189
|
- lib/twilio-ruby/rest/media.rb
|
@@ -218,6 +222,7 @@ files:
|
|
218
222
|
- spec/rest/conference_spec.rb
|
219
223
|
- spec/rest/instance_resource_spec.rb
|
220
224
|
- spec/rest/message_spec.rb
|
225
|
+
- spec/rest/numbers_spec.rb
|
221
226
|
- spec/rest/queue_spec.rb
|
222
227
|
- spec/rest/recording_spec.rb
|
223
228
|
- spec/spec_helper.rb
|
@@ -262,6 +267,7 @@ test_files:
|
|
262
267
|
- spec/rest/conference_spec.rb
|
263
268
|
- spec/rest/instance_resource_spec.rb
|
264
269
|
- spec/rest/message_spec.rb
|
270
|
+
- spec/rest/numbers_spec.rb
|
265
271
|
- spec/rest/queue_spec.rb
|
266
272
|
- spec/rest/recording_spec.rb
|
267
273
|
- spec/spec_helper.rb
|