twilio-ruby 5.0.0.rc23 → 5.0.0.rc24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +6 -0
- data/Makefile +1 -4
- data/lib/twilio-ruby/framework/serialize.rb +25 -3
- data/lib/twilio-ruby/jwt/access_token.rb +125 -126
- data/lib/twilio-ruby/jwt/client_capability.rb +50 -50
- data/lib/twilio-ruby/jwt/task_router.rb +97 -97
- data/lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +4 -4
- data/lib/twilio-ruby/rest/api/v2010/account/call/notification.rb +3 -3
- data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +3 -3
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +41 -13
- data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +6 -6
- data/lib/twilio-ruby/rest/api/v2010/account/message/media.rb +22 -12
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +22 -8
- data/lib/twilio-ruby/rest/api/v2010/account/notification.rb +3 -3
- data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +22 -12
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/all_time.rb +4 -4
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/daily.rb +4 -4
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/last_month.rb +4 -4
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/monthly.rb +4 -4
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/this_month.rb +4 -4
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/today.rb +4 -4
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/yearly.rb +4 -4
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record/yesterday.rb +4 -4
- data/lib/twilio-ruby/rest/api/v2010/account/usage/record.rb +4 -4
- data/lib/twilio-ruby/rest/chat/v1/credential.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v1/service/channel/member.rb +3 -3
- data/lib/twilio-ruby/rest/chat/v1/service/channel/message.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v1/service/role.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v1/service/user.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v1/service.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v2/credential.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v2/service/channel/invite.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v2/service/channel/member.rb +3 -3
- data/lib/twilio-ruby/rest/chat/v2/service/channel/message.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v2/service/role.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v2/service/user.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v2/service.rb +2 -2
- data/lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb +2 -2
- data/lib/twilio-ruby/rest/fax/v1/fax.rb +4 -4
- data/lib/twilio-ruby/rest/ip_messaging/v1/credential.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +3 -3
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v2/credential.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +3 -3
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/role.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +2 -2
- data/lib/twilio-ruby/rest/messaging/v1/service/alpha_sender.rb +2 -2
- data/lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb +2 -2
- data/lib/twilio-ruby/rest/messaging/v1/service/short_code.rb +2 -2
- data/lib/twilio-ruby/rest/messaging/v1/service.rb +2 -2
- data/lib/twilio-ruby/rest/monitor/v1/alert.rb +5 -5
- data/lib/twilio-ruby/rest/monitor/v1/event.rb +3 -3
- data/lib/twilio-ruby/rest/notify/v1/credential.rb +2 -2
- data/lib/twilio-ruby/rest/notify/v1/service/binding.rb +4 -4
- data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +1 -1
- data/lib/twilio-ruby/rest/notify/v1/service/segment.rb +2 -2
- data/lib/twilio-ruby/rest/notify/v1/service/user/user_binding.rb +4 -4
- data/lib/twilio-ruby/rest/notify/v1/service/user.rb +2 -2
- data/lib/twilio-ruby/rest/notify/v1/service.rb +2 -2
- data/lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb +2 -2
- data/lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb +2 -2
- data/lib/twilio-ruby/rest/preview/proxy/service/phone_number.rb +2 -2
- data/lib/twilio-ruby/rest/preview/proxy/service/session/interaction.rb +2 -2
- data/lib/twilio-ruby/rest/preview/proxy/service/session/participant/message_interaction.rb +2 -2
- data/lib/twilio-ruby/rest/preview/proxy/service/session/participant.rb +2 -2
- data/lib/twilio-ruby/rest/preview/proxy/service/session.rb +4 -4
- data/lib/twilio-ruby/rest/preview/proxy/service/short_code.rb +2 -2
- data/lib/twilio-ruby/rest/preview/proxy/service.rb +2 -2
- data/lib/twilio-ruby/rest/preview/sync/service/document.rb +2 -2
- data/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb +2 -2
- data/lib/twilio-ruby/rest/preview/sync/service/sync_list.rb +2 -2
- data/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb +2 -2
- data/lib/twilio-ruby/rest/preview/sync/service/sync_map.rb +2 -2
- data/lib/twilio-ruby/rest/preview/sync/service.rb +2 -2
- data/lib/twilio-ruby/rest/preview/wireless/command.rb +2 -2
- data/lib/twilio-ruby/rest/preview/wireless/rate_plan.rb +2 -2
- data/lib/twilio-ruby/rest/preview/wireless/sim.rb +2 -2
- data/lib/twilio-ruby/rest/sync/v1/service/document.rb +2 -2
- data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb +2 -2
- data/lib/twilio-ruby/rest/sync/v1/service/sync_list.rb +2 -2
- data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb +2 -2
- data/lib/twilio-ruby/rest/sync/v1/service/sync_map.rb +2 -2
- data/lib/twilio-ruby/rest/sync/v1/service.rb +2 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +2 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb +3 -3
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +2 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +2 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb +2 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.rb +2 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.rb +2 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb +2 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +2 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb +2 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb +2 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_statistics.rb +2 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +3 -3
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb +2 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb +2 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb +2 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +2 -2
- data/lib/twilio-ruby/rest/trunking/v1/trunk/credential_list.rb +2 -2
- data/lib/twilio-ruby/rest/trunking/v1/trunk/ip_access_control_list.rb +2 -2
- data/lib/twilio-ruby/rest/trunking/v1/trunk/origination_url.rb +2 -2
- data/lib/twilio-ruby/rest/trunking/v1/trunk/phone_number.rb +2 -2
- data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +2 -2
- data/lib/twilio-ruby/rest/video/v1/recording.rb +1 -1
- data/lib/twilio-ruby/rest/video/v1/room/recording.rb +1 -1
- data/lib/twilio-ruby/rest/video/v1/room.rb +5 -5
- data/lib/twilio-ruby/rest/wireless/v1/command.rb +2 -2
- data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +2 -2
- data/lib/twilio-ruby/rest/wireless/v1/sim/usage_record.rb +2 -2
- data/lib/twilio-ruby/rest/wireless/v1/sim.rb +2 -2
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/call/feedback_summary_spec.rb +2 -2
- data/spec/jwt/access_token_spec.rb +9 -9
- data/spec/jwt/client_capability_spec.rb +10 -10
- data/spec/jwt/task_router_spec.rb +24 -24
- data/twilio-ruby.gemspec +3 -4
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f981811e9dfbdbb8ccebb024fc19d02f8572343e
|
4
|
+
data.tar.gz: 3816114ec774607280c563ceba304d71a7e1586c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15f5dec31b1c60f3c48ecba58a092e0bfba5b3421dddf07cf88f4fd59187b8d1b42aa1c7b763f9cd38f7422a2d8dabe9609624e915a4b9116affe157843c6a4d
|
7
|
+
data.tar.gz: adc945fc725af82de455d4ef556509bf1a15424c8eaa98206d7a27e07d9fdb583ed73d7968373d2b3cb1bfb06778a77d78efa55f2b368dbb0e5a34e309f54ebe
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
twilio-ruby changelog
|
2
2
|
=====================
|
3
|
+
[2017-06-22] Version 5.0.0-rc24
|
4
|
+
-------------------------------
|
5
|
+
- Namespaced Policy, Grants, and Scope to their respective Token.
|
6
|
+
- Added `announce_url` and `annouce_url_method` to Conference update.
|
7
|
+
- Added `store_media` to Fax.
|
8
|
+
|
3
9
|
[2017-06-19] Version 5.0.0-rc23
|
4
10
|
-------------------------------
|
5
11
|
- Fixed ClientCapability parameter encoded bug.
|
data/Makefile
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
install:
|
2
|
-
bundle exec rake install
|
2
|
+
bundle install; bundle exec rake install
|
3
3
|
|
4
4
|
test-install:
|
5
5
|
bundle install
|
@@ -14,8 +14,5 @@ authors:
|
|
14
14
|
echo "Authors\n=======\n\nA huge thanks to all of our contributors:\n\n" > AUTHORS.md
|
15
15
|
git log --raw | grep "^Author: " | cut -d ' ' -f2- | cut -d '<' -f1 | sed 's/^/- /' | sort | uniq >> AUTHORS.md
|
16
16
|
|
17
|
-
deploy:
|
18
|
-
bundle exec rake deploy
|
19
|
-
|
20
17
|
gem:
|
21
18
|
bundle exec rake build | sed -e 's/.*pkg/pkg/g' | sed -e "s/\.$$//g" | xargs gem push
|
@@ -1,9 +1,25 @@
|
|
1
1
|
module Twilio
|
2
|
-
def self.
|
2
|
+
def self.serialize_iso8601_date(date)
|
3
3
|
if date.eql?(:unset)
|
4
4
|
date
|
5
|
-
elsif date
|
5
|
+
elsif date.is_a?(Date)
|
6
6
|
date.iso8601
|
7
|
+
elsif date.is_a?(Time)
|
8
|
+
date.strftime('%Y-%m-%d')
|
9
|
+
elsif date.is_a?(String)
|
10
|
+
date
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.serialize_iso8601_datetime(date)
|
15
|
+
if date.eql?(:unset)
|
16
|
+
date
|
17
|
+
elsif date.is_a?(Date)
|
18
|
+
Time.new(date.year, date.month, date.day).utc.iso8601
|
19
|
+
elsif date.is_a?(Time)
|
20
|
+
date.utc.iso8601
|
21
|
+
elsif date.is_a?(String)
|
22
|
+
date
|
7
23
|
end
|
8
24
|
end
|
9
25
|
|
@@ -13,7 +29,13 @@ module Twilio
|
|
13
29
|
end
|
14
30
|
end
|
15
31
|
|
16
|
-
def self.
|
32
|
+
def self.deserialize_iso8601_date(date)
|
33
|
+
unless date.nil?
|
34
|
+
Date.parse(date)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.deserialize_iso8601_datetime(date)
|
17
39
|
unless date.nil?
|
18
40
|
Time.parse(date)
|
19
41
|
end
|
@@ -1,5 +1,15 @@
|
|
1
1
|
module Twilio
|
2
2
|
module JWT
|
3
|
+
module AccessTokenGrant
|
4
|
+
def _key
|
5
|
+
fail NotImplementedError
|
6
|
+
end
|
7
|
+
|
8
|
+
def _generate_payload
|
9
|
+
fail NotImplementedError
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
3
13
|
class AccessToken < BaseJWT
|
4
14
|
attr_accessor :account_sid,
|
5
15
|
:signing_key_id,
|
@@ -61,186 +71,175 @@ module Twilio
|
|
61
71
|
|
62
72
|
headers
|
63
73
|
end
|
64
|
-
end
|
65
74
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
fail NotImplementedError
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
75
|
+
class IpMessagingGrant
|
76
|
+
include AccessTokenGrant
|
77
|
+
attr_accessor :service_sid,
|
78
|
+
:endpoint_id,
|
79
|
+
:deployment_role_sid,
|
80
|
+
:push_credential_sid
|
76
81
|
|
77
|
-
class IpMessagingGrant
|
78
|
-
include AccessTokenGrant
|
79
|
-
attr_accessor :service_sid,
|
80
|
-
:endpoint_id,
|
81
|
-
:deployment_role_sid,
|
82
|
-
:push_credential_sid
|
83
82
|
|
83
|
+
def _key
|
84
|
+
'ip_messaging'
|
85
|
+
end
|
84
86
|
|
85
|
-
|
86
|
-
|
87
|
-
end
|
87
|
+
def _generate_payload
|
88
|
+
payload = {}
|
88
89
|
|
89
|
-
|
90
|
-
|
90
|
+
if service_sid
|
91
|
+
payload[:service_sid] = service_sid
|
92
|
+
end
|
91
93
|
|
92
|
-
|
93
|
-
|
94
|
-
|
94
|
+
if endpoint_id
|
95
|
+
payload[:endpoint_id] = endpoint_id
|
96
|
+
end
|
95
97
|
|
96
|
-
|
97
|
-
|
98
|
-
|
98
|
+
if deployment_role_sid
|
99
|
+
payload[:deployment_role_sid] = deployment_role_sid
|
100
|
+
end
|
99
101
|
|
100
|
-
|
101
|
-
|
102
|
-
|
102
|
+
if push_credential_sid
|
103
|
+
payload[:push_credential_sid] = push_credential_sid
|
104
|
+
end
|
103
105
|
|
104
|
-
|
105
|
-
payload[:push_credential_sid] = push_credential_sid
|
106
|
+
payload
|
106
107
|
end
|
107
108
|
|
108
|
-
payload
|
109
109
|
end
|
110
110
|
|
111
|
-
|
111
|
+
class VoiceGrant
|
112
|
+
include AccessTokenGrant
|
113
|
+
attr_accessor :outgoing_application_sid,
|
114
|
+
:outgoing_application_params,
|
115
|
+
:push_credential_sid,
|
116
|
+
:endpoint_id
|
112
117
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
:outgoing_application_params,
|
117
|
-
:push_credential_sid,
|
118
|
-
:endpoint_id
|
118
|
+
def _key
|
119
|
+
'voice'
|
120
|
+
end
|
119
121
|
|
120
|
-
|
121
|
-
|
122
|
-
end
|
122
|
+
def _generate_payload
|
123
|
+
payload = {}
|
123
124
|
|
124
|
-
|
125
|
-
|
125
|
+
if outgoing_application_sid
|
126
|
+
outgoing = {}
|
127
|
+
outgoing[:application_sid] = outgoing_application_sid
|
128
|
+
if outgoing_application_params
|
129
|
+
outgoing[:params] = outgoing_application_params
|
130
|
+
end
|
126
131
|
|
127
|
-
|
128
|
-
outgoing = {}
|
129
|
-
outgoing[:application_sid] = outgoing_application_sid
|
130
|
-
if outgoing_application_params
|
131
|
-
outgoing[:params] = outgoing_application_params
|
132
|
+
payload[:outgoing] = outgoing
|
132
133
|
end
|
133
134
|
|
134
|
-
|
135
|
-
|
135
|
+
if push_credential_sid
|
136
|
+
payload[:push_credential_sid] = push_credential_sid
|
137
|
+
end
|
136
138
|
|
137
|
-
|
138
|
-
|
139
|
-
|
139
|
+
if endpoint_id
|
140
|
+
payload[:endpoint_id] = endpoint_id
|
141
|
+
end
|
140
142
|
|
141
|
-
|
142
|
-
payload[:endpoint_id] = endpoint_id
|
143
|
+
payload
|
143
144
|
end
|
144
|
-
|
145
|
-
payload
|
146
145
|
end
|
147
|
-
end
|
148
146
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
147
|
+
class SyncGrant
|
148
|
+
include AccessTokenGrant
|
149
|
+
attr_accessor :service_sid,
|
150
|
+
:endpoint_id
|
153
151
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
end
|
152
|
+
def _key
|
153
|
+
'data_sync'
|
158
154
|
|
159
|
-
def _generate_payload
|
160
|
-
payload = {}
|
161
|
-
|
162
|
-
if service_sid
|
163
|
-
payload['service_sid'] = service_sid
|
164
|
-
end
|
165
|
-
if endpoint_id
|
166
|
-
payload['endpoint_id'] = endpoint_id
|
167
155
|
end
|
168
156
|
|
169
|
-
|
170
|
-
|
171
|
-
end
|
157
|
+
def _generate_payload
|
158
|
+
payload = {}
|
172
159
|
|
173
|
-
|
174
|
-
|
175
|
-
|
160
|
+
if service_sid
|
161
|
+
payload['service_sid'] = service_sid
|
162
|
+
end
|
163
|
+
if endpoint_id
|
164
|
+
payload['endpoint_id'] = endpoint_id
|
165
|
+
end
|
176
166
|
|
177
|
-
|
178
|
-
|
167
|
+
payload
|
168
|
+
end
|
179
169
|
end
|
180
170
|
|
181
|
-
|
182
|
-
|
171
|
+
class ConversationsGrant
|
172
|
+
include AccessTokenGrant
|
173
|
+
attr_accessor :configuration_profile_sid
|
183
174
|
|
184
|
-
|
185
|
-
|
175
|
+
def _key
|
176
|
+
'rtc'
|
186
177
|
end
|
187
178
|
|
188
|
-
|
189
|
-
|
179
|
+
def _generate_payload
|
180
|
+
payload = {}
|
190
181
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
end
|
182
|
+
if configuration_profile_sid
|
183
|
+
payload[:configuration_profile_sid] = configuration_profile_sid
|
184
|
+
end
|
195
185
|
|
186
|
+
payload
|
187
|
+
end
|
196
188
|
|
197
|
-
|
189
|
+
class << self
|
190
|
+
extend Gem::Deprecate
|
191
|
+
deprecate :new, 'VideoGrant.new', 2017, 5
|
192
|
+
end
|
198
193
|
|
199
|
-
class VideoGrant
|
200
|
-
include AccessTokenGrant
|
201
|
-
attr_accessor :room
|
202
194
|
|
203
|
-
def _key
|
204
|
-
'video'
|
205
195
|
end
|
206
196
|
|
207
|
-
|
208
|
-
|
197
|
+
class VideoGrant
|
198
|
+
include AccessTokenGrant
|
199
|
+
attr_accessor :room
|
209
200
|
|
210
|
-
|
211
|
-
|
201
|
+
def _key
|
202
|
+
'video'
|
212
203
|
end
|
213
204
|
|
214
|
-
|
215
|
-
|
216
|
-
end
|
205
|
+
def _generate_payload
|
206
|
+
payload = {}
|
217
207
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
:worker_sid,
|
222
|
-
:role
|
208
|
+
if room
|
209
|
+
payload[:room] = room
|
210
|
+
end
|
223
211
|
|
224
|
-
|
225
|
-
|
212
|
+
payload
|
213
|
+
end
|
226
214
|
end
|
227
215
|
|
228
|
-
|
229
|
-
|
216
|
+
class TaskRouterGrant
|
217
|
+
include AccessTokenGrant
|
218
|
+
attr_accessor :workspace_sid,
|
219
|
+
:worker_sid,
|
220
|
+
:role
|
230
221
|
|
231
|
-
|
232
|
-
|
222
|
+
def _key
|
223
|
+
'task_router'
|
233
224
|
end
|
234
225
|
|
235
|
-
|
236
|
-
payload
|
237
|
-
end
|
226
|
+
def _generate_payload
|
227
|
+
payload = {}
|
238
228
|
|
239
|
-
|
240
|
-
|
241
|
-
|
229
|
+
if workspace_sid
|
230
|
+
payload[:workspace_sid] = workspace_sid
|
231
|
+
end
|
242
232
|
|
243
|
-
|
233
|
+
if worker_sid
|
234
|
+
payload[:worker_sid] = worker_sid
|
235
|
+
end
|
236
|
+
|
237
|
+
if role
|
238
|
+
payload[:role] = role
|
239
|
+
end
|
240
|
+
|
241
|
+
payload
|
242
|
+
end
|
244
243
|
end
|
245
244
|
end
|
246
245
|
end
|
@@ -1,5 +1,11 @@
|
|
1
1
|
module Twilio
|
2
2
|
module JWT
|
3
|
+
module Scope
|
4
|
+
def _generate_payload
|
5
|
+
raise 'Not Implemented'
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
3
9
|
class ClientCapability < BaseJWT
|
4
10
|
attr_accessor :account_sid,
|
5
11
|
:auth_token,
|
@@ -36,71 +42,65 @@ module Twilio
|
|
36
42
|
|
37
43
|
payload
|
38
44
|
end
|
39
|
-
end
|
40
45
|
|
41
|
-
|
42
|
-
|
43
|
-
raise 'Not Implemented'
|
44
|
-
end
|
45
|
-
end
|
46
|
+
class IncomingClientScope
|
47
|
+
include Scope
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
+
def initialize(client_name)
|
50
|
+
@client_name = client_name
|
51
|
+
end
|
49
52
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
+
def _generate_payload
|
54
|
+
prefix = "scope:client:incoming"
|
55
|
+
suffix = "clientName=" + CGI.escape("#{@client_name}")
|
53
56
|
|
54
|
-
|
55
|
-
|
56
|
-
suffix = "clientName=" + CGI.escape("#{@client_name}")
|
57
|
+
[prefix, suffix].join('?')
|
58
|
+
end
|
57
59
|
|
58
|
-
[prefix, suffix].join('?')
|
59
60
|
end
|
60
61
|
|
61
|
-
|
62
|
-
|
63
|
-
class OutgoingClientScope
|
64
|
-
include Scope
|
62
|
+
class OutgoingClientScope
|
63
|
+
include Scope
|
65
64
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
def _generate_payload
|
73
|
-
prefix = "scope:client:outgoing"
|
74
|
-
application_sid = "appSid=#{CGI.escape(@application_sid)}"
|
75
|
-
unless @client_name.nil?
|
76
|
-
client_name = "clientName=#{CGI.escape(@client_name)}"
|
77
|
-
end
|
78
|
-
unless @params.empty?
|
79
|
-
params = "appParams=" + @params.map {|k, v| CGI.escape("#{k}=#{v}")}.join('&')
|
65
|
+
def initialize(application_sid, client_name = nil, params = {})
|
66
|
+
@application_sid = application_sid
|
67
|
+
@client_name = client_name
|
68
|
+
@params = params
|
80
69
|
end
|
81
70
|
|
82
|
-
|
83
|
-
|
71
|
+
def _generate_payload
|
72
|
+
prefix = "scope:client:outgoing"
|
73
|
+
application_sid = "appSid=#{CGI.escape(@application_sid)}"
|
74
|
+
unless @client_name.nil?
|
75
|
+
client_name = "clientName=#{CGI.escape(@client_name)}"
|
76
|
+
end
|
77
|
+
unless @params.empty?
|
78
|
+
params = "appParams=" + @params.map {|k, v| CGI.escape("#{k}=#{v}")}.join('&')
|
79
|
+
end
|
80
|
+
|
81
|
+
suffix = [application_sid, client_name, params].compact.join('&')
|
82
|
+
[prefix, suffix].join('?')
|
83
|
+
end
|
84
84
|
end
|
85
|
-
end
|
86
85
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
def initialize(filters = {})
|
91
|
-
@filters = filters
|
92
|
-
@path = '/2010-04-01/Events'
|
93
|
-
end
|
86
|
+
class EventStreamScope
|
87
|
+
include Scope
|
94
88
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
unless @filters.empty?
|
99
|
-
filters = "params=" + @filters.map {|k, v| CGI.escape("#{k}=#{v}")}.join('&')
|
89
|
+
def initialize(filters = {})
|
90
|
+
@filters = filters
|
91
|
+
@path = '/2010-04-01/Events'
|
100
92
|
end
|
101
93
|
|
102
|
-
|
103
|
-
|
94
|
+
def _generate_payload
|
95
|
+
prefix = "scope:stream:subscribe"
|
96
|
+
path = "path=#{CGI.escape(@path)}"
|
97
|
+
unless @filters.empty?
|
98
|
+
filters = "params=" + @filters.map {|k, v| CGI.escape("#{k}=#{v}")}.join('&')
|
99
|
+
end
|
100
|
+
|
101
|
+
suffix = [path, filters].compact.join('&')
|
102
|
+
[prefix, suffix].join('?')
|
103
|
+
end
|
104
104
|
end
|
105
105
|
end
|
106
106
|
end
|