twilio-ruby 5.0.0.rc16 → 5.0.0.rc17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHORS.md +1 -0
- data/CHANGES.md +1 -1
- data/README.md +2 -2
- data/lib/twilio-ruby/jwt/access_token.rb +23 -1
- data/lib/twilio-ruby/rest/api.rb +2 -2
- data/lib/twilio-ruby/rest/api/v2010.rb +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account.rb +19 -11
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +29 -5
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +5 -5
- data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +25 -0
- data/lib/twilio-ruby/rest/api/v2010/account/short_code.rb +406 -0
- data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb +2 -6
- data/lib/twilio-ruby/rest/{notifications.rb → chat.rb} +6 -6
- data/lib/twilio-ruby/rest/{notifications → chat}/v1.rb +3 -3
- data/lib/twilio-ruby/rest/{notifications → chat}/v1/credential.rb +5 -5
- data/lib/twilio-ruby/rest/chat/v1/service.rb +501 -0
- data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +468 -0
- data/lib/twilio-ruby/rest/chat/v1/service/channel/member.rb +351 -0
- data/lib/twilio-ruby/rest/{api/v2010/account/sms/sms_message.rb → chat/v1/service/channel/message.rb} +120 -168
- data/lib/twilio-ruby/rest/chat/v1/service/role.rb +373 -0
- data/lib/twilio-ruby/rest/chat/v1/service/user.rb +378 -0
- data/lib/twilio-ruby/rest/client.rb +19 -8
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +3 -1
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +2 -6
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +5 -1
- data/lib/twilio-ruby/rest/lookups/v1/phone_number.rb +5 -0
- data/lib/twilio-ruby/rest/notify.rb +44 -0
- data/lib/twilio-ruby/rest/notify/v1.rb +44 -0
- data/lib/twilio-ruby/rest/notify/v1/credential.rb +375 -0
- data/lib/twilio-ruby/rest/{notifications → notify}/v1/service.rb +5 -5
- data/lib/twilio-ruby/rest/{notifications → notify}/v1/service/binding.rb +5 -5
- data/lib/twilio-ruby/rest/{notifications → notify}/v1/service/notification.rb +4 -4
- data/lib/twilio-ruby/rest/preview.rb +11 -0
- data/lib/twilio-ruby/rest/preview/sync.rb +35 -0
- data/lib/twilio-ruby/rest/preview/sync/service.rb +458 -0
- data/lib/twilio-ruby/rest/preview/sync/service/document.rb +376 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_list.rb +375 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb +409 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_map.rb +375 -0
- data/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb +411 -0
- data/lib/twilio-ruby/rest/preview/wireless/device.rb +6 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +55 -3
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +29 -6
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb +294 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +32 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb +374 -0
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/conference/participant_spec.rb +6 -6
- data/spec/integration/api/v2010/account/recording_spec.rb +10 -1
- data/spec/integration/api/v2010/account/{sms/short_code_spec.rb → short_code_spec.rb} +0 -7
- data/spec/integration/api/v2010/account/sip/credential_list/credential_spec.rb +3 -7
- data/spec/integration/chat/v1/credential_spec.rb +223 -0
- data/spec/integration/chat/v1/service/channel/member_spec.rb +213 -0
- data/spec/integration/chat/v1/service/channel/message_spec.rb +100 -0
- data/spec/integration/chat/v1/service/channel_spec.rb +259 -0
- data/spec/integration/chat/v1/service/role_spec.rb +263 -0
- data/spec/integration/chat/v1/service/user_spec.rb +242 -0
- data/spec/integration/chat/v1/service_spec.rb +263 -0
- data/spec/integration/ip_messaging/v1/service/role_spec.rb +2 -3
- data/spec/integration/ip_messaging/v1/service/user_spec.rb +2 -3
- data/spec/integration/lookups/v1/phone_number_spec.rb +5 -0
- data/spec/integration/{notifications → notify}/v1/credential_spec.rb +24 -24
- data/spec/integration/{notifications → notify}/v1/service/binding_spec.rb +29 -29
- data/spec/integration/{notifications → notify}/v1/service/notification_spec.rb +5 -5
- data/spec/integration/{notifications → notify}/v1/service_spec.rb +32 -32
- data/spec/integration/preview/sync/service/document_spec.rb +92 -0
- data/spec/integration/preview/sync/service/sync_list/sync_list_item_spec.rb +100 -0
- data/spec/integration/preview/sync/service/sync_list_spec.rb +73 -0
- data/spec/integration/preview/sync/service/sync_map/sync_map_item_spec.rb +101 -0
- data/spec/integration/preview/sync/service/sync_map_spec.rb +73 -0
- data/spec/integration/preview/sync/service_spec.rb +84 -0
- data/spec/integration/taskrouter/v1/workspace/task_channel_spec.rb +127 -0
- data/spec/integration/taskrouter/v1/workspace/task_spec.rb +8 -0
- data/spec/integration/taskrouter/v1/workspace/worker/worker_channel_spec.rb +201 -0
- data/spec/integration/taskrouter/v1/workspace/workflow_spec.rb +2 -3
- data/spec/integration/taskrouter/v1/workspace_spec.rb +8 -0
- data/spec/jwt/access_token_spec.rb +27 -0
- metadata +84 -42
- data/lib/twilio-ruby/rest/api/v2010/account/sms.rb +0 -134
- data/lib/twilio-ruby/rest/api/v2010/account/sms/short_code.rb +0 -408
- data/spec/integration/api/v2010/account/sms/sms_message_spec.rb +0 -275
- data/spec/integration/api/v2010/account/sms_spec.rb +0 -10
@@ -0,0 +1,127 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
require 'spec_helper.rb'
|
8
|
+
|
9
|
+
describe 'TaskChannel' do
|
10
|
+
it "can fetch" do
|
11
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
12
|
+
|
13
|
+
expect {
|
14
|
+
@client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
15
|
+
.task_channels("TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
16
|
+
}.to raise_exception(Twilio::REST::TwilioException)
|
17
|
+
|
18
|
+
values = {}
|
19
|
+
expect(
|
20
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
21
|
+
method: 'get',
|
22
|
+
url: 'https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskChannels/TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
23
|
+
))).to eq(true)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "receives fetch responses" do
|
27
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
28
|
+
200,
|
29
|
+
%q[
|
30
|
+
{
|
31
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
32
|
+
"date_created": "2014-05-14T10:50:02Z",
|
33
|
+
"date_updated": "2014-05-14T23:26:06Z",
|
34
|
+
"friendly_name": "Default",
|
35
|
+
"sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
36
|
+
"unique_name": "default",
|
37
|
+
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskChannels/TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
38
|
+
"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
39
|
+
}
|
40
|
+
]
|
41
|
+
))
|
42
|
+
|
43
|
+
actual = @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
44
|
+
.task_channels("TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
45
|
+
|
46
|
+
expect(actual).to_not eq(nil)
|
47
|
+
end
|
48
|
+
|
49
|
+
it "can read" do
|
50
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
51
|
+
|
52
|
+
expect {
|
53
|
+
@client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
54
|
+
.task_channels.list()
|
55
|
+
}.to raise_exception(Twilio::REST::TwilioException)
|
56
|
+
|
57
|
+
values = {}
|
58
|
+
expect(
|
59
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
60
|
+
method: 'get',
|
61
|
+
url: 'https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskChannels',
|
62
|
+
))).to eq(true)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "receives read_full responses" do
|
66
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
67
|
+
200,
|
68
|
+
%q[
|
69
|
+
{
|
70
|
+
"channels": [
|
71
|
+
{
|
72
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
73
|
+
"date_created": "2014-05-14T10:50:02Z",
|
74
|
+
"date_updated": "2014-05-14T23:26:06Z",
|
75
|
+
"friendly_name": "Default",
|
76
|
+
"sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
77
|
+
"unique_name": "default",
|
78
|
+
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskChannels/TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
79
|
+
"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
80
|
+
}
|
81
|
+
],
|
82
|
+
"meta": {
|
83
|
+
"first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskChannels?PageSize=50&Page=0",
|
84
|
+
"key": "channels",
|
85
|
+
"last_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskChannels?PageSize=50&Page=0",
|
86
|
+
"next_page_url": null,
|
87
|
+
"page": 0,
|
88
|
+
"page_size": 1,
|
89
|
+
"previous_page_url": null,
|
90
|
+
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskChannels?PageSize=50&Page=0"
|
91
|
+
}
|
92
|
+
}
|
93
|
+
]
|
94
|
+
))
|
95
|
+
|
96
|
+
actual = @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
97
|
+
.task_channels.list()
|
98
|
+
|
99
|
+
expect(actual).to_not eq(nil)
|
100
|
+
end
|
101
|
+
|
102
|
+
it "receives read_empty responses" do
|
103
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
104
|
+
200,
|
105
|
+
%q[
|
106
|
+
{
|
107
|
+
"channels": [],
|
108
|
+
"meta": {
|
109
|
+
"first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskChannels?PageSize=50&Page=0",
|
110
|
+
"key": "channels",
|
111
|
+
"last_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskChannels?PageSize=50&Page=0",
|
112
|
+
"next_page_url": null,
|
113
|
+
"page": 0,
|
114
|
+
"page_size": 50,
|
115
|
+
"previous_page_url": null,
|
116
|
+
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskChannels?PageSize=50&Page=0"
|
117
|
+
}
|
118
|
+
}
|
119
|
+
]
|
120
|
+
))
|
121
|
+
|
122
|
+
actual = @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
123
|
+
.task_channels.list()
|
124
|
+
|
125
|
+
expect(actual).to_not eq(nil)
|
126
|
+
end
|
127
|
+
end
|
@@ -38,6 +38,8 @@ describe 'Task' do
|
|
38
38
|
"reason": "Test Reason",
|
39
39
|
"sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
40
40
|
"task_queue_sid": "WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
41
|
+
"task_channel_sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
42
|
+
"task_channel_unique_name": "task-channel",
|
41
43
|
"timeout": 60,
|
42
44
|
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks/WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
43
45
|
"workflow_sid": "WFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
@@ -83,6 +85,8 @@ describe 'Task' do
|
|
83
85
|
"reason": "Test Reason",
|
84
86
|
"sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
85
87
|
"task_queue_sid": "WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
88
|
+
"task_channel_sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
89
|
+
"task_channel_unique_name": "task-channel",
|
86
90
|
"timeout": 60,
|
87
91
|
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks/WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
88
92
|
"workflow_sid": "WFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
@@ -168,6 +172,8 @@ describe 'Task' do
|
|
168
172
|
"reason": "Test Reason",
|
169
173
|
"sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
170
174
|
"task_queue_sid": "WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
175
|
+
"task_channel_sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
176
|
+
"task_channel_unique_name": "task-channel",
|
171
177
|
"timeout": 60,
|
172
178
|
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks/WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
173
179
|
"workflow_sid": "WFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
@@ -245,6 +251,8 @@ describe 'Task' do
|
|
245
251
|
"reason": "Test Reason",
|
246
252
|
"sid": "WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
247
253
|
"task_queue_sid": "WQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
254
|
+
"task_channel_sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
255
|
+
"task_channel_unique_name": "task-channel",
|
248
256
|
"timeout": 60,
|
249
257
|
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Tasks/WTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
250
258
|
"workflow_sid": "WFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
@@ -0,0 +1,201 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
require 'spec_helper.rb'
|
8
|
+
|
9
|
+
describe 'WorkerChannel' do
|
10
|
+
it "can read" do
|
11
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
12
|
+
|
13
|
+
expect {
|
14
|
+
@client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
15
|
+
.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
16
|
+
.worker_channels.list()
|
17
|
+
}.to raise_exception(Twilio::REST::TwilioException)
|
18
|
+
|
19
|
+
values = {}
|
20
|
+
expect(
|
21
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
22
|
+
method: 'get',
|
23
|
+
url: 'https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels',
|
24
|
+
))).to eq(true)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "receives read_full responses" do
|
28
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
29
|
+
200,
|
30
|
+
%q[
|
31
|
+
{
|
32
|
+
"meta": {
|
33
|
+
"first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels?PageSize=50&Page=0",
|
34
|
+
"key": "channels",
|
35
|
+
"next_page_url": null,
|
36
|
+
"page": 0,
|
37
|
+
"page_size": 1,
|
38
|
+
"previous_page_url": null,
|
39
|
+
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels"
|
40
|
+
},
|
41
|
+
"channels": [
|
42
|
+
{
|
43
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
44
|
+
"assigned_tasks": 0,
|
45
|
+
"available": true,
|
46
|
+
"available_capacity_percentage": 100,
|
47
|
+
"configured_capacity": 1,
|
48
|
+
"date_created": "2014-05-14T10:50:02Z",
|
49
|
+
"date_updated": "2014-05-15T16:03:42Z",
|
50
|
+
"links": {
|
51
|
+
"taskchannel": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskChannels/TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
52
|
+
"worker": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
53
|
+
"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
54
|
+
},
|
55
|
+
"sid": "WCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
56
|
+
"task_channel_sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
57
|
+
"task_channel_unique_name": "default",
|
58
|
+
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
59
|
+
"worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
60
|
+
"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
61
|
+
}
|
62
|
+
]
|
63
|
+
}
|
64
|
+
]
|
65
|
+
))
|
66
|
+
|
67
|
+
actual = @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
68
|
+
.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
69
|
+
.worker_channels.list()
|
70
|
+
|
71
|
+
expect(actual).to_not eq(nil)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "receives read_empty responses" do
|
75
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
76
|
+
200,
|
77
|
+
%q[
|
78
|
+
{
|
79
|
+
"meta": {
|
80
|
+
"first_page_url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels?PageSize=50&Page=0",
|
81
|
+
"key": "channels",
|
82
|
+
"next_page_url": null,
|
83
|
+
"page": 0,
|
84
|
+
"page_size": 1,
|
85
|
+
"previous_page_url": null,
|
86
|
+
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels"
|
87
|
+
},
|
88
|
+
"channels": []
|
89
|
+
}
|
90
|
+
]
|
91
|
+
))
|
92
|
+
|
93
|
+
actual = @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
94
|
+
.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
95
|
+
.worker_channels.list()
|
96
|
+
|
97
|
+
expect(actual).to_not eq(nil)
|
98
|
+
end
|
99
|
+
|
100
|
+
it "can fetch" do
|
101
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
102
|
+
|
103
|
+
expect {
|
104
|
+
@client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
105
|
+
.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
106
|
+
.worker_channels("WCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
107
|
+
}.to raise_exception(Twilio::REST::TwilioException)
|
108
|
+
|
109
|
+
values = {}
|
110
|
+
expect(
|
111
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
112
|
+
method: 'get',
|
113
|
+
url: 'https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/WCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
114
|
+
))).to eq(true)
|
115
|
+
end
|
116
|
+
|
117
|
+
it "receives fetch responses" do
|
118
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
119
|
+
200,
|
120
|
+
%q[
|
121
|
+
{
|
122
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
123
|
+
"assigned_tasks": 0,
|
124
|
+
"available": true,
|
125
|
+
"available_capacity_percentage": 100,
|
126
|
+
"configured_capacity": 1,
|
127
|
+
"date_created": "2014-05-14T10:50:02Z",
|
128
|
+
"date_updated": "2014-05-15T16:03:42Z",
|
129
|
+
"links": {
|
130
|
+
"taskchannel": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskChannels/TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
131
|
+
"worker": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
132
|
+
"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
133
|
+
},
|
134
|
+
"sid": "WCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
135
|
+
"task_channel_sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
136
|
+
"task_channel_unique_name": "default",
|
137
|
+
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
138
|
+
"worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
139
|
+
"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
140
|
+
}
|
141
|
+
]
|
142
|
+
))
|
143
|
+
|
144
|
+
actual = @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
145
|
+
.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
146
|
+
.worker_channels("WCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch()
|
147
|
+
|
148
|
+
expect(actual).to_not eq(nil)
|
149
|
+
end
|
150
|
+
|
151
|
+
it "can update" do
|
152
|
+
@holodeck.mock(Twilio::TwilioResponse.new(500, ''))
|
153
|
+
|
154
|
+
expect {
|
155
|
+
@client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
156
|
+
.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
157
|
+
.worker_channels("WCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
|
158
|
+
}.to raise_exception(Twilio::REST::TwilioException)
|
159
|
+
|
160
|
+
values = {}
|
161
|
+
expect(
|
162
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
163
|
+
method: 'post',
|
164
|
+
url: 'https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/WCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
165
|
+
))).to eq(true)
|
166
|
+
end
|
167
|
+
|
168
|
+
it "receives update responses" do
|
169
|
+
@holodeck.mock(Twilio::TwilioResponse.new(
|
170
|
+
200,
|
171
|
+
%q[
|
172
|
+
{
|
173
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
174
|
+
"assigned_tasks": 0,
|
175
|
+
"available": true,
|
176
|
+
"available_capacity_percentage": 100,
|
177
|
+
"configured_capacity": 3,
|
178
|
+
"date_created": "2014-05-14T10:50:02Z",
|
179
|
+
"date_updated": "2014-05-15T16:03:42Z",
|
180
|
+
"links": {
|
181
|
+
"taskchannel": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/TaskChannels/TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
182
|
+
"worker": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
183
|
+
"workspace": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
184
|
+
},
|
185
|
+
"sid": "WCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
186
|
+
"task_channel_sid": "TCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
187
|
+
"task_channel_unique_name": "default",
|
188
|
+
"url": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers/WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/WRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
189
|
+
"worker_sid": "WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
190
|
+
"workspace_sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
191
|
+
}
|
192
|
+
]
|
193
|
+
))
|
194
|
+
|
195
|
+
actual = @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
196
|
+
.workers("WKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
197
|
+
.worker_channels("WCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update()
|
198
|
+
|
199
|
+
expect(actual).to_not eq(nil)
|
200
|
+
end
|
201
|
+
end
|
@@ -209,13 +209,12 @@ describe 'Workflow' do
|
|
209
209
|
|
210
210
|
expect {
|
211
211
|
@client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
212
|
-
.workflows.create(friendly_name: "friendly_name", configuration: "configuration"
|
212
|
+
.workflows.create(friendly_name: "friendly_name", configuration: "configuration")
|
213
213
|
}.to raise_exception(Twilio::REST::TwilioException)
|
214
214
|
|
215
215
|
values = {
|
216
216
|
'FriendlyName' => "friendly_name",
|
217
217
|
'Configuration' => "configuration",
|
218
|
-
'AssignmentCallbackUrl' => "https://example.com",
|
219
218
|
}
|
220
219
|
expect(
|
221
220
|
@holodeck.has_request?(Holodeck::Request.new(
|
@@ -247,7 +246,7 @@ describe 'Workflow' do
|
|
247
246
|
))
|
248
247
|
|
249
248
|
actual = @client.taskrouter.v1.workspaces("WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
|
250
|
-
.workflows.create(friendly_name: "friendly_name", configuration: "configuration"
|
249
|
+
.workflows.create(friendly_name: "friendly_name", configuration: "configuration")
|
251
250
|
|
252
251
|
expect(actual).to_not eq(nil)
|
253
252
|
end
|
@@ -33,6 +33,7 @@ describe 'Workspace' do
|
|
33
33
|
"default_activity_name": "Offline",
|
34
34
|
"default_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
35
35
|
"event_callback_url": "",
|
36
|
+
"events_filter": "",
|
36
37
|
"friendly_name": "8064de33-3a05-11e5-8bae-98e0d9a1eb73",
|
37
38
|
"links": {
|
38
39
|
"activities": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities",
|
@@ -42,6 +43,7 @@ describe 'Workspace' do
|
|
42
43
|
"workers": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers",
|
43
44
|
"workflows": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workflows"
|
44
45
|
},
|
46
|
+
"multi_task_enabled": "false",
|
45
47
|
"sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
46
48
|
"timeout_activity_name": "Offline",
|
47
49
|
"timeout_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
@@ -81,6 +83,7 @@ describe 'Workspace' do
|
|
81
83
|
"default_activity_name": "Offline",
|
82
84
|
"default_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
83
85
|
"event_callback_url": "",
|
86
|
+
"events_filter": "",
|
84
87
|
"friendly_name": "8064de33-3a05-11e5-8bae-98e0d9a1eb73",
|
85
88
|
"links": {
|
86
89
|
"activities": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities",
|
@@ -90,6 +93,7 @@ describe 'Workspace' do
|
|
90
93
|
"workers": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers",
|
91
94
|
"workflows": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workflows"
|
92
95
|
},
|
96
|
+
"multi_task_enabled": "false",
|
93
97
|
"sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
94
98
|
"timeout_activity_name": "Offline",
|
95
99
|
"timeout_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
@@ -140,6 +144,7 @@ describe 'Workspace' do
|
|
140
144
|
"default_activity_name": "Offline",
|
141
145
|
"default_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
142
146
|
"event_callback_url": "",
|
147
|
+
"events_filter": "",
|
143
148
|
"friendly_name": "cce151db-4644-4d48-95a1-d962829b69f0",
|
144
149
|
"links": {
|
145
150
|
"activities": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities",
|
@@ -149,6 +154,7 @@ describe 'Workspace' do
|
|
149
154
|
"workers": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers",
|
150
155
|
"workflows": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workflows"
|
151
156
|
},
|
157
|
+
"multi_task_enabled": "false",
|
152
158
|
"sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
153
159
|
"timeout_activity_name": "Offline",
|
154
160
|
"timeout_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
@@ -217,6 +223,7 @@ describe 'Workspace' do
|
|
217
223
|
"default_activity_name": "Offline",
|
218
224
|
"default_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
219
225
|
"event_callback_url": "",
|
226
|
+
"events_filter": "",
|
220
227
|
"friendly_name": "8064de33-3a05-11e5-8bae-98e0d9a1eb73",
|
221
228
|
"links": {
|
222
229
|
"activities": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Activities",
|
@@ -226,6 +233,7 @@ describe 'Workspace' do
|
|
226
233
|
"workers": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workers",
|
227
234
|
"workflows": "https://taskrouter.twilio.com/v1/Workspaces/WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Workflows"
|
228
235
|
},
|
236
|
+
"multi_task_enabled": "false",
|
229
237
|
"sid": "WSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
230
238
|
"timeout_activity_name": "Offline",
|
231
239
|
"timeout_activity_sid": "WAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
@@ -90,6 +90,33 @@ describe Twilio::JWT::AccessToken do
|
|
90
90
|
expect(payload['grants']['ip_messaging']['deployment_role_sid']).to eq('DR123')
|
91
91
|
end
|
92
92
|
|
93
|
+
it 'should be able to add Sync grants' do
|
94
|
+
scat = Twilio::JWT::AccessToken.new 'AC123', 'SK123','secret'
|
95
|
+
scat.identity = "brodawg"
|
96
|
+
|
97
|
+
grant = Twilio::JWT::AccessToken::SyncGrant.new
|
98
|
+
grant.service_sid = 'IS123'
|
99
|
+
grant.endpoint_id = 'EP123'
|
100
|
+
scat.add_grant(grant)
|
101
|
+
|
102
|
+
token = scat.to_s
|
103
|
+
expect(token).not_to be_nil
|
104
|
+
payload, header = JWT.decode token, 'secret'
|
105
|
+
|
106
|
+
expect(payload['iss']).to eq('SK123')
|
107
|
+
expect(payload['sub']).to eq('AC123')
|
108
|
+
expect(payload['exp']).not_to be_nil
|
109
|
+
expect(payload['exp']).to be >= Time.now.to_i
|
110
|
+
expect(payload['jti']).not_to be_nil
|
111
|
+
expect(payload['jti']).to start_with payload['iss']
|
112
|
+
expect(payload['grants']).not_to be_nil
|
113
|
+
expect(payload['grants'].count).to eq(2)
|
114
|
+
expect(payload['grants']['identity']).to eq("brodawg")
|
115
|
+
expect(payload['grants']['data_sync']).not_to be_nil
|
116
|
+
expect(payload['grants']['data_sync']['service_sid']).to eq('IS123')
|
117
|
+
expect(payload['grants']['data_sync']['endpoint_id']).to eq('EP123')
|
118
|
+
end
|
119
|
+
|
93
120
|
it 'should add rest grants' do
|
94
121
|
scat = Twilio::JWT::AccessToken.new 'AC123', 'SK123','secret'
|
95
122
|
scat.add_grant(Twilio::JWT::AccessToken::ConversationsGrant.new)
|