twilio-ruby 4.5.0 → 4.6.0.edge

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4fbf37a3542aa7a3a7cb75eee0c803f0ada09cbc
4
- data.tar.gz: 096dd69f1095786ca224a5df6be1495191a81e08
3
+ metadata.gz: 386e7cb17fd04709734312725c4615507e9855e3
4
+ data.tar.gz: 630317cd457b598ddb304adb2b793d2b80fd4d8e
5
5
  SHA512:
6
- metadata.gz: 2b45a19176a20355ba25981ef95b6999a014e6b5801f7f8c73145eb4724beb41dc82031c5769ff422951cc6567120a200c5886df48ea6c2d962f20282bcae309
7
- data.tar.gz: 5bcda0112084afbb89a71df58b4bfdc3c000b5d3860cc0861f7b29e6299fcd4d20b63784995b30b894039ab25678a32847ce645e3e143d70196c5e64821e6bf2
6
+ metadata.gz: 66c2841a1c92f7a546dcc5beb8113dec4ae976f413422392d65c210807cb6e76c3899852949958fdda33007c597043dc37bf59fa6b1557bc5fbc92dd0fe2db81
7
+ data.tar.gz: 425c0d2658f1f03e1f12107c6d0da77035224304c7fd62083a2305416ea714775b28493f02308dc4570a4210f7761b07d8efc0019c1c71087e8c58233fc6bf81
data/lib/twilio-ruby.rb CHANGED
@@ -34,6 +34,17 @@ require 'twilio-ruby/rest/pricing/phone_numbers'
34
34
  require 'twilio-ruby/rest/pricing/voice/numbers'
35
35
  require 'twilio-ruby/rest/pricing/voice'
36
36
  require 'twilio-ruby/rest/pricing/messaging'
37
+ require 'twilio-ruby/rest/conversations/in_progress'
38
+ require 'twilio-ruby/rest/conversations/completed'
39
+ require 'twilio-ruby/rest/conversations/conversations'
40
+ require 'twilio-ruby/rest/conversations/participants'
41
+ require 'twilio-ruby/rest/ip-messaging/services'
42
+ require 'twilio-ruby/rest/ip-messaging/channels'
43
+ require 'twilio-ruby/rest/ip-messaging/members'
44
+ require 'twilio-ruby/rest/ip-messaging/messages'
45
+ require 'twilio-ruby/rest/ip-messaging/roles'
46
+ require 'twilio-ruby/rest/ip-messaging/users'
47
+ require 'twilio-ruby/rest/ip-messaging/credentials'
37
48
  require 'twilio-ruby/rest/sms'
38
49
  require 'twilio-ruby/rest/sms/short_codes'
39
50
  require 'twilio-ruby/rest/sms/messages'
@@ -95,10 +106,12 @@ require 'twilio-ruby/rest/notifications'
95
106
  require 'twilio-ruby/rest/addresses'
96
107
  require 'twilio-ruby/rest/addresses/dependent_phone_numbers'
97
108
  require 'twilio-ruby/rest/client'
109
+ require 'twilio-ruby/rest/conversations_client'
98
110
  require 'twilio-ruby/rest/task_router_client'
99
111
  require 'twilio-ruby/rest/lookups_client'
100
112
  require 'twilio-ruby/rest/pricing_client'
101
113
  require 'twilio-ruby/rest/monitor_client'
114
+ require 'twilio-ruby/rest/ip_messaging_client'
102
115
  require 'rack/twilio_webhook_authentication'
103
116
 
104
117
  module Twilio
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,23 @@
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
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,8 @@
1
+ module Twilio
2
+ module REST
3
+ module Conversations
4
+ class Participants < NextGenListResource; end
5
+ class Participant < InstanceResource; end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,99 @@
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
@@ -0,0 +1,21 @@
1
+ module Twilio
2
+ module REST
3
+ module IpMessaging
4
+ class Channels < NextGenListResource
5
+ def initialize(path, client)
6
+ @path, client = path, client
7
+ @submodule = :IpMessaging
8
+ end
9
+ end
10
+ class Channel < InstanceResource
11
+ def initialize(path, client, params={})
12
+ super
13
+ @submodule = :IpMessaging
14
+
15
+ resource :messages,
16
+ :members
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,22 @@
1
+ module Twilio
2
+ module REST
3
+ module IpMessaging
4
+ class Credentials < NextGenListResource
5
+ def initialize(path, client)
6
+ @path, @client = path, client
7
+ @submodule = :IpMessaging
8
+ end
9
+ end
10
+
11
+ class Credential < InstanceResource
12
+ def initialize(path, client, params={})
13
+ super
14
+ @submodule = :IpMessaging
15
+ resource :channels,
16
+ :users,
17
+ :roles
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,8 @@
1
+ module Twilio
2
+ module REST
3
+ module IpMessaging
4
+ class Members < NextGenListResource; end
5
+ class Member < InstanceResource; end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Twilio
2
+ module REST
3
+ module IpMessaging
4
+ class Messages < NextGenListResource; end
5
+ class Message < InstanceResource; end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Twilio
2
+ module REST
3
+ module IpMessaging
4
+ class Roles < NextGenListResource; end
5
+ class Role < InstanceResource; end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,22 @@
1
+ module Twilio
2
+ module REST
3
+ module IpMessaging
4
+ class Services < NextGenListResource
5
+ def initialize(path, client)
6
+ @path, @client = path, client
7
+ @submodule = :IpMessaging
8
+ end
9
+ end
10
+
11
+ class Service < InstanceResource
12
+ def initialize(path, client, params={})
13
+ super
14
+ @submodule = :IpMessaging
15
+ resource :channels,
16
+ :users,
17
+ :roles
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,8 @@
1
+ module Twilio
2
+ module REST
3
+ module IpMessaging
4
+ class Users < NextGenListResource; end
5
+ class User < InstanceResource; end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,100 @@
1
+ require 'twilio-ruby/rest/base_client'
2
+ module Twilio
3
+ module REST
4
+ class IpMessagingClient < BaseClient
5
+ API_VERSION = 'v1'
6
+
7
+ attr_reader :services, :credentials
8
+
9
+ host 'ip-messaging.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: 'ip-messaging.twilio.com'</tt>
20
+ #
21
+ # The domain to which you'd like the client to make HTTP requests. Useful
22
+ # for testing. Defaults to 'ip-messaging.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::IpMessagingClient @account_sid=#{@account_sid}>"
79
+ end
80
+
81
+ protected
82
+
83
+ ##
84
+ # Create subresource properties
85
+ def set_up_subresources # :doc:
86
+ @services = Twilio::REST::IpMessaging::Services.new "/#{API_VERSION}/Services", self
87
+ @credentials = Twilio::REST::IpMessaging::Credentials.new "/#{API_VERSION}/Credentials", self
88
+ end
89
+
90
+ ##
91
+ # Builds up full request path
92
+ def build_full_path(path, params, method)
93
+ path = path.dup
94
+ path << "?#{url_encode(params)}" if method == :get && !params.empty?
95
+ path
96
+ end
97
+
98
+ end
99
+ end
100
+ end
@@ -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,7 +46,8 @@ 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 = full_path ? @path.split('.')[0] : @path
49
+ path = @frozen_path ? @frozen_path : @path
50
+ path = full_path ? path.split('.')[0] : path
50
51
  resource_list = resources.map do |resource|
51
52
  @instance_class.new "#{path}/#{resource[@instance_id_key]}", @client,
52
53
  resource
@@ -80,7 +81,7 @@ module Twilio
80
81
  # attribute of the returned instance resource object, such as
81
82
  # its #date_created or #voice_url attributes.
82
83
  def get(sid)
83
- @instance_class.new "#{@path}/#{sid}", @client
84
+ @instance_class.new "#{@frozen_path || @path}/#{sid}", @client
84
85
  end
85
86
  alias :find :get # for the ActiveRecord lovers
86
87
 
@@ -4,11 +4,12 @@ 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'] if response['meta']
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
10
11
  resource_list = resources.map do |resource|
11
- @instance_class.new "#{@path}/#{resource[@instance_id_key]}", @client,
12
+ @instance_class.new "#{path}/#{resource[@instance_id_key]}", @client,
12
13
  resource
13
14
  end
14
15
  client, list_class = @client, self.class
@@ -19,6 +19,13 @@ 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
+
22
29
  def resource(*resources)
23
30
  custom_resource_names = { sms: 'SMS', sip: 'SIP' }
24
31
  resources.each do |r|
@@ -31,7 +38,11 @@ module Twilio
31
38
  Twilio::REST.const_get(@submodule)
32
39
  end
33
40
  resource_class = enclosing_module.const_get resource
34
- instance_variable_set("@#{r}", resource_class.new(path, @client))
41
+ resource_object = resource_class.new(path, @client)
42
+ instance_variable_set("@#{r}", resource_object)
43
+ if @frozen_path
44
+ resource_object.instance_variable_set(:@frozen_path, @frozen_path)
45
+ end
35
46
  end
36
47
  self.class.instance_eval { attr_reader *resources }
37
48
  end
@@ -1,3 +1,3 @@
1
1
  module Twilio
2
- VERSION = '4.5.0'
2
+ VERSION = '4.6.0.edge'
3
3
  end
@@ -0,0 +1,61 @@
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
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Twilio::REST::IpMessaging::Channels do
4
+ it 'sets up a members resources object' do
5
+ client = Twilio::REST::IpMessagingClient.new 'otherSid', 'otherToken'
6
+ service = Twilio::REST::IpMessaging::Channel.new '/v1/Services/1/Channels/1', client
7
+ expect(service).to respond_to(:members)
8
+ expect(service.members.instance_variable_get('@path')).to eq(
9
+ '/v1/Services/1/Channels/1/Members'
10
+ )
11
+ end
12
+
13
+ it 'sets up a messages resources object' do
14
+ client = Twilio::REST::IpMessagingClient.new 'otherSid', 'otherToken'
15
+ service = Twilio::REST::IpMessaging::Channel.new '/v1/Services/1/Channels/1', client
16
+ expect(service).to respond_to(:messages)
17
+ expect(service.messages.instance_variable_get('@path')).to eq(
18
+ '/v1/Services/1/Channels/1/Messages'
19
+ )
20
+ end
21
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe Twilio::REST::IpMessaging::Services do
4
+ it 'sets up a channels resources object' do
5
+ client = Twilio::REST::IpMessagingClient.new 'otherSid', 'otherToken'
6
+ service = Twilio::REST::IpMessaging::Service.new '/v1/Services', client
7
+ expect(service).to respond_to(:channels)
8
+ expect(service.channels.instance_variable_get('@path')).to eq(
9
+ '/v1/Services/Channels'
10
+ )
11
+ end
12
+
13
+ it 'sets up a roles resources object' do
14
+ client = Twilio::REST::IpMessagingClient.new 'otherSid', 'otherToken'
15
+ service = Twilio::REST::IpMessaging::Service.new '/v1/Services', client
16
+ expect(service).to respond_to(:roles)
17
+ expect(service.roles.instance_variable_get('@path')).to eq(
18
+ '/v1/Services/Roles'
19
+ )
20
+ end
21
+
22
+ it 'sets up a users resources object' do
23
+ client = Twilio::REST::IpMessagingClient.new 'otherSid', 'otherToken'
24
+ service = Twilio::REST::IpMessaging::Service.new '/v1/Services', client
25
+ expect(service).to respond_to(:users)
26
+ expect(service.users.instance_variable_get('@path')).to eq(
27
+ '/v1/Services/Users'
28
+ )
29
+ end
30
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Twilio::REST::IpMessagingClient do
4
+ before do
5
+ @client = Twilio::REST::IpMessagingClient.new('AC123', 'foobar')
6
+ end
7
+
8
+ it 'should set up a services resources object' do
9
+ expect(@client).to respond_to(:services)
10
+ expect(@client.services.instance_variable_get('@path')).to eq(
11
+ '/v1/Services'
12
+ )
13
+ end
14
+
15
+ it 'should set up a credentials resources object' do
16
+ expect(@client).to respond_to(:credentials)
17
+ expect(@client.credentials.instance_variable_get('@path')).to eq(
18
+ '/v1/Credentials'
19
+ )
20
+ end
21
+ end
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.5.0
4
+ version: 4.6.0.edge
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Benton
@@ -150,12 +150,25 @@ 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
153
158
  - lib/twilio-ruby/rest/errors.rb
154
159
  - lib/twilio-ruby/rest/incoming_phone_numbers.rb
155
160
  - lib/twilio-ruby/rest/incoming_phone_numbers/local.rb
156
161
  - lib/twilio-ruby/rest/incoming_phone_numbers/mobile.rb
157
162
  - lib/twilio-ruby/rest/incoming_phone_numbers/toll_free.rb
158
163
  - lib/twilio-ruby/rest/instance_resource.rb
164
+ - lib/twilio-ruby/rest/ip-messaging/channels.rb
165
+ - lib/twilio-ruby/rest/ip-messaging/credentials.rb
166
+ - lib/twilio-ruby/rest/ip-messaging/members.rb
167
+ - lib/twilio-ruby/rest/ip-messaging/messages.rb
168
+ - lib/twilio-ruby/rest/ip-messaging/roles.rb
169
+ - lib/twilio-ruby/rest/ip-messaging/services.rb
170
+ - lib/twilio-ruby/rest/ip-messaging/users.rb
171
+ - lib/twilio-ruby/rest/ip_messaging_client.rb
159
172
  - lib/twilio-ruby/rest/list_resource.rb
160
173
  - lib/twilio-ruby/rest/lookups/phone_numbers.rb
161
174
  - lib/twilio-ruby/rest/lookups_client.rb
@@ -225,6 +238,7 @@ files:
225
238
  - lib/twilio-ruby/util/configuration.rb
226
239
  - lib/twilio-ruby/util/request_validator.rb
227
240
  - lib/twilio-ruby/version.rb
241
+ - spec/conversations/conversations_spec.rb
228
242
  - spec/rack/twilio_webhook_authentication_spec.rb
229
243
  - spec/rest/account_spec.rb
230
244
  - spec/rest/address_spec.rb
@@ -233,7 +247,11 @@ files:
233
247
  - spec/rest/call_spec.rb
234
248
  - spec/rest/client_spec.rb
235
249
  - spec/rest/conference_spec.rb
250
+ - spec/rest/conversations_client_spec.rb
236
251
  - spec/rest/instance_resource_spec.rb
252
+ - spec/rest/ip-messaging/channel_spec.rb
253
+ - spec/rest/ip-messaging/service_spec.rb
254
+ - spec/rest/ip_messaging_client_spec.rb
237
255
  - spec/rest/lookups/phone_number_spec.rb
238
256
  - spec/rest/message_spec.rb
239
257
  - spec/rest/monitor_client_spec.rb
@@ -284,9 +302,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
284
302
  version: 1.9.3
285
303
  required_rubygems_version: !ruby/object:Gem::Requirement
286
304
  requirements:
287
- - - '>='
305
+ - - '>'
288
306
  - !ruby/object:Gem::Version
289
- version: '0'
307
+ version: 1.3.1
290
308
  requirements: []
291
309
  rubyforge_project:
292
310
  rubygems_version: 2.0.14
@@ -295,6 +313,7 @@ specification_version: 4
295
313
  summary: A simple library for communicating with the Twilio REST API, building TwiML,
296
314
  and generating Twilio Client Capability Tokens
297
315
  test_files:
316
+ - spec/conversations/conversations_spec.rb
298
317
  - spec/rack/twilio_webhook_authentication_spec.rb
299
318
  - spec/rest/account_spec.rb
300
319
  - spec/rest/address_spec.rb
@@ -303,7 +322,11 @@ test_files:
303
322
  - spec/rest/call_spec.rb
304
323
  - spec/rest/client_spec.rb
305
324
  - spec/rest/conference_spec.rb
325
+ - spec/rest/conversations_client_spec.rb
306
326
  - spec/rest/instance_resource_spec.rb
327
+ - spec/rest/ip-messaging/channel_spec.rb
328
+ - spec/rest/ip-messaging/service_spec.rb
329
+ - spec/rest/ip_messaging_client_spec.rb
307
330
  - spec/rest/lookups/phone_number_spec.rb
308
331
  - spec/rest/message_spec.rb
309
332
  - spec/rest/monitor_client_spec.rb