twilio-ruby 3.9.0 → 3.10.0
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.
- data/Gemfile +2 -2
- data/lib/twilio-ruby/rest/accounts.rb +2 -2
- data/lib/twilio-ruby/rest/available_phone_numbers.rb +2 -2
- data/lib/twilio-ruby/rest/available_phone_numbers/country.rb +2 -2
- data/lib/twilio-ruby/rest/available_phone_numbers/local.rb +2 -2
- data/lib/twilio-ruby/rest/available_phone_numbers/toll_free.rb +2 -2
- data/lib/twilio-ruby/rest/calls.rb +2 -2
- data/lib/twilio-ruby/rest/client.rb +5 -5
- data/lib/twilio-ruby/rest/conferences.rb +2 -2
- data/lib/twilio-ruby/rest/conferences/participants.rb +1 -1
- data/lib/twilio-ruby/rest/instance_resource.rb +15 -15
- data/lib/twilio-ruby/rest/list_resource.rb +14 -14
- data/lib/twilio-ruby/rest/queues.rb +2 -2
- data/lib/twilio-ruby/rest/queues/members.rb +2 -2
- data/lib/twilio-ruby/rest/recordings.rb +7 -7
- data/lib/twilio-ruby/rest/sms.rb +2 -2
- data/lib/twilio-ruby/rest/sms/messages.rb +1 -1
- data/lib/twilio-ruby/rest/usage.rb +1 -1
- data/lib/twilio-ruby/rest/usage/records.rb +2 -2
- data/lib/twilio-ruby/rest/usage/triggers.rb +1 -1
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/rest/account_spec.rb +35 -40
- data/spec/rest/call_spec.rb +12 -9
- data/spec/rest/client_spec.rb +4 -4
- data/spec/rest/conference_spec.rb +2 -2
- data/spec/rest/instance_resource_spec.rb +2 -2
- data/spec/rest/queue_spec.rb +2 -2
- data/spec/rest/recording_spec.rb +3 -3
- metadata +111 -126
data/Gemfile
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
|
-
gemspec
|
3
|
+
gemspec
|
@@ -3,8 +3,8 @@ module Twilio
|
|
3
3
|
class Accounts < ListResource; end
|
4
4
|
|
5
5
|
class Account < InstanceResource
|
6
|
-
def initialize(
|
7
|
-
super
|
6
|
+
def initialize(path, client, params={})
|
7
|
+
super path, client, params
|
8
8
|
resource :sandbox, :available_phone_numbers, :incoming_phone_numbers,
|
9
9
|
:calls, :outgoing_caller_ids, :conferences, :sms, :recordings,
|
10
10
|
:transcriptions, :notifications, :applications, :connect_apps,
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Twilio
|
2
2
|
module REST
|
3
3
|
class AvailablePhoneNumbers < ListResource
|
4
|
-
def initialize(
|
5
|
-
@
|
4
|
+
def initialize(path, client)
|
5
|
+
@path, @client = path, client
|
6
6
|
@instance_class = Twilio::REST::Country
|
7
7
|
@list_key, @instance_id_key = 'countries', 'country_code'
|
8
8
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Twilio
|
2
2
|
module REST
|
3
3
|
class Local < ListResource
|
4
|
-
def initialize(
|
5
|
-
@
|
4
|
+
def initialize(path, client)
|
5
|
+
@path, @client = path, client
|
6
6
|
@instance_class = Twilio::REST::AvailablePhoneNumber
|
7
7
|
@list_key, @instance_id_key = 'available_phone_numbers', 'sid'
|
8
8
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Twilio
|
2
2
|
module REST
|
3
3
|
class TollFree < ListResource
|
4
|
-
def initialize(
|
5
|
-
@
|
4
|
+
def initialize(path, client)
|
5
|
+
@path, @client = path, client
|
6
6
|
@instance_class = Twilio::REST::AvailablePhoneNumber
|
7
7
|
@list_key, @instance_id_key = 'available_phone_numbers', 'sid'
|
8
8
|
end
|
@@ -153,13 +153,13 @@ module Twilio
|
|
153
153
|
# obtained from parsing the JSON object in the response body.
|
154
154
|
[:get, :put, :post, :delete].each do |method|
|
155
155
|
method_class = Net::HTTP.const_get method.to_s.capitalize
|
156
|
-
define_method method do |
|
156
|
+
define_method method do |path, *args|
|
157
157
|
params = twilify args[0]; params = {} if params.empty?
|
158
|
-
unless args[1]
|
159
|
-
|
160
|
-
|
158
|
+
unless args[1] # build the full path unless already given
|
159
|
+
path = "#{path}.json"
|
160
|
+
path << "?#{url_encode(params)}" if method == :get && !params.empty?
|
161
161
|
end
|
162
|
-
request = method_class.new
|
162
|
+
request = method_class.new path, HTTP_HEADERS
|
163
163
|
request.basic_auth @account_sid, @auth_token
|
164
164
|
request.form_data = params if [:post, :put].include? method
|
165
165
|
connect_and_send request
|
@@ -3,8 +3,8 @@ module Twilio
|
|
3
3
|
class Conferences < ListResource; end
|
4
4
|
|
5
5
|
class Conference < InstanceResource
|
6
|
-
def initialize(
|
7
|
-
super
|
6
|
+
def initialize(path, client, params={})
|
7
|
+
super path, client, params
|
8
8
|
resource :participants
|
9
9
|
end
|
10
10
|
end
|
@@ -10,25 +10,25 @@ module Twilio
|
|
10
10
|
include Utils
|
11
11
|
|
12
12
|
##
|
13
|
-
# Instantiate a new instance resource object. You must pass the +
|
13
|
+
# Instantiate a new instance resource object. You must pass the +path+ of
|
14
14
|
# the instance (e.g. /2010-04-01/Accounts/AC123/Calls/CA456) as well as a
|
15
15
|
# +client+ object that responds to #get #post and #delete. This client
|
16
16
|
# is meant to be an instance of Twilio::REST::Client but could just as
|
17
17
|
# well be a mock object if you want to test the interface. The optional
|
18
18
|
# +params+ hash will be converted into attributes on the instantiated
|
19
19
|
# object.
|
20
|
-
def initialize(
|
21
|
-
@
|
20
|
+
def initialize(path, client, params = {})
|
21
|
+
@path, @client = path, client
|
22
22
|
set_up_properties_from params
|
23
23
|
end
|
24
24
|
|
25
25
|
def inspect # :nodoc:
|
26
|
-
"<#{self.class} @
|
26
|
+
"<#{self.class} @path=#{@path}>"
|
27
27
|
end
|
28
28
|
|
29
29
|
##
|
30
30
|
# Update the properties of this instance resource using the key/value
|
31
|
-
# pairs in +params+. This makes an HTTP POST request to <tt>@
|
31
|
+
# pairs in +params+. This makes an HTTP POST request to <tt>@path</tt>
|
32
32
|
# to handle the update. For example, to update the +VoiceUrl+ of a Twilio
|
33
33
|
# Application you could write:
|
34
34
|
#
|
@@ -38,27 +38,27 @@ module Twilio
|
|
38
38
|
# instance resource, including the newly updated properties.
|
39
39
|
def update(params = {})
|
40
40
|
raise "Can't update a resource without a REST Client" unless @client
|
41
|
-
set_up_properties_from(@client.post(@
|
41
|
+
set_up_properties_from(@client.post(@path, params))
|
42
42
|
self
|
43
43
|
end
|
44
44
|
|
45
45
|
##
|
46
46
|
# Refresh the attributes of this instance resource object by fetching it
|
47
|
-
# from Twilio. Calling this makes an HTTP GET request to <tt>@
|
47
|
+
# from Twilio. Calling this makes an HTTP GET request to <tt>@path</tt>.
|
48
48
|
def refresh
|
49
49
|
raise "Can't refresh a resource without a REST Client" unless @client
|
50
50
|
@updated = false
|
51
|
-
set_up_properties_from(@client.get(@
|
51
|
+
set_up_properties_from(@client.get(@path))
|
52
52
|
self
|
53
53
|
end
|
54
54
|
|
55
55
|
##
|
56
56
|
# Delete an instance resource from Twilio. This operation isn't always
|
57
57
|
# supported. For instance, you can't delete an SMS. Calling this method
|
58
|
-
# makes an HTTP DELETE request to <tt>@
|
58
|
+
# makes an HTTP DELETE request to <tt>@path</tt>.
|
59
59
|
def delete
|
60
60
|
raise "Can't delete a resource without a REST Client" unless @client
|
61
|
-
@client.delete @
|
61
|
+
@client.delete @path
|
62
62
|
end
|
63
63
|
|
64
64
|
##
|
@@ -66,7 +66,7 @@ module Twilio
|
|
66
66
|
# until an attempt is made to access an unknown attribute.
|
67
67
|
def method_missing(method, *args)
|
68
68
|
super if @updated
|
69
|
-
set_up_properties_from(@client.get(@
|
69
|
+
set_up_properties_from(@client.get(@path))
|
70
70
|
self.send method, *args
|
71
71
|
end
|
72
72
|
|
@@ -76,7 +76,7 @@ module Twilio
|
|
76
76
|
eigenclass = class << self; self; end
|
77
77
|
hash.each do |p,v|
|
78
78
|
property = detwilify p
|
79
|
-
unless ['
|
79
|
+
unless ['client', 'updated'].include? property
|
80
80
|
eigenclass.send :define_method, property.to_sym, &lambda {v}
|
81
81
|
end
|
82
82
|
end
|
@@ -86,10 +86,10 @@ module Twilio
|
|
86
86
|
def resource(*resources)
|
87
87
|
resources.each do |r|
|
88
88
|
resource = twilify r
|
89
|
-
|
90
|
-
|
89
|
+
relative_path = r == :sms ? 'SMS' : resource
|
90
|
+
path = "#{@path}/#{relative_path}"
|
91
91
|
resource_class = Twilio::REST.const_get resource
|
92
|
-
instance_variable_set("@#{r}", resource_class.new(
|
92
|
+
instance_variable_set("@#{r}", resource_class.new(path, @client))
|
93
93
|
end
|
94
94
|
self.class.instance_eval {attr_reader *resources}
|
95
95
|
end
|
@@ -3,15 +3,15 @@ module Twilio
|
|
3
3
|
class ListResource
|
4
4
|
include Utils
|
5
5
|
|
6
|
-
def initialize(
|
7
|
-
@
|
6
|
+
def initialize(path, client)
|
7
|
+
@path, @client = path, client
|
8
8
|
resource_name = self.class.name.split('::')[-1]
|
9
9
|
@instance_class = Twilio::REST.const_get resource_name.chop
|
10
10
|
@list_key, @instance_id_key = detwilify(resource_name), 'sid'
|
11
11
|
end
|
12
12
|
|
13
13
|
def inspect # :nodoc:
|
14
|
-
"<#{self.class} @
|
14
|
+
"<#{self.class} @path=#{@path}>"
|
15
15
|
end
|
16
16
|
|
17
17
|
##
|
@@ -24,13 +24,13 @@ module Twilio
|
|
24
24
|
#
|
25
25
|
# The optional +params+ hash allows you to filter the list returned. The
|
26
26
|
# filters for each list resource type are defined by Twilio.
|
27
|
-
def list(params={},
|
27
|
+
def list(params={}, full_path=false)
|
28
28
|
raise "Can't get a resource list without a REST Client" unless @client
|
29
|
-
response = @client.get @
|
29
|
+
response = @client.get @path, params, full_path
|
30
30
|
resources = response[@list_key]
|
31
|
-
|
31
|
+
path = full_path ? @path.split('.')[0] : @path
|
32
32
|
resource_list = resources.map do |resource|
|
33
|
-
@instance_class.new "#{
|
33
|
+
@instance_class.new "#{path}/#{resource[@instance_id_key]}", @client,
|
34
34
|
resource
|
35
35
|
end
|
36
36
|
# set the +total+ and +next_page+ properties on the array
|
@@ -51,24 +51,24 @@ module Twilio
|
|
51
51
|
|
52
52
|
##
|
53
53
|
# Ask Twilio for the total number of items in the list.
|
54
|
-
# Calling this method makes an HTTP GET request to <tt>@
|
54
|
+
# Calling this method makes an HTTP GET request to <tt>@path</tt> with a
|
55
55
|
# page size parameter of 1 to minimize data over the wire while still
|
56
56
|
# obtaining the total. Don't use this if you are planning to
|
57
57
|
# call #list anyway, since the array returned from #list will have a
|
58
58
|
# +total+ attribute as well.
|
59
59
|
def total
|
60
60
|
raise "Can't get a resource total without a REST Client" unless @client
|
61
|
-
@client.get(@
|
61
|
+
@client.get(@path, :page_size => 1)['total']
|
62
62
|
end
|
63
63
|
|
64
64
|
##
|
65
|
-
# Return an empty instance resource object with the proper
|
65
|
+
# Return an empty instance resource object with the proper path. Note that
|
66
66
|
# this will never raise a Twilio::REST::RequestError on 404 since no HTTP
|
67
67
|
# request is made. The HTTP request is made when attempting to access an
|
68
68
|
# attribute of the returned instance resource object, such as
|
69
69
|
# its #date_created or #voice_url attributes.
|
70
70
|
def get(sid)
|
71
|
-
@instance_class.new "#{@
|
71
|
+
@instance_class.new "#{@path}/#{sid}", @client
|
72
72
|
end
|
73
73
|
alias :find :get # for the ActiveRecord lovers
|
74
74
|
|
@@ -76,11 +76,11 @@ module Twilio
|
|
76
76
|
# Return a newly created resource. Some +params+ may be required. Consult
|
77
77
|
# the Twilio REST API documentation related to the kind of resource you
|
78
78
|
# are attempting to create for details. Calling this method makes an HTTP
|
79
|
-
# POST request to <tt>@
|
79
|
+
# POST request to <tt>@path</tt> with the given params
|
80
80
|
def create(params={})
|
81
81
|
raise "Can't create a resource without a REST Client" unless @client
|
82
|
-
response = @client.post @
|
83
|
-
@instance_class.new "#{@
|
82
|
+
response = @client.post @path, params
|
83
|
+
@instance_class.new "#{@path}/#{response[@instance_id_key]}", @client,
|
84
84
|
response
|
85
85
|
end
|
86
86
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module Twilio
|
2
2
|
module REST
|
3
3
|
class Members < ListResource
|
4
|
-
def initialize(
|
4
|
+
def initialize(path, client)
|
5
5
|
super
|
6
6
|
# hard-code the json keys since members are special
|
7
7
|
@list_key, @instance_id_key = 'queue_members', 'call_sid'
|
8
8
|
end
|
9
9
|
|
10
10
|
def front
|
11
|
-
@instance_class.new "#{@
|
11
|
+
@instance_class.new "#{@path}/Front", @client
|
12
12
|
end
|
13
13
|
|
14
14
|
def front!
|
@@ -3,9 +3,9 @@ module Twilio
|
|
3
3
|
class Recordings < ListResource; end
|
4
4
|
|
5
5
|
class Recording < InstanceResource
|
6
|
-
def initialize(
|
7
|
-
|
8
|
-
super
|
6
|
+
def initialize(path, client, params={})
|
7
|
+
path.sub! /\/Calls\/CA[^\/]+/, ''
|
8
|
+
super path, client, params
|
9
9
|
resource :transcriptions
|
10
10
|
# grab a reference to the client's connection object for streaming
|
11
11
|
@connection = @client.instance_variable_get :@connection
|
@@ -14,21 +14,21 @@ module Twilio
|
|
14
14
|
##
|
15
15
|
# Return the wav URL for this recording.
|
16
16
|
def wav
|
17
|
-
"https://#{@connection.address}#{@
|
17
|
+
"https://#{@connection.address}#{@path}.wav"
|
18
18
|
end
|
19
19
|
|
20
20
|
def wav!(&block)
|
21
|
-
@connection.request_get @
|
21
|
+
@connection.request_get @path, &block
|
22
22
|
end
|
23
23
|
|
24
24
|
##
|
25
25
|
# Return the mp3 URL for this recording.
|
26
26
|
def mp3
|
27
|
-
"https://#{@connection.address}#{@
|
27
|
+
"https://#{@connection.address}#{@path}.mp3"
|
28
28
|
end
|
29
29
|
|
30
30
|
def mp3!(&block)
|
31
|
-
@connection.request_get "#{@
|
31
|
+
@connection.request_get "#{@path}.mp3", &block
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
data/lib/twilio-ruby/rest/sms.rb
CHANGED
@@ -5,14 +5,14 @@ module Twilio
|
|
5
5
|
SUBRESOURCES = [:daily, :monthly, :yearly, :all_time, :today, :yesterday,
|
6
6
|
:this_month, :last_month]
|
7
7
|
|
8
|
-
def initialize(
|
8
|
+
def initialize(path, client)
|
9
9
|
super
|
10
10
|
@list_key = 'usage_records'
|
11
11
|
end
|
12
12
|
|
13
13
|
def method_missing(method, *args)
|
14
14
|
super unless SUBRESOURCES.include? method
|
15
|
-
self.class.new "#{@
|
15
|
+
self.class.new "#{@path}/#{twilify(method)}", @client
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
data/lib/twilio-ruby/version.rb
CHANGED
data/spec/rest/account_spec.rb
CHANGED
@@ -1,63 +1,58 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Twilio::REST::Account do
|
4
|
-
|
5
|
-
|
6
|
-
account.
|
7
|
-
|
4
|
+
|
5
|
+
before do
|
6
|
+
@account = Twilio::REST::Account.new('someUri', 'someClient')
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'sets up incoming phone numbers resources object' do
|
10
|
+
@account.should respond_to(:incoming_phone_numbers)
|
11
|
+
@account.incoming_phone_numbers.instance_variable_get('@path').should == 'someUri/IncomingPhoneNumbers'
|
8
12
|
end
|
9
13
|
|
10
|
-
it '
|
11
|
-
account
|
12
|
-
account.
|
13
|
-
account.available_phone_numbers.instance_variable_get('@uri').should == 'someUri/AvailablePhoneNumbers'
|
14
|
+
it 'sets up an available phone numbers resources object' do
|
15
|
+
@account.should respond_to(:available_phone_numbers)
|
16
|
+
@account.available_phone_numbers.instance_variable_get('@path').should == 'someUri/AvailablePhoneNumbers'
|
14
17
|
end
|
15
18
|
|
16
|
-
it '
|
17
|
-
account
|
18
|
-
account.
|
19
|
-
account.outgoing_caller_ids.instance_variable_get('@uri').should == 'someUri/OutgoingCallerIds'
|
19
|
+
it 'sets up an outgoing caller ids resources object' do
|
20
|
+
@account.should respond_to(:outgoing_caller_ids)
|
21
|
+
@account.outgoing_caller_ids.instance_variable_get('@path').should == 'someUri/OutgoingCallerIds'
|
20
22
|
end
|
21
23
|
|
22
|
-
it '
|
23
|
-
account
|
24
|
-
account.
|
25
|
-
account.calls.instance_variable_get('@uri').should == 'someUri/Calls'
|
24
|
+
it 'sets up a calls resources object' do
|
25
|
+
@account.should respond_to(:calls)
|
26
|
+
@account.calls.instance_variable_get('@path').should == 'someUri/Calls'
|
26
27
|
end
|
27
28
|
|
28
|
-
it '
|
29
|
-
account
|
30
|
-
account.
|
31
|
-
account.conferences.instance_variable_get('@uri').should == 'someUri/Conferences'
|
29
|
+
it 'sets up a conferences resources object' do
|
30
|
+
@account.should respond_to(:conferences)
|
31
|
+
@account.conferences.instance_variable_get('@path').should == 'someUri/Conferences'
|
32
32
|
end
|
33
33
|
|
34
|
-
it '
|
35
|
-
account
|
36
|
-
account.
|
37
|
-
account.queues.instance_variable_get('@uri').should == 'someUri/Queues'
|
34
|
+
it 'sets up a queues resources object' do
|
35
|
+
@account.should respond_to(:queues)
|
36
|
+
@account.queues.instance_variable_get('@path').should == 'someUri/Queues'
|
38
37
|
end
|
39
38
|
|
40
|
-
it '
|
41
|
-
account
|
42
|
-
account.
|
43
|
-
account.sms.instance_variable_get('@uri').should == 'someUri/SMS'
|
39
|
+
it 'sets up a sms resource object' do
|
40
|
+
@account.should respond_to(:sms)
|
41
|
+
@account.sms.instance_variable_get('@path').should == 'someUri/SMS'
|
44
42
|
end
|
45
43
|
|
46
|
-
it '
|
47
|
-
account
|
48
|
-
account.
|
49
|
-
account.recordings.instance_variable_get('@uri').should == 'someUri/Recordings'
|
44
|
+
it 'sets up a recordings resources object' do
|
45
|
+
@account.should respond_to(:recordings)
|
46
|
+
@account.recordings.instance_variable_get('@path').should == 'someUri/Recordings'
|
50
47
|
end
|
51
48
|
|
52
|
-
it '
|
53
|
-
account
|
54
|
-
account.
|
55
|
-
account.transcriptions.instance_variable_get('@uri').should == 'someUri/Transcriptions'
|
49
|
+
it 'sets up a transcriptions resources object' do
|
50
|
+
@account.should respond_to(:transcriptions)
|
51
|
+
@account.transcriptions.instance_variable_get('@path').should == 'someUri/Transcriptions'
|
56
52
|
end
|
57
53
|
|
58
|
-
it '
|
59
|
-
account
|
60
|
-
account.
|
61
|
-
account.notifications.instance_variable_get('@uri').should == 'someUri/Notifications'
|
54
|
+
it 'sets up a notifications resources object' do
|
55
|
+
@account.should respond_to(:notifications)
|
56
|
+
@account.notifications.instance_variable_get('@path').should == 'someUri/Notifications'
|
62
57
|
end
|
63
58
|
end
|
data/spec/rest/call_spec.rb
CHANGED
@@ -1,15 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Twilio::REST::Call do
|
4
|
-
|
5
|
-
|
6
|
-
call.
|
7
|
-
|
4
|
+
|
5
|
+
before do
|
6
|
+
@call = Twilio::REST::Call.new('someUri', 'someClient')
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'sets up a recordings resources object' do
|
10
|
+
@call.should respond_to(:recordings)
|
11
|
+
@call.recordings.instance_variable_get('@path').should == 'someUri/Recordings'
|
8
12
|
end
|
9
13
|
|
10
|
-
it '
|
11
|
-
call
|
12
|
-
call.
|
13
|
-
call.notifications.instance_variable_get('@uri').should == 'someUri/Notifications'
|
14
|
+
it 'sets up a notifications resources object' do
|
15
|
+
@call.should respond_to(:notifications)
|
16
|
+
@call.notifications.instance_variable_get('@path').should == 'someUri/Notifications'
|
14
17
|
end
|
15
|
-
end
|
18
|
+
end
|
data/spec/rest/client_spec.rb
CHANGED
@@ -77,14 +77,14 @@ describe Twilio::REST::Client do
|
|
77
77
|
|
78
78
|
it 'should set up an accounts resources object' do
|
79
79
|
twilio = Twilio::REST::Client.new('someSid', 'someToken')
|
80
|
-
twilio.respond_to
|
81
|
-
twilio.accounts.instance_variable_get('@
|
80
|
+
twilio.should respond_to(:accounts)
|
81
|
+
twilio.accounts.instance_variable_get('@path').should == '/2010-04-01/Accounts'
|
82
82
|
end
|
83
83
|
|
84
84
|
it 'should set up an account object with the given sid' do
|
85
85
|
twilio = Twilio::REST::Client.new('someSid', 'someToken')
|
86
|
-
twilio.respond_to
|
87
|
-
twilio.account.instance_variable_get('@
|
86
|
+
twilio.should respond_to(:account)
|
87
|
+
twilio.account.instance_variable_get('@path').should == '/2010-04-01/Accounts/someSid'
|
88
88
|
end
|
89
89
|
|
90
90
|
it 'should convert all parameter names to Twilio-style names' do
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Twilio::REST::Conference do
|
4
4
|
it 'should set up a participants resources object' do
|
5
5
|
conference = Twilio::REST::Conference.new('someUri', 'someClient')
|
6
|
-
conference.respond_to
|
7
|
-
conference.participants.instance_variable_get('@
|
6
|
+
conference.should respond_to(:participants)
|
7
|
+
conference.participants.instance_variable_get('@path').should == 'someUri/Participants'
|
8
8
|
end
|
9
9
|
end
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Twilio::REST::InstanceResource do
|
4
4
|
it 'should set up an internal reference to the uri and client' do
|
5
5
|
resource = Twilio::REST::InstanceResource.new('some/uri', 'someClient')
|
6
|
-
resource.instance_variable_get('@
|
6
|
+
resource.instance_variable_get('@path').should == 'some/uri'
|
7
7
|
resource.instance_variable_get('@client').should == 'someClient'
|
8
8
|
end
|
9
9
|
|
@@ -12,4 +12,4 @@ describe Twilio::REST::InstanceResource do
|
|
12
12
|
resource = Twilio::REST::InstanceResource.new('uri', 'client', params)
|
13
13
|
resource.some_key.should == 'someValue'
|
14
14
|
end
|
15
|
-
end
|
15
|
+
end
|
data/spec/rest/queue_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Twilio::REST::Queue do
|
4
4
|
it 'should set up a members resources object' do
|
5
5
|
queue = Twilio::REST::Queue.new('someUri', 'someClient')
|
6
|
-
queue.respond_to
|
7
|
-
queue.members.instance_variable_get('@
|
6
|
+
queue.should respond_to(:members)
|
7
|
+
queue.members.instance_variable_get('@path').should == 'someUri/Members'
|
8
8
|
end
|
9
9
|
end
|
data/spec/rest/recording_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Twilio::REST::Recording do
|
4
4
|
it 'should set up a transcriptions resources object' do
|
5
5
|
call = Twilio::REST::Recording.new('someUri', 'someClient')
|
6
|
-
call.respond_to
|
7
|
-
call.transcriptions.instance_variable_get('@
|
6
|
+
call.should respond_to(:transcriptions)
|
7
|
+
call.transcriptions.instance_variable_get('@path').should == 'someUri/Transcriptions'
|
8
8
|
end
|
9
|
-
end
|
9
|
+
end
|
metadata
CHANGED
@@ -1,145 +1,137 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: twilio-ruby
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.10.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 3
|
8
|
-
- 9
|
9
|
-
- 0
|
10
|
-
version: 3.9.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Andrew Benton
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-07-14 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: multi_json
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 27
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 3
|
33
|
-
- 0
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
34
21
|
version: 1.3.0
|
35
22
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: builder
|
39
23
|
prerelease: false
|
40
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.3.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: builder
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
41
33
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
hash: 15
|
46
|
-
segments:
|
47
|
-
- 2
|
48
|
-
- 1
|
49
|
-
- 2
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
50
37
|
version: 2.1.2
|
51
38
|
type: :runtime
|
52
|
-
version_requirements: *id002
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: jwt
|
55
39
|
prerelease: false
|
56
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
41
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.1.2
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: jwt
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
66
53
|
version: 0.1.2
|
67
54
|
type: :runtime
|
68
|
-
version_requirements: *id003
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rake
|
71
55
|
prerelease: false
|
72
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
57
|
none: false
|
74
|
-
requirements:
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.1.2
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rake
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
75
67
|
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
hash: 59
|
78
|
-
segments:
|
79
|
-
- 0
|
80
|
-
- 9
|
81
|
-
- 0
|
68
|
+
- !ruby/object:Gem::Version
|
82
69
|
version: 0.9.0
|
83
70
|
type: :development
|
84
|
-
version_requirements: *id004
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
name: rspec
|
87
71
|
prerelease: false
|
88
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.9.0
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rspec
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
89
81
|
none: false
|
90
|
-
requirements:
|
82
|
+
requirements:
|
91
83
|
- - ~>
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
hash: 23
|
94
|
-
segments:
|
95
|
-
- 2
|
96
|
-
- 6
|
97
|
-
- 0
|
84
|
+
- !ruby/object:Gem::Version
|
98
85
|
version: 2.6.0
|
99
86
|
type: :development
|
100
|
-
version_requirements: *id005
|
101
|
-
- !ruby/object:Gem::Dependency
|
102
|
-
name: fakeweb
|
103
87
|
prerelease: false
|
104
|
-
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 2.6.0
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: fakeweb
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
105
97
|
none: false
|
106
|
-
requirements:
|
98
|
+
requirements:
|
107
99
|
- - ~>
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
hash: 27
|
110
|
-
segments:
|
111
|
-
- 1
|
112
|
-
- 3
|
113
|
-
- 0
|
100
|
+
- !ruby/object:Gem::Version
|
114
101
|
version: 1.3.0
|
115
102
|
type: :development
|
116
|
-
version_requirements: *id006
|
117
|
-
- !ruby/object:Gem::Dependency
|
118
|
-
name: rack
|
119
103
|
prerelease: false
|
120
|
-
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.3.0
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rack
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
121
113
|
none: false
|
122
|
-
requirements:
|
114
|
+
requirements:
|
123
115
|
- - ~>
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
hash: 27
|
126
|
-
segments:
|
127
|
-
- 1
|
128
|
-
- 3
|
129
|
-
- 0
|
116
|
+
- !ruby/object:Gem::Version
|
130
117
|
version: 1.3.0
|
131
118
|
type: :development
|
132
|
-
|
133
|
-
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.3.0
|
126
|
+
description: A simple library for communicating with the Twilio REST API, building
|
127
|
+
TwiML, and generating Twilio Client Capability Tokens
|
134
128
|
email: andrew@twilio.com
|
135
129
|
executables: []
|
136
|
-
|
137
130
|
extensions: []
|
138
|
-
|
139
|
-
extra_rdoc_files:
|
131
|
+
extra_rdoc_files:
|
140
132
|
- README.md
|
141
133
|
- LICENSE
|
142
|
-
files:
|
134
|
+
files:
|
143
135
|
- .gitignore
|
144
136
|
- .travis.yml
|
145
137
|
- Gemfile
|
@@ -196,53 +188,46 @@ files:
|
|
196
188
|
- spec/util/capability_spec.rb
|
197
189
|
- spec/util/request_validator_spec.rb
|
198
190
|
- twilio-ruby.gemspec
|
199
|
-
has_rdoc: true
|
200
191
|
homepage: http://github.com/twilio/twilio-ruby
|
201
|
-
licenses:
|
192
|
+
licenses:
|
202
193
|
- MIT
|
203
194
|
post_install_message:
|
204
|
-
rdoc_options:
|
195
|
+
rdoc_options:
|
205
196
|
- --line-numbers
|
206
197
|
- --inline-source
|
207
198
|
- --title
|
208
199
|
- twilio-ruby
|
209
200
|
- --main
|
210
201
|
- README.md
|
211
|
-
require_paths:
|
202
|
+
require_paths:
|
212
203
|
- lib
|
213
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
204
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
214
205
|
none: false
|
215
|
-
requirements:
|
216
|
-
- -
|
217
|
-
- !ruby/object:Gem::Version
|
218
|
-
|
219
|
-
|
220
|
-
- 0
|
221
|
-
version: "0"
|
222
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
|
+
requirements:
|
207
|
+
- - ! '>='
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: '0'
|
210
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
211
|
none: false
|
224
|
-
requirements:
|
225
|
-
- -
|
226
|
-
- !ruby/object:Gem::Version
|
227
|
-
|
228
|
-
segments:
|
229
|
-
- 0
|
230
|
-
version: "0"
|
212
|
+
requirements:
|
213
|
+
- - ! '>='
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
231
216
|
requirements: []
|
232
|
-
|
233
217
|
rubyforge_project:
|
234
|
-
rubygems_version: 1.
|
218
|
+
rubygems_version: 1.8.23
|
235
219
|
signing_key:
|
236
220
|
specification_version: 3
|
237
|
-
summary: A simple library for communicating with the Twilio REST API, building TwiML,
|
238
|
-
|
221
|
+
summary: A simple library for communicating with the Twilio REST API, building TwiML,
|
222
|
+
and generating Twilio Client Capability Tokens
|
223
|
+
test_files:
|
239
224
|
- spec/spec_helper.rb
|
240
|
-
- spec/rest/queue_spec.rb
|
241
|
-
- spec/rest/call_spec.rb
|
242
225
|
- spec/rest/conference_spec.rb
|
243
|
-
- spec/rest/
|
226
|
+
- spec/rest/call_spec.rb
|
244
227
|
- spec/rest/instance_resource_spec.rb
|
245
|
-
- spec/rest/client_spec.rb
|
246
228
|
- spec/rest/recording_spec.rb
|
229
|
+
- spec/rest/account_spec.rb
|
230
|
+
- spec/rest/client_spec.rb
|
231
|
+
- spec/rest/queue_spec.rb
|
247
232
|
- spec/util/capability_spec.rb
|
248
233
|
- spec/util/request_validator_spec.rb
|