twilio-ruby 4.4.0 → 4.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +85 -0
  3. data/Makefile +3 -0
  4. data/README.md +1 -1
  5. data/issue_template.md +25 -0
  6. data/lib/twilio-ruby/rest/accounts.rb +1 -1
  7. data/lib/twilio-ruby/rest/base_client.rb +3 -2
  8. data/lib/twilio-ruby/rest/ip-messaging/channels.rb +15 -0
  9. data/lib/twilio-ruby/rest/ip-messaging/credentials.rb +19 -0
  10. data/lib/twilio-ruby/rest/ip-messaging/members.rb +8 -0
  11. data/lib/twilio-ruby/rest/ip-messaging/messages.rb +8 -0
  12. data/lib/twilio-ruby/rest/ip-messaging/roles.rb +8 -0
  13. data/lib/twilio-ruby/rest/ip-messaging/services.rb +17 -0
  14. data/lib/twilio-ruby/rest/ip-messaging/users.rb +8 -0
  15. data/lib/twilio-ruby/rest/ip_messaging_client.rb +100 -0
  16. data/lib/twilio-ruby/rest/keys.rb +6 -0
  17. data/lib/twilio-ruby/rest/pricing/messaging.rb +15 -0
  18. data/lib/twilio-ruby/rest/pricing/voice.rb +0 -3
  19. data/lib/twilio-ruby/rest/pricing_client.rb +2 -4
  20. data/lib/twilio-ruby/rest/trunking/credential_lists.rb +8 -0
  21. data/lib/twilio-ruby/rest/trunking/ip_access_control_lists.rb +8 -0
  22. data/lib/twilio-ruby/rest/trunking/origination_urls.rb +8 -0
  23. data/lib/twilio-ruby/rest/trunking/phone_numbers.rb +8 -0
  24. data/lib/twilio-ruby/rest/trunking/trunks.rb +19 -0
  25. data/lib/twilio-ruby/rest/trunking_client.rb +106 -0
  26. data/lib/twilio-ruby/task_router/capability.rb +11 -5
  27. data/lib/twilio-ruby/task_router/workflow_builder.rb +7 -1
  28. data/lib/twilio-ruby/util/access_token.rb +158 -0
  29. data/lib/twilio-ruby/version.rb +1 -1
  30. data/lib/twilio-ruby.rb +22 -0
  31. data/spec/rest/ip-messaging/channel_spec.rb +21 -0
  32. data/spec/rest/ip-messaging/service_spec.rb +30 -0
  33. data/spec/rest/ip_messaging_client_spec.rb +21 -0
  34. data/spec/rest/key_spec.rb +11 -0
  35. data/spec/rest/pricing_client_spec.rb +15 -0
  36. data/spec/rest/trunking/trunk_spec.rb +36 -0
  37. data/spec/task_router/workflow_builder_spec.rb +501 -0
  38. data/spec/task_router_deprecated_spec.rb +15 -6
  39. data/spec/task_router_worker_spec.rb +24 -7
  40. data/spec/util/access_token_spec.rb +161 -0
  41. metadata +35 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ecb07fd26a80b320199741a2ce2c188331969654
4
- data.tar.gz: 1dbdea6628f1a8f9f7bda6fd25d28b7ec30a4884
3
+ metadata.gz: 5c7218785a4a8f89282d46a51699076d4fc7e5a3
4
+ data.tar.gz: e7e159586b45af05889de6c68d92442f29cabff0
5
5
  SHA512:
6
- metadata.gz: 624f9abd8990248bea0fdbb3fc7a235cddd6ff0edbe197237dc6b048dea14a052a3200f237acaea47754b72f7d8b4e95dfafc274a48c7dc5bc145ded3b071726
7
- data.tar.gz: 5fb8fe1662af3af16b1efc90eb746ca78aa6a96d7eff2568574ffc23725e51518913367e2858ae9c028479845eec5332db3ccdaee6eb180493ea0f0306b5e2c7
6
+ metadata.gz: 01719027a188f42cfc14c6ed04b326eaaf7099bd6ac80a56072d06c5ffc60219b98c3a1df7848fc326129332042aff183823a871b922f69102fa6ed73e73df4a
7
+ data.tar.gz: 391720c612c6f76393cbbe82e30938311251df72c551db2b9679a6b483450c351043126a5b92247a8b5c90f5465bb58c4c2a5384d2a10558a7e30cda37aeb397
data/CHANGES.md CHANGED
@@ -1,6 +1,91 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ Version 4.13.0
5
+ --------------
6
+
7
+ Released September 19, 2016:
8
+
9
+ - Add VideoGrant.
10
+
11
+ Version 4.12.1
12
+ --------------
13
+
14
+ Released September 1, 2016:
15
+
16
+ - Add VoiceGrant.
17
+
18
+ Version 4.11.1
19
+ -------------
20
+
21
+ Released February 12, 2016:
22
+
23
+ - Add missing Keys mount to Account
24
+
25
+ Version 4.11.0
26
+ -------------
27
+
28
+ Released January 28, 2016:
29
+
30
+ - Add support for alternative auth (eg. Keys)
31
+
32
+ Version 4.10.0
33
+ -------------
34
+
35
+ Released January 28, 2016:
36
+
37
+ - Add support for filter_friendly_name in WorkflowConfig
38
+ - Load reservations by default in TaskRouter
39
+
40
+ Version 4.9.1
41
+ -------------
42
+
43
+ Release January 28, 2016
44
+
45
+ - Fix ip messaging first person grant
46
+
47
+ Version 4.9.0
48
+ -------------
49
+
50
+ Release December 17, 2015
51
+
52
+ - Release ip messaging
53
+
54
+ Version 4.8.0
55
+ -------------
56
+
57
+ Release December 8, 2015
58
+
59
+ - Make nbf optional
60
+
61
+ Version 4.7.0
62
+ -------------
63
+
64
+ Release December 3, 2015
65
+
66
+ - Add access tokens
67
+
68
+ Version 4.6.2
69
+ -------------
70
+
71
+ Release November 19, 2015
72
+
73
+ - Fix Pricing Messages
74
+
75
+ Version 4.6.1
76
+ -------------
77
+
78
+ Release November 10, 2015
79
+
80
+ - Fix TrunkingClient references
81
+
82
+ Version 4.6.0
83
+ -------------
84
+
85
+ Release October 28, 2015
86
+
87
+ - Add /Keys endpoint
88
+
4
89
  Version 4.4.0
5
90
  -------------
6
91
 
data/Makefile CHANGED
@@ -10,3 +10,6 @@ test:
10
10
  authors:
11
11
  echo "Authors\n=======\n\nA huge thanks to all of our contributors:\n\n" > AUTHORS.md
12
12
  git log --raw | grep "^Author: " | cut -d ' ' -f2- | cut -d '<' -f1 | sed 's/^/- /' | sort | uniq >> AUTHORS.md
13
+
14
+ deploy:
15
+ bundle exec rake build | sed -e 's/.*pkg/pkg/g' | sed -e "s/\.$$//g" | xargs gem push
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', '~> 4.2.1'
14
+ gem 'twilio-ruby', '~> 4.11.1'
15
15
  ```
16
16
 
17
17
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
data/issue_template.md ADDED
@@ -0,0 +1,25 @@
1
+ *Note: These issues are for bugs and feature requests for the helper libraries. If you need help or support, please email help@twilio.com and one of our experts will assist you!*
2
+
3
+
4
+ **Version:**
5
+ **API Subdomain (api/taskrouter/ip_messaging):**
6
+
7
+ ### Code Snippet
8
+ ```ruby
9
+ # paste code here
10
+ ```
11
+
12
+ ### Exception / Log
13
+ ```
14
+ <place exception / log here>
15
+ ```
16
+
17
+ ### Steps to Reproduce
18
+ 1.
19
+ 2.
20
+ 3.
21
+
22
+
23
+ ### Feature Request
24
+ _If this is a feature request, make sure you search Issues for an existing request before creating a new one!_
25
+
@@ -9,7 +9,7 @@ module Twilio
9
9
  :calls, :outgoing_caller_ids, :conferences, :sms, :recordings,
10
10
  :transcriptions, :notifications, :applications, :connect_apps,
11
11
  :authorized_connect_apps, :queues, :usage, :messages, :media, :sip,
12
- :tokens, :addresses
12
+ :tokens, :addresses, :keys
13
13
  end
14
14
  end
15
15
  end
@@ -26,8 +26,9 @@ module Twilio
26
26
  options[:host] ||= self.class.host
27
27
  @config = Twilio::Util::ClientConfig.new options
28
28
 
29
- @account_sid = args[0] || Twilio.account_sid
29
+ @username = args[0] || Twilio.account_sid
30
30
  @auth_token = args[1] || Twilio.auth_token
31
+ @account_sid = (args.size > 2 && args[2].is_a?(String) ? args[2] : args[0]) || Twilio.account_sid
31
32
  if @account_sid.nil? || @auth_token.nil?
32
33
  raise ArgumentError, 'Account SID and auth token are required'
33
34
  end
@@ -49,7 +50,7 @@ module Twilio
49
50
  # build the full path unless already given
50
51
  path = build_full_path(path, params, method) unless args[1]
51
52
  request = method_class.new(path, HTTP_HEADERS)
52
- request.basic_auth(@account_sid, @auth_token)
53
+ request.basic_auth(@username, @auth_token)
53
54
  request.form_data = params if [:post, :put].include?(method)
54
55
  connect_and_send(request)
55
56
  end
@@ -0,0 +1,15 @@
1
+ module Twilio
2
+ module REST
3
+ module IpMessaging
4
+ class Channels < NextGenListResource; end
5
+ class Channel < InstanceResource
6
+ def initialize(path, client, params={})
7
+ super
8
+ @submodule = :IpMessaging
9
+ resource :messages,
10
+ :members
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
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
+ end
16
+ end
17
+ end
18
+ end
19
+ 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,17 @@
1
+ module Twilio
2
+ module REST
3
+ module IpMessaging
4
+ class Services < NextGenListResource; end
5
+
6
+ class Service < InstanceResource
7
+ def initialize(path, client, params={})
8
+ super
9
+ @submodule = :IpMessaging
10
+ resource :channels,
11
+ :users,
12
+ :roles
13
+ end
14
+ end
15
+ end
16
+ end
17
+ 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
@@ -0,0 +1,6 @@
1
+ module Twilio
2
+ module REST
3
+ class Keys < ListResource; end
4
+ class Key < InstanceResource; end
5
+ end
6
+ end
@@ -0,0 +1,15 @@
1
+ module Twilio
2
+ module REST
3
+ module Pricing
4
+ class Messaging < InstanceResource
5
+
6
+ def initialize(path, client, params={})
7
+ super
8
+ @submodule = :Pricing
9
+ resource :countries
10
+ end
11
+
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,6 +1,3 @@
1
- require 'twilio-ruby/rest/pricing/countries'
2
- require 'twilio-ruby/rest/pricing/voice/numbers'
3
-
4
1
  module Twilio
5
2
  module REST
6
3
  module Pricing
@@ -1,7 +1,4 @@
1
1
  require 'twilio-ruby/rest/base_client'
2
- require 'twilio-ruby/rest/pricing'
3
- require 'twilio-ruby/rest/pricing/voice'
4
- require 'twilio-ruby/rest/pricing/phone_numbers'
5
2
 
6
3
  module Twilio
7
4
  module REST
@@ -11,7 +8,7 @@ module Twilio
11
8
 
12
9
  API_VERSION = 'v1'
13
10
 
14
- attr_reader :voice, :phone_numbers
11
+ attr_reader :voice, :phone_numbers, :messaging
15
12
 
16
13
  host 'pricing.twilio.com'
17
14
 
@@ -96,6 +93,7 @@ module Twilio
96
93
  def set_up_subresources # :doc:
97
94
  @voice = Twilio::REST::Pricing::Voice.new "/#{API_VERSION}/Voice", self
98
95
  @phone_numbers = Twilio::REST::Pricing::PhoneNumbers.new "/#{API_VERSION}/PhoneNumbers", self
96
+ @messaging = Twilio::REST::Pricing::Messaging.new "/#{API_VERSION}/Messaging", self
99
97
  end
100
98
 
101
99
  ##
@@ -0,0 +1,8 @@
1
+ module Twilio
2
+ module REST
3
+ module Trunking
4
+ class CredentialLists < NextGenListResource; end
5
+ class CredentialList < InstanceResource; end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Twilio
2
+ module REST
3
+ module Trunking
4
+ class IpAccessControlLists < NextGenListResource; end
5
+ class IpAccessControlList < InstanceResource; end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Twilio
2
+ module REST
3
+ module Trunking
4
+ class OriginationUrls < NextGenListResource; end
5
+ class OriginationUrl < InstanceResource; end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Twilio
2
+ module REST
3
+ module Trunking
4
+ class PhoneNumbers < NextGenListResource; end
5
+ class PhoneNumber < InstanceResource; end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,19 @@
1
+ module Twilio
2
+ module REST
3
+ module Trunking
4
+ class Trunks < NextGenListResource; end
5
+ class Trunk < InstanceResource
6
+
7
+ def initialize(path, client, params={})
8
+ super
9
+ @submodule = :Trunking
10
+ resource :credential_lists,
11
+ :ip_access_control_lists,
12
+ :origination_urls,
13
+ :phone_numbers
14
+ end
15
+
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,106 @@
1
+ require 'twilio-ruby/rest/base_client'
2
+
3
+ module Twilio
4
+ module REST
5
+ class TrunkingClient < BaseClient
6
+ include Twilio::Util
7
+ include Twilio::REST::Utils
8
+
9
+ API_VERSION = 'v1'
10
+
11
+ attr_reader :trunks
12
+
13
+ host 'trunking.twilio.com'
14
+
15
+ ##
16
+ # Instantiate a new HTTP client to talk to Twilio's Trunking API. The
17
+ # parameters +account_sid+ and +auth_token+ are required, unless you have
18
+ # configured them already using the block configure syntax, and used to
19
+ # generate the HTTP basic auth header in each request. The +options+
20
+ # parameter is a hash of connection configuration options. the following
21
+ # keys are supported:
22
+ #
23
+ # === <tt>host: 'trunking.twilio.com'</tt>
24
+ #
25
+ # The domain to which you'd like the client to make HTTP requests. Useful
26
+ # for testing. Defaults to 'trunking.twilio.com'.
27
+ #
28
+ # === <tt>port: 443</tt>
29
+ #
30
+ # The port on which to connect to the above domain. Defaults to 443 and
31
+ # should be left that way except in testing environments.
32
+ #
33
+ # === <tt>use_ssl: true</tt>
34
+ #
35
+ # Declare whether ssl should be used for connections to the above domain.
36
+ # Defaults to true and should be left alone except when testing.
37
+ #
38
+ # === <tt>ssl_verify_peer: true</tt>
39
+ #
40
+ # Declare whether to verify the host's ssl cert when setting up the
41
+ # connection to the above domain. Defaults to true, but can be turned off
42
+ # to avoid ssl certificate verification failures in environments without
43
+ # the necessary ca certificates.
44
+ #
45
+ # === <tt>ssl_ca_file: '/path/to/ca/file'</tt>
46
+ #
47
+ # Specify the path to the certificate authority bundle you'd like to use
48
+ # to verify Twilio's SSL certificate on each request. If not specified, a
49
+ # certificate bundle extraced from Firefox is packaged with the gem and
50
+ # used by default.
51
+ #
52
+ # === <tt>timeout: 30</tt>
53
+ #
54
+ # Set the time in seconds to wait before timing out the HTTP request.
55
+ # Defaults to 30 seconds. If you aren't fetching giant pages of call or
56
+ # SMS logs you can safely decrease this to something like 3 seconds or
57
+ # lower. In paricular if you are sending SMS you can set this to 1 second
58
+ # or less and swallow the exception if you don't care about the response.
59
+ #
60
+ # === <tt>proxy_addr: 'proxy.host.domain'</tt>
61
+ #
62
+ # The domain of a proxy through which you'd like the client to make HTTP
63
+ # requests. Defaults to nil.
64
+ #
65
+ # === <tt>proxy_port: 3128</tt>
66
+ #
67
+ # The port on which to connect to the above proxy. Defaults to nil.
68
+ #
69
+ # === <tt>proxy_user: 'username'</tt>
70
+ #
71
+ # The user name to use for authentication with the proxy. Defaults to nil.
72
+ #
73
+ # === <tt>proxy_pass: 'password'</tt>
74
+ #
75
+ # The password to use for authentication with the proxy. Defaults to nil.
76
+ #
77
+ # === <tt>retry_limit: 1</tt>
78
+ #
79
+ # The number of times to retry a request that has failed before throwing
80
+ # an exception. Defaults to one.
81
+ def initialize(*args)
82
+ super(*args)
83
+ end
84
+
85
+ def inspect # :nodoc:
86
+ "<Twilio::REST::TrunkingClient @account_sid=#{@account_sid}>"
87
+ end
88
+
89
+ protected
90
+
91
+ ##
92
+ # Set up +trunks+ attribute.
93
+ def set_up_subresources # :doc:
94
+ @trunks = Twilio::REST::Trunking::Trunks.new "/#{API_VERSION}/Trunks", self
95
+ end
96
+
97
+ ##
98
+ # Builds up full request path
99
+ def build_full_path(path, params, method)
100
+ path = path.dup
101
+ path << "?#{url_encode(params)}" if method == :get && !params.empty?
102
+ path
103
+ end
104
+ end
105
+ end
106
+ end
@@ -136,8 +136,11 @@ module Twilio
136
136
  @activityUrl = @baseUrl + "/Activities"
137
137
  allow(@activityUrl, "GET")
138
138
 
139
- @reservationsUrl = @baseUrl + "/Tasks/**"
140
- allow(@reservationsUrl, "GET")
139
+ @tasksUrl = @baseUrl + "/Tasks/**"
140
+ allow(@tasksUrl, "GET")
141
+
142
+ @workerReservationsUrl = @resourceUrl + "/Reservations/**"
143
+ allow(@workerReservationsUrl, "GET")
141
144
 
142
145
  elsif(@channel_id[0..1] == 'WQ')
143
146
  @resourceUrl = @baseUrl + "/TaskQueues/" + @channel_id
@@ -171,11 +174,13 @@ module Twilio
171
174
 
172
175
  def initialize(account_sid, auth_token, workspace_sid, worker_sid)
173
176
  super(account_sid, auth_token, workspace_sid, worker_sid)
174
- @reservationsUrl = @baseUrl + "/Tasks/**"
177
+ @tasksUrl = @baseUrl + "/Tasks/**"
175
178
  @activityUrl = @baseUrl + "/Activities"
179
+ @workerReservationsUrl = @resourceUrl + "/Reservations/**"
176
180
 
177
181
  allow(@activityUrl, "GET")
178
- allow(@reservationsUrl, "GET")
182
+ allow(@tasksUrl, "GET")
183
+ allow(@workerReservationsUrl, "GET")
179
184
  end
180
185
 
181
186
  def allow_activity_updates
@@ -183,7 +188,8 @@ module Twilio
183
188
  end
184
189
 
185
190
  def allow_reservation_updates
186
- allow(@reservationsUrl, "POST", nil, nil)
191
+ allow(@tasksUrl, "POST", nil, nil)
192
+ allow(@workerReservationsUrl, "POST", nil, nil)
187
193
  end
188
194
 
189
195
  protected
@@ -79,7 +79,13 @@ module Twilio
79
79
  rule['targets'].each do |target|
80
80
  targets.push(Twilio::TaskRouter::WorkflowRuleTarget.parse_json(target))
81
81
  end
82
- Twilio::TaskRouter::WorkflowRule.new rule['expression'], targets, rule['friendly_name']
82
+ unless rule['filter_friendly_name'].nil?
83
+ friendly_name = rule['filter_friendly_name']
84
+ end
85
+ unless rule['friendly_name'].nil?
86
+ friendly_name = rule['friendly_name']
87
+ end
88
+ Twilio::TaskRouter::WorkflowRule.new rule['expression'], targets, friendly_name
83
89
  end
84
90
  end
85
91
  class WorkflowRuleTarget