twilio-ruby 4.9.1.edge → 4.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +3 -3
- data/lib/twilio-ruby.rb +0 -5
- data/lib/twilio-ruby/rest/list_resource.rb +3 -4
- data/lib/twilio-ruby/rest/next_gen_list_resource.rb +2 -3
- data/lib/twilio-ruby/rest/utils.rb +1 -12
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +3 -12
- data/lib/twilio-ruby/rest/conversations/completed.rb +0 -13
- data/lib/twilio-ruby/rest/conversations/conversations.rb +0 -23
- data/lib/twilio-ruby/rest/conversations/in_progress.rb +0 -13
- data/lib/twilio-ruby/rest/conversations/participants.rb +0 -8
- data/lib/twilio-ruby/rest/conversations_client.rb +0 -99
- data/spec/conversations/conversations_spec.rb +0 -61
- data/spec/rest/conversations_client_spec.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ad8c952ac5958e476622d7c2dc41af0b66c85cf
|
4
|
+
data.tar.gz: 2058f8524b23c47d60956ed53c15531a7a483f15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5acd95e6d7843836eeeb0fb123857074b098818385a4c443bc4ce7ecce14bb56ad96c5c265ed326468eb8ba59407acc9313c44c0d6946cd05f7017eb9b02638
|
7
|
+
data.tar.gz: 5b529ff5f673b78dc31cc6edc2f728646e35a70b3d31ca77931d1a1aadd9e84e9a22c7aebc7a32a0b0b401d5a91271ed9162f406d61b71bb39dc81e25515d1f3
|
data/CHANGES.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
twilio-ruby changelog
|
2
2
|
=====================
|
3
3
|
|
4
|
-
Version 4.9.1
|
4
|
+
Version 4.9.1
|
5
5
|
-------------
|
6
6
|
|
7
|
-
Release
|
7
|
+
Release January 28, 2015
|
8
8
|
|
9
|
-
- Fix ip
|
9
|
+
- Fix ip messaging first person grant
|
10
10
|
|
11
11
|
Version 4.9.0
|
12
12
|
-------------
|
data/lib/twilio-ruby.rb
CHANGED
@@ -36,10 +36,6 @@ require 'twilio-ruby/rest/pricing/phone_numbers'
|
|
36
36
|
require 'twilio-ruby/rest/pricing/voice/numbers'
|
37
37
|
require 'twilio-ruby/rest/pricing/voice'
|
38
38
|
require 'twilio-ruby/rest/pricing/messaging'
|
39
|
-
require 'twilio-ruby/rest/conversations/in_progress'
|
40
|
-
require 'twilio-ruby/rest/conversations/completed'
|
41
|
-
require 'twilio-ruby/rest/conversations/conversations'
|
42
|
-
require 'twilio-ruby/rest/conversations/participants'
|
43
39
|
require 'twilio-ruby/rest/ip-messaging/services'
|
44
40
|
require 'twilio-ruby/rest/ip-messaging/channels'
|
45
41
|
require 'twilio-ruby/rest/ip-messaging/members'
|
@@ -108,7 +104,6 @@ require 'twilio-ruby/rest/notifications'
|
|
108
104
|
require 'twilio-ruby/rest/addresses'
|
109
105
|
require 'twilio-ruby/rest/addresses/dependent_phone_numbers'
|
110
106
|
require 'twilio-ruby/rest/client'
|
111
|
-
require 'twilio-ruby/rest/conversations_client'
|
112
107
|
require 'twilio-ruby/rest/task_router_client'
|
113
108
|
require 'twilio-ruby/rest/trunking_client'
|
114
109
|
require 'twilio-ruby/rest/lookups_client'
|
@@ -10,7 +10,7 @@ module Twilio
|
|
10
10
|
'Countries' => 'Country',
|
11
11
|
'Feedback' => 'FeedbackInstance',
|
12
12
|
'IpAddresses' => 'IpAddress',
|
13
|
-
'Media' => 'MediaInstance'
|
13
|
+
'Media' => 'MediaInstance',
|
14
14
|
}
|
15
15
|
@path, @client = path, client
|
16
16
|
resource_name = self.class.name.split('::')[-1]
|
@@ -46,8 +46,7 @@ module Twilio
|
|
46
46
|
raise "Can't get a resource list without a REST Client" unless @client
|
47
47
|
response = @client.get @path, params, full_path
|
48
48
|
resources = response[@list_key]
|
49
|
-
path =
|
50
|
-
path = full_path ? path.split('.')[0] : path
|
49
|
+
path = full_path ? @path.split('.')[0] : @path
|
51
50
|
resource_list = resources.map do |resource|
|
52
51
|
@instance_class.new "#{path}/#{resource[@instance_id_key]}", @client,
|
53
52
|
resource
|
@@ -81,7 +80,7 @@ module Twilio
|
|
81
80
|
# attribute of the returned instance resource object, such as
|
82
81
|
# its #date_created or #voice_url attributes.
|
83
82
|
def get(sid)
|
84
|
-
@instance_class.new "#{@
|
83
|
+
@instance_class.new "#{@path}/#{sid}", @client
|
85
84
|
end
|
86
85
|
alias :find :get # for the ActiveRecord lovers
|
87
86
|
|
@@ -4,12 +4,11 @@ module Twilio
|
|
4
4
|
def list(params={}, full_path=false)
|
5
5
|
raise "Can't get a resource list without a REST Client" unless @client
|
6
6
|
response = @client.get @path, params, full_path
|
7
|
-
list_key = response['meta']['key']
|
7
|
+
list_key = response['meta']['key']
|
8
8
|
raise "Couldn't find a list key in response meta" unless list_key
|
9
9
|
resources = response[list_key]
|
10
|
-
path = @frozen_path ? @frozen_path : @path
|
11
10
|
resource_list = resources.map do |resource|
|
12
|
-
@instance_class.new "#{path}/#{resource[@instance_id_key]}", @client,
|
11
|
+
@instance_class.new "#{@path}/#{resource[@instance_id_key]}", @client,
|
13
12
|
resource
|
14
13
|
end
|
15
14
|
client, list_class = @client, self.class
|
@@ -19,13 +19,6 @@ module Twilio
|
|
19
19
|
|
20
20
|
protected
|
21
21
|
|
22
|
-
# Freeze the base list path.
|
23
|
-
# Used on list resources so filters (such as /Local) do not affect the
|
24
|
-
# instance resource path.
|
25
|
-
def freeze_path
|
26
|
-
@frozen_path = @path
|
27
|
-
end
|
28
|
-
|
29
22
|
def resource(*resources)
|
30
23
|
custom_resource_names = { sms: 'SMS', sip: 'SIP' }
|
31
24
|
resources.each do |r|
|
@@ -38,11 +31,7 @@ module Twilio
|
|
38
31
|
Twilio::REST.const_get(@submodule)
|
39
32
|
end
|
40
33
|
resource_class = enclosing_module.const_get resource
|
41
|
-
|
42
|
-
instance_variable_set("@#{r}", resource_object)
|
43
|
-
if @frozen_path
|
44
|
-
resource_object.instance_variable_set(:@frozen_path, @frozen_path)
|
45
|
-
end
|
34
|
+
instance_variable_set("@#{r}", resource_class.new(path, @client))
|
46
35
|
end
|
47
36
|
self.class.instance_eval { attr_reader *resources }
|
48
37
|
end
|
data/lib/twilio-ruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twilio-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.9.1
|
4
|
+
version: 4.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Benton
|
@@ -150,11 +150,6 @@ files:
|
|
150
150
|
- lib/twilio-ruby/rest/conferences.rb
|
151
151
|
- lib/twilio-ruby/rest/conferences/participants.rb
|
152
152
|
- lib/twilio-ruby/rest/connect_apps.rb
|
153
|
-
- lib/twilio-ruby/rest/conversations/completed.rb
|
154
|
-
- lib/twilio-ruby/rest/conversations/conversations.rb
|
155
|
-
- lib/twilio-ruby/rest/conversations/in_progress.rb
|
156
|
-
- lib/twilio-ruby/rest/conversations/participants.rb
|
157
|
-
- lib/twilio-ruby/rest/conversations_client.rb
|
158
153
|
- lib/twilio-ruby/rest/errors.rb
|
159
154
|
- lib/twilio-ruby/rest/incoming_phone_numbers.rb
|
160
155
|
- lib/twilio-ruby/rest/incoming_phone_numbers/local.rb
|
@@ -240,7 +235,6 @@ files:
|
|
240
235
|
- lib/twilio-ruby/util/configuration.rb
|
241
236
|
- lib/twilio-ruby/util/request_validator.rb
|
242
237
|
- lib/twilio-ruby/version.rb
|
243
|
-
- spec/conversations/conversations_spec.rb
|
244
238
|
- spec/rack/twilio_webhook_authentication_spec.rb
|
245
239
|
- spec/rest/account_spec.rb
|
246
240
|
- spec/rest/address_spec.rb
|
@@ -249,7 +243,6 @@ files:
|
|
249
243
|
- spec/rest/call_spec.rb
|
250
244
|
- spec/rest/client_spec.rb
|
251
245
|
- spec/rest/conference_spec.rb
|
252
|
-
- spec/rest/conversations_client_spec.rb
|
253
246
|
- spec/rest/instance_resource_spec.rb
|
254
247
|
- spec/rest/ip-messaging/channel_spec.rb
|
255
248
|
- spec/rest/ip-messaging/service_spec.rb
|
@@ -306,9 +299,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
306
299
|
version: 1.9.3
|
307
300
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
308
301
|
requirements:
|
309
|
-
- - '
|
302
|
+
- - '>='
|
310
303
|
- !ruby/object:Gem::Version
|
311
|
-
version:
|
304
|
+
version: '0'
|
312
305
|
requirements: []
|
313
306
|
rubyforge_project:
|
314
307
|
rubygems_version: 2.4.8
|
@@ -317,7 +310,6 @@ specification_version: 4
|
|
317
310
|
summary: A simple library for communicating with the Twilio REST API, building TwiML,
|
318
311
|
and generating Twilio Client Capability Tokens
|
319
312
|
test_files:
|
320
|
-
- spec/conversations/conversations_spec.rb
|
321
313
|
- spec/rack/twilio_webhook_authentication_spec.rb
|
322
314
|
- spec/rest/account_spec.rb
|
323
315
|
- spec/rest/address_spec.rb
|
@@ -326,7 +318,6 @@ test_files:
|
|
326
318
|
- spec/rest/call_spec.rb
|
327
319
|
- spec/rest/client_spec.rb
|
328
320
|
- spec/rest/conference_spec.rb
|
329
|
-
- spec/rest/conversations_client_spec.rb
|
330
321
|
- spec/rest/instance_resource_spec.rb
|
331
322
|
- spec/rest/ip-messaging/channel_spec.rb
|
332
323
|
- spec/rest/ip-messaging/service_spec.rb
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Twilio
|
2
|
-
module REST
|
3
|
-
module Conversations
|
4
|
-
class Completed < NextGenListResource
|
5
|
-
def initialize(path, client)
|
6
|
-
@path, @client = path, client
|
7
|
-
@instance_class = Twilio::REST::Conversations::Conversation
|
8
|
-
@instance_id_key = 'sid'
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Twilio
|
2
|
-
module REST
|
3
|
-
module Conversations
|
4
|
-
class Conversations < NextGenListResource
|
5
|
-
def initialize(path, client)
|
6
|
-
@path, @client = path, client
|
7
|
-
@submodule = :Conversations
|
8
|
-
freeze_path
|
9
|
-
resource :in_progress,
|
10
|
-
:completed
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class Conversation < InstanceResource
|
15
|
-
def initialize(path, client, params={})
|
16
|
-
super
|
17
|
-
@submodule = :Conversations
|
18
|
-
resource :participants
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Twilio
|
2
|
-
module REST
|
3
|
-
module Conversations
|
4
|
-
class InProgress < NextGenListResource
|
5
|
-
def initialize(path, client)
|
6
|
-
@path, @client = path, client
|
7
|
-
@instance_class = Twilio::REST::Conversations::Conversation
|
8
|
-
@instance_id_key = 'sid'
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
require 'twilio-ruby/rest/base_client'
|
2
|
-
module Twilio
|
3
|
-
module REST
|
4
|
-
class ConversationsClient < BaseClient
|
5
|
-
API_VERSION = 'v1'
|
6
|
-
|
7
|
-
attr_reader :conversations
|
8
|
-
|
9
|
-
host 'conversations.twilio.com'
|
10
|
-
|
11
|
-
##
|
12
|
-
# Instantiate a new HTTP Conversations client to talk to Twilio. The parameters
|
13
|
-
# +account_sid+, +auth_token+ are required, unless you have configured
|
14
|
-
# them already using the block configure syntax, and used to generate the
|
15
|
-
# HTTP basic auth header in each request. The +options+ parameter is a
|
16
|
-
# hash of connection configuration options. the following keys are
|
17
|
-
# supported:
|
18
|
-
#
|
19
|
-
# === <tt>host: 'conversations.twilio.com'</tt>
|
20
|
-
#
|
21
|
-
# The domain to which you'd like the client to make HTTP requests. Useful
|
22
|
-
# for testing. Defaults to 'conversations.twilio.com'.
|
23
|
-
#
|
24
|
-
# === <tt>port: 443</tt>
|
25
|
-
#
|
26
|
-
# The port on which to connect to the above domain. Defaults to 443 and
|
27
|
-
# should be left that way except in testing environments.
|
28
|
-
#
|
29
|
-
# === <tt>use_ssl: true</tt>
|
30
|
-
#
|
31
|
-
# Declare whether ssl should be used for connections to the above domain.
|
32
|
-
# Defaults to true and should be left alone except when testing.
|
33
|
-
#
|
34
|
-
# === <tt>ssl_verify_peer: true</tt>
|
35
|
-
#
|
36
|
-
# Declare whether to verify the host's ssl cert when setting up the
|
37
|
-
# connection to the above domain. Defaults to true, but can be turned off
|
38
|
-
# to avoid ssl certificate verification failures in environments without
|
39
|
-
# the necessary ca certificates.
|
40
|
-
#
|
41
|
-
# === <tt>ssl_ca_file: '/path/to/ca/file'</tt>
|
42
|
-
#
|
43
|
-
# Specify the path to the certificate authority bundle you'd like to use
|
44
|
-
# to verify Twilio's SSL certificate on each request. If not specified, a
|
45
|
-
# certificate bundle extraced from Firefox is packaged with the gem and
|
46
|
-
# used by default.
|
47
|
-
#
|
48
|
-
# === <tt>timeout: 30</tt>
|
49
|
-
#
|
50
|
-
# Set the time in seconds to wait before timing out the HTTP request.
|
51
|
-
# Defaults to 30 seconds. If you aren't fetching giant pages of call or
|
52
|
-
# SMS logs you can safely decrease this to something like 3 seconds or
|
53
|
-
# lower. In paricular if you are sending SMS you can set this to 1 second
|
54
|
-
# or less and swallow the exception if you don't care about the response.
|
55
|
-
#
|
56
|
-
# === <tt>proxy_addr: 'proxy.host.domain'</tt>
|
57
|
-
#
|
58
|
-
# The domain of a proxy through which you'd like the client to make HTTP
|
59
|
-
# requests. Defaults to nil.
|
60
|
-
#
|
61
|
-
# === <tt>proxy_port: 3128</tt>
|
62
|
-
#
|
63
|
-
# The port on which to connect to the above proxy. Defaults to nil.
|
64
|
-
#
|
65
|
-
# === <tt>proxy_user: 'username'</tt>
|
66
|
-
#
|
67
|
-
# The user name to use for authentication with the proxy. Defaults to nil.
|
68
|
-
#
|
69
|
-
# === <tt>proxy_pass: 'password'</tt>
|
70
|
-
#
|
71
|
-
# The password to use for authentication with the proxy. Defaults to nil.
|
72
|
-
#
|
73
|
-
# === <tt>retry_limit: 1</tt>
|
74
|
-
#
|
75
|
-
# The number of times to retry a request that has failed before throwing
|
76
|
-
# an exception. Defaults to one.
|
77
|
-
def inspect # :nodoc:
|
78
|
-
"<Twilio::REST::ConversationsClient @account_sid=#{@account_sid}>"
|
79
|
-
end
|
80
|
-
|
81
|
-
protected
|
82
|
-
|
83
|
-
##
|
84
|
-
# Create subresource properties
|
85
|
-
def set_up_subresources # :doc:
|
86
|
-
@conversations = Twilio::REST::Conversations::Conversations.new "/#{API_VERSION}/Conversations", self
|
87
|
-
end
|
88
|
-
|
89
|
-
##
|
90
|
-
# Builds up full request path
|
91
|
-
def build_full_path(path, params, method)
|
92
|
-
path = path.dup
|
93
|
-
path << "?#{url_encode(params)}" if method == :get && !params.empty?
|
94
|
-
path
|
95
|
-
end
|
96
|
-
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Twilio::REST::Conversations::Conversations do
|
4
|
-
|
5
|
-
it 'creates an in_progress property' do
|
6
|
-
client = Twilio::REST::ConversationsClient.new 'otherSid', 'otherToken'
|
7
|
-
conversations = Twilio::REST::Conversations::Conversations.new '/v1/Conversations', client
|
8
|
-
expect(conversations).to respond_to(:in_progress)
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'creates a completed property' do
|
12
|
-
client = Twilio::REST::ConversationsClient.new 'otherSid', 'otherToken'
|
13
|
-
conversations = Twilio::REST::Conversations::Conversations.new '/v1/Conversations', client
|
14
|
-
expect(conversations).to respond_to(:completed)
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
describe Twilio::REST::Conversations::InProgress do
|
20
|
-
it 'gets constructed by conversations' do
|
21
|
-
client = Twilio::REST::ConversationsClient.new 'otherSid', 'otherToken'
|
22
|
-
conversations = Twilio::REST::Conversations::Conversations.new '/v1/Conversations', client
|
23
|
-
expect(conversations.in_progress.instance_variable_get('@path')).to eq('/v1/Conversations/InProgress')
|
24
|
-
end
|
25
|
-
it 'uses Conversation as its instance class' do
|
26
|
-
client = Twilio::REST::ConversationsClient.new 'otherSid', 'otherToken'
|
27
|
-
conversations = Twilio::REST::Conversations::Conversations.new '/v1/Conversations', client
|
28
|
-
expect(conversations.in_progress.instance_variable_get('@instance_class')).to eq(Twilio::REST::Conversations::Conversation)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe Twilio::REST::Conversations::Completed do
|
33
|
-
it 'gets constructed by conversations' do
|
34
|
-
client = Twilio::REST::ConversationsClient.new 'otherSid', 'otherToken'
|
35
|
-
conversations = Twilio::REST::Conversations::Conversations.new '/v1/Conversations', client
|
36
|
-
expect(conversations.completed.instance_variable_get('@path')).to eq('/v1/Conversations/Completed')
|
37
|
-
end
|
38
|
-
it 'uses Conversation as its instance class' do
|
39
|
-
client = Twilio::REST::ConversationsClient.new 'otherSid', 'otherToken'
|
40
|
-
conversations = Twilio::REST::Conversations::Conversations.new '/v1/Conversations', client
|
41
|
-
expect(conversations.completed.instance_variable_get('@instance_class')).to eq(Twilio::REST::Conversations::Conversation)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe Twilio::REST::Conversations::Conversation do
|
46
|
-
it 'has correct path when fetched from /InProgress' do
|
47
|
-
client = Twilio::REST::ConversationsClient.new 'otherSid', 'otherToken'
|
48
|
-
conversation = client.conversations.in_progress.get('CA123')
|
49
|
-
expect(conversation.instance_variable_get('@path')).to eq('/v1/Conversations/CA123')
|
50
|
-
end
|
51
|
-
it 'has correct path when fetched from /Completed' do
|
52
|
-
client = Twilio::REST::ConversationsClient.new 'otherSid', 'otherToken'
|
53
|
-
conversation = client.conversations.completed.get('CA123')
|
54
|
-
expect(conversation.instance_variable_get('@path')).to eq('/v1/Conversations/CA123')
|
55
|
-
end
|
56
|
-
it 'sets up participants subresource' do
|
57
|
-
client = Twilio::REST::ConversationsClient.new 'otherSid', 'otherToken'
|
58
|
-
conversation = Twilio::REST::Conversations::Conversation.new '/v1/Conversations/CA123', client
|
59
|
-
expect(conversation).to respond_to(:participants)
|
60
|
-
end
|
61
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Twilio::REST::ConversationsClient do
|
4
|
-
before do
|
5
|
-
@client = Twilio::REST::ConversationsClient.new('AC123', 'foobar')
|
6
|
-
end
|
7
|
-
|
8
|
-
it 'should set up an conversations resources object' do
|
9
|
-
expect(@client).to respond_to(:conversations)
|
10
|
-
expect(@client.conversations.instance_variable_get('@path')).to eq('/v1/Conversations')
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|