twilio-ruby 5.58.1 → 5.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGES.md +83 -0
- data/README.md +3 -3
- data/lib/twilio-ruby/http/http_client.rb +1 -1
- data/lib/twilio-ruby/jwt/access_token.rb +13 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call/siprec.rb +667 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +27 -1
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +11 -4
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +11 -4
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +11 -4
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +17 -10
- data/lib/twilio-ruby/rest/client.rb +7 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb +18 -2
- data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +7 -0
- data/lib/twilio-ruby/rest/insights/v1/call_summaries.rb +35 -35
- data/lib/twilio-ruby/rest/media/v1/media_processor.rb +384 -0
- data/lib/twilio-ruby/rest/media/v1/player_streamer/playback_grant.rb +221 -0
- data/lib/twilio-ruby/rest/media/v1/player_streamer.rb +390 -0
- data/lib/twilio-ruby/rest/media/v1.rb +60 -0
- data/lib/twilio-ruby/rest/media.rb +56 -0
- data/lib/twilio-ruby/rest/messaging/v1/brand_registration/brand_vetting.rb +272 -0
- data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +79 -1
- data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb +9 -2
- data/lib/twilio-ruby/rest/messaging/v1/service.rb +29 -3
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.rb +188 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/replace_items.rb +188 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +59 -14
- data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +1 -1
- data/lib/twilio-ruby/rest/serverless/v1/service.rb +7 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +7 -3
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +7 -3
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +23 -11
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +30 -20
- data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +19 -3
- data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb +6 -2
- data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +10 -6
- data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +11 -9
- data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +8 -8
- data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +7 -3
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +7 -5
- data/lib/twilio-ruby/rest/verify/v2/template.rb +206 -0
- data/lib/twilio-ruby/rest/verify/v2.rb +7 -0
- data/lib/twilio-ruby/rest/verify.rb +6 -0
- data/lib/twilio-ruby/rest/video/v1/room.rb +12 -1
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +13 -3
@@ -0,0 +1,384 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
#
|
7
|
+
# frozen_string_literal: true
|
8
|
+
|
9
|
+
module Twilio
|
10
|
+
module REST
|
11
|
+
class Media < Domain
|
12
|
+
class V1 < Version
|
13
|
+
class MediaProcessorList < ListResource
|
14
|
+
##
|
15
|
+
# Initialize the MediaProcessorList
|
16
|
+
# @param [Version] version Version that contains the resource
|
17
|
+
# @return [MediaProcessorList] MediaProcessorList
|
18
|
+
def initialize(version)
|
19
|
+
super(version)
|
20
|
+
|
21
|
+
# Path Solution
|
22
|
+
@solution = {}
|
23
|
+
@uri = "/MediaProcessors"
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# Create the MediaProcessorInstance
|
28
|
+
# @param [String] extension The {Media
|
29
|
+
# Extension}[/docs/live/api/media-extensions-overview] name or URL. Ex:
|
30
|
+
# `video-composer-v1-preview`
|
31
|
+
# @param [String] extension_context The context of the Media Extension,
|
32
|
+
# represented as a JSON dictionary. See the documentation for the specific {Media
|
33
|
+
# Extension}[/docs/live/api/media-extensions-overview] you are using for more
|
34
|
+
# information about the context to send.
|
35
|
+
# @param [Hash] extension_environment User-defined environment variables for the
|
36
|
+
# Media Extension, represented as a JSON dictionary of key/value strings. See the
|
37
|
+
# documentation for the specific {Media
|
38
|
+
# Extension}[/docs/live/api/media-extensions-overview] you are using for more
|
39
|
+
# information about whether you need to provide this.
|
40
|
+
# @param [String] status_callback The URL to which Twilio will send asynchronous
|
41
|
+
# webhook requests for every MediaProcessor event. See {Status
|
42
|
+
# Callbacks}[/docs/live/status-callbacks] for details.
|
43
|
+
# @param [String] status_callback_method The HTTP method Twilio should use to call
|
44
|
+
# the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`.
|
45
|
+
# @return [MediaProcessorInstance] Created MediaProcessorInstance
|
46
|
+
def create(extension: nil, extension_context: nil, extension_environment: :unset, status_callback: :unset, status_callback_method: :unset)
|
47
|
+
data = Twilio::Values.of({
|
48
|
+
'Extension' => extension,
|
49
|
+
'ExtensionContext' => extension_context,
|
50
|
+
'ExtensionEnvironment' => Twilio.serialize_object(extension_environment),
|
51
|
+
'StatusCallback' => status_callback,
|
52
|
+
'StatusCallbackMethod' => status_callback_method,
|
53
|
+
})
|
54
|
+
|
55
|
+
payload = @version.create('POST', @uri, data: data)
|
56
|
+
|
57
|
+
MediaProcessorInstance.new(@version, payload, )
|
58
|
+
end
|
59
|
+
|
60
|
+
##
|
61
|
+
# Lists MediaProcessorInstance records from the API as a list.
|
62
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
63
|
+
# memory before returning.
|
64
|
+
# @param [media_processor.Order] order The sort order of the list by
|
65
|
+
# `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as
|
66
|
+
# the default.
|
67
|
+
# @param [media_processor.Status] status Status to filter by, with possible values
|
68
|
+
# `started`, `ended` or `failed`.
|
69
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
70
|
+
# guarantees to never return more than limit. Default is no limit
|
71
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
72
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
73
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
74
|
+
# efficient page size, i.e. min(limit, 1000)
|
75
|
+
# @return [Array] Array of up to limit results
|
76
|
+
def list(order: :unset, status: :unset, limit: nil, page_size: nil)
|
77
|
+
self.stream(order: order, status: status, limit: limit, page_size: page_size).entries
|
78
|
+
end
|
79
|
+
|
80
|
+
##
|
81
|
+
# Streams MediaProcessorInstance records from the API as an Enumerable.
|
82
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
83
|
+
# is reached.
|
84
|
+
# @param [media_processor.Order] order The sort order of the list by
|
85
|
+
# `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as
|
86
|
+
# the default.
|
87
|
+
# @param [media_processor.Status] status Status to filter by, with possible values
|
88
|
+
# `started`, `ended` or `failed`.
|
89
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
90
|
+
# guarantees to never return more than limit. Default is no limit.
|
91
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
92
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
93
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
94
|
+
# efficient page size, i.e. min(limit, 1000)
|
95
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
96
|
+
def stream(order: :unset, status: :unset, limit: nil, page_size: nil)
|
97
|
+
limits = @version.read_limits(limit, page_size)
|
98
|
+
|
99
|
+
page = self.page(order: order, status: status, page_size: limits[:page_size], )
|
100
|
+
|
101
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
102
|
+
end
|
103
|
+
|
104
|
+
##
|
105
|
+
# When passed a block, yields MediaProcessorInstance records from the API.
|
106
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
107
|
+
# is reached.
|
108
|
+
def each
|
109
|
+
limits = @version.read_limits
|
110
|
+
|
111
|
+
page = self.page(page_size: limits[:page_size], )
|
112
|
+
|
113
|
+
@version.stream(page,
|
114
|
+
limit: limits[:limit],
|
115
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
116
|
+
end
|
117
|
+
|
118
|
+
##
|
119
|
+
# Retrieve a single page of MediaProcessorInstance records from the API.
|
120
|
+
# Request is executed immediately.
|
121
|
+
# @param [media_processor.Order] order The sort order of the list by
|
122
|
+
# `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as
|
123
|
+
# the default.
|
124
|
+
# @param [media_processor.Status] status Status to filter by, with possible values
|
125
|
+
# `started`, `ended` or `failed`.
|
126
|
+
# @param [String] page_token PageToken provided by the API
|
127
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
128
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
129
|
+
# @return [Page] Page of MediaProcessorInstance
|
130
|
+
def page(order: :unset, status: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
131
|
+
params = Twilio::Values.of({
|
132
|
+
'Order' => order,
|
133
|
+
'Status' => status,
|
134
|
+
'PageToken' => page_token,
|
135
|
+
'Page' => page_number,
|
136
|
+
'PageSize' => page_size,
|
137
|
+
})
|
138
|
+
|
139
|
+
response = @version.page('GET', @uri, params: params)
|
140
|
+
|
141
|
+
MediaProcessorPage.new(@version, response, @solution)
|
142
|
+
end
|
143
|
+
|
144
|
+
##
|
145
|
+
# Retrieve a single page of MediaProcessorInstance records from the API.
|
146
|
+
# Request is executed immediately.
|
147
|
+
# @param [String] target_url API-generated URL for the requested results page
|
148
|
+
# @return [Page] Page of MediaProcessorInstance
|
149
|
+
def get_page(target_url)
|
150
|
+
response = @version.domain.request(
|
151
|
+
'GET',
|
152
|
+
target_url
|
153
|
+
)
|
154
|
+
MediaProcessorPage.new(@version, response, @solution)
|
155
|
+
end
|
156
|
+
|
157
|
+
##
|
158
|
+
# Provide a user friendly representation
|
159
|
+
def to_s
|
160
|
+
'#<Twilio.Media.V1.MediaProcessorList>'
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
class MediaProcessorPage < Page
|
165
|
+
##
|
166
|
+
# Initialize the MediaProcessorPage
|
167
|
+
# @param [Version] version Version that contains the resource
|
168
|
+
# @param [Response] response Response from the API
|
169
|
+
# @param [Hash] solution Path solution for the resource
|
170
|
+
# @return [MediaProcessorPage] MediaProcessorPage
|
171
|
+
def initialize(version, response, solution)
|
172
|
+
super(version, response)
|
173
|
+
|
174
|
+
# Path Solution
|
175
|
+
@solution = solution
|
176
|
+
end
|
177
|
+
|
178
|
+
##
|
179
|
+
# Build an instance of MediaProcessorInstance
|
180
|
+
# @param [Hash] payload Payload response from the API
|
181
|
+
# @return [MediaProcessorInstance] MediaProcessorInstance
|
182
|
+
def get_instance(payload)
|
183
|
+
MediaProcessorInstance.new(@version, payload, )
|
184
|
+
end
|
185
|
+
|
186
|
+
##
|
187
|
+
# Provide a user friendly representation
|
188
|
+
def to_s
|
189
|
+
'<Twilio.Media.V1.MediaProcessorPage>'
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
class MediaProcessorContext < InstanceContext
|
194
|
+
##
|
195
|
+
# Initialize the MediaProcessorContext
|
196
|
+
# @param [Version] version Version that contains the resource
|
197
|
+
# @param [String] sid The SID of the MediaProcessor resource to fetch.
|
198
|
+
# @return [MediaProcessorContext] MediaProcessorContext
|
199
|
+
def initialize(version, sid)
|
200
|
+
super(version)
|
201
|
+
|
202
|
+
# Path Solution
|
203
|
+
@solution = {sid: sid, }
|
204
|
+
@uri = "/MediaProcessors/#{@solution[:sid]}"
|
205
|
+
end
|
206
|
+
|
207
|
+
##
|
208
|
+
# Fetch the MediaProcessorInstance
|
209
|
+
# @return [MediaProcessorInstance] Fetched MediaProcessorInstance
|
210
|
+
def fetch
|
211
|
+
payload = @version.fetch('GET', @uri)
|
212
|
+
|
213
|
+
MediaProcessorInstance.new(@version, payload, sid: @solution[:sid], )
|
214
|
+
end
|
215
|
+
|
216
|
+
##
|
217
|
+
# Update the MediaProcessorInstance
|
218
|
+
# @param [media_processor.UpdateStatus] status The status of the MediaProcessor.
|
219
|
+
# Can be `ended`.
|
220
|
+
# @return [MediaProcessorInstance] Updated MediaProcessorInstance
|
221
|
+
def update(status: nil)
|
222
|
+
data = Twilio::Values.of({'Status' => status, })
|
223
|
+
|
224
|
+
payload = @version.update('POST', @uri, data: data)
|
225
|
+
|
226
|
+
MediaProcessorInstance.new(@version, payload, sid: @solution[:sid], )
|
227
|
+
end
|
228
|
+
|
229
|
+
##
|
230
|
+
# Provide a user friendly representation
|
231
|
+
def to_s
|
232
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
233
|
+
"#<Twilio.Media.V1.MediaProcessorContext #{context}>"
|
234
|
+
end
|
235
|
+
|
236
|
+
##
|
237
|
+
# Provide a detailed, user friendly representation
|
238
|
+
def inspect
|
239
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
240
|
+
"#<Twilio.Media.V1.MediaProcessorContext #{context}>"
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
class MediaProcessorInstance < InstanceResource
|
245
|
+
##
|
246
|
+
# Initialize the MediaProcessorInstance
|
247
|
+
# @param [Version] version Version that contains the resource
|
248
|
+
# @param [Hash] payload payload that contains response from Twilio
|
249
|
+
# @param [String] sid The SID of the MediaProcessor resource to fetch.
|
250
|
+
# @return [MediaProcessorInstance] MediaProcessorInstance
|
251
|
+
def initialize(version, payload, sid: nil)
|
252
|
+
super(version)
|
253
|
+
|
254
|
+
# Marshaled Properties
|
255
|
+
@properties = {
|
256
|
+
'account_sid' => payload['account_sid'],
|
257
|
+
'sid' => payload['sid'],
|
258
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
259
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
260
|
+
'extension' => payload['extension'],
|
261
|
+
'extension_context' => payload['extension_context'],
|
262
|
+
'status' => payload['status'],
|
263
|
+
'url' => payload['url'],
|
264
|
+
'ended_reason' => payload['ended_reason'],
|
265
|
+
'status_callback' => payload['status_callback'],
|
266
|
+
'status_callback_method' => payload['status_callback_method'],
|
267
|
+
}
|
268
|
+
|
269
|
+
# Context
|
270
|
+
@instance_context = nil
|
271
|
+
@params = {'sid' => sid || @properties['sid'], }
|
272
|
+
end
|
273
|
+
|
274
|
+
##
|
275
|
+
# Generate an instance context for the instance, the context is capable of
|
276
|
+
# performing various actions. All instance actions are proxied to the context
|
277
|
+
# @return [MediaProcessorContext] MediaProcessorContext for this MediaProcessorInstance
|
278
|
+
def context
|
279
|
+
unless @instance_context
|
280
|
+
@instance_context = MediaProcessorContext.new(@version, @params['sid'], )
|
281
|
+
end
|
282
|
+
@instance_context
|
283
|
+
end
|
284
|
+
|
285
|
+
##
|
286
|
+
# @return [String] The SID of the Account that created the resource
|
287
|
+
def account_sid
|
288
|
+
@properties['account_sid']
|
289
|
+
end
|
290
|
+
|
291
|
+
##
|
292
|
+
# @return [String] The unique string that identifies the resource
|
293
|
+
def sid
|
294
|
+
@properties['sid']
|
295
|
+
end
|
296
|
+
|
297
|
+
##
|
298
|
+
# @return [Time] The ISO 8601 date and time in GMT when the resource was created
|
299
|
+
def date_created
|
300
|
+
@properties['date_created']
|
301
|
+
end
|
302
|
+
|
303
|
+
##
|
304
|
+
# @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
|
305
|
+
def date_updated
|
306
|
+
@properties['date_updated']
|
307
|
+
end
|
308
|
+
|
309
|
+
##
|
310
|
+
# @return [String] The Media Extension name or URL
|
311
|
+
def extension
|
312
|
+
@properties['extension']
|
313
|
+
end
|
314
|
+
|
315
|
+
##
|
316
|
+
# @return [String] The Media Extension context
|
317
|
+
def extension_context
|
318
|
+
@properties['extension_context']
|
319
|
+
end
|
320
|
+
|
321
|
+
##
|
322
|
+
# @return [media_processor.Status] The status of the MediaProcessor
|
323
|
+
def status
|
324
|
+
@properties['status']
|
325
|
+
end
|
326
|
+
|
327
|
+
##
|
328
|
+
# @return [String] The absolute URL of the resource
|
329
|
+
def url
|
330
|
+
@properties['url']
|
331
|
+
end
|
332
|
+
|
333
|
+
##
|
334
|
+
# @return [String] The reason why a MediaProcessor ended
|
335
|
+
def ended_reason
|
336
|
+
@properties['ended_reason']
|
337
|
+
end
|
338
|
+
|
339
|
+
##
|
340
|
+
# @return [String] The URL to which Twilio will send MediaProcessor event updates
|
341
|
+
def status_callback
|
342
|
+
@properties['status_callback']
|
343
|
+
end
|
344
|
+
|
345
|
+
##
|
346
|
+
# @return [String] The HTTP method Twilio should use to call the `status_callback` URL
|
347
|
+
def status_callback_method
|
348
|
+
@properties['status_callback_method']
|
349
|
+
end
|
350
|
+
|
351
|
+
##
|
352
|
+
# Fetch the MediaProcessorInstance
|
353
|
+
# @return [MediaProcessorInstance] Fetched MediaProcessorInstance
|
354
|
+
def fetch
|
355
|
+
context.fetch
|
356
|
+
end
|
357
|
+
|
358
|
+
##
|
359
|
+
# Update the MediaProcessorInstance
|
360
|
+
# @param [media_processor.UpdateStatus] status The status of the MediaProcessor.
|
361
|
+
# Can be `ended`.
|
362
|
+
# @return [MediaProcessorInstance] Updated MediaProcessorInstance
|
363
|
+
def update(status: nil)
|
364
|
+
context.update(status: status, )
|
365
|
+
end
|
366
|
+
|
367
|
+
##
|
368
|
+
# Provide a user friendly representation
|
369
|
+
def to_s
|
370
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
371
|
+
"<Twilio.Media.V1.MediaProcessorInstance #{values}>"
|
372
|
+
end
|
373
|
+
|
374
|
+
##
|
375
|
+
# Provide a detailed, user friendly representation
|
376
|
+
def inspect
|
377
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
378
|
+
"<Twilio.Media.V1.MediaProcessorInstance #{values}>"
|
379
|
+
end
|
380
|
+
end
|
381
|
+
end
|
382
|
+
end
|
383
|
+
end
|
384
|
+
end
|
@@ -0,0 +1,221 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
#
|
7
|
+
# frozen_string_literal: true
|
8
|
+
|
9
|
+
module Twilio
|
10
|
+
module REST
|
11
|
+
class Media < Domain
|
12
|
+
class V1 < Version
|
13
|
+
class PlayerStreamerContext < InstanceContext
|
14
|
+
class PlaybackGrantList < ListResource
|
15
|
+
##
|
16
|
+
# Initialize the PlaybackGrantList
|
17
|
+
# @param [Version] version Version that contains the resource
|
18
|
+
# @param [String] sid The unique string generated to identify the PlayerStreamer
|
19
|
+
# resource that this PlaybackGrant authorizes views for.
|
20
|
+
# @return [PlaybackGrantList] PlaybackGrantList
|
21
|
+
def initialize(version, sid: nil)
|
22
|
+
super(version)
|
23
|
+
|
24
|
+
# Path Solution
|
25
|
+
@solution = {sid: sid}
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Provide a user friendly representation
|
30
|
+
def to_s
|
31
|
+
'#<Twilio.Media.V1.PlaybackGrantList>'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class PlaybackGrantPage < Page
|
36
|
+
##
|
37
|
+
# Initialize the PlaybackGrantPage
|
38
|
+
# @param [Version] version Version that contains the resource
|
39
|
+
# @param [Response] response Response from the API
|
40
|
+
# @param [Hash] solution Path solution for the resource
|
41
|
+
# @return [PlaybackGrantPage] PlaybackGrantPage
|
42
|
+
def initialize(version, response, solution)
|
43
|
+
super(version, response)
|
44
|
+
|
45
|
+
# Path Solution
|
46
|
+
@solution = solution
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# Build an instance of PlaybackGrantInstance
|
51
|
+
# @param [Hash] payload Payload response from the API
|
52
|
+
# @return [PlaybackGrantInstance] PlaybackGrantInstance
|
53
|
+
def get_instance(payload)
|
54
|
+
PlaybackGrantInstance.new(@version, payload, sid: @solution[:sid], )
|
55
|
+
end
|
56
|
+
|
57
|
+
##
|
58
|
+
# Provide a user friendly representation
|
59
|
+
def to_s
|
60
|
+
'<Twilio.Media.V1.PlaybackGrantPage>'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class PlaybackGrantContext < InstanceContext
|
65
|
+
##
|
66
|
+
# Initialize the PlaybackGrantContext
|
67
|
+
# @param [Version] version Version that contains the resource
|
68
|
+
# @param [String] sid The SID of the PlayerStreamer resource to fetch.
|
69
|
+
# @return [PlaybackGrantContext] PlaybackGrantContext
|
70
|
+
def initialize(version, sid)
|
71
|
+
super(version)
|
72
|
+
|
73
|
+
# Path Solution
|
74
|
+
@solution = {sid: sid, }
|
75
|
+
@uri = "/PlayerStreamers/#{@solution[:sid]}/PlaybackGrant"
|
76
|
+
end
|
77
|
+
|
78
|
+
##
|
79
|
+
# Create the PlaybackGrantInstance
|
80
|
+
# @param [String] ttl The time to live of the PlaybackGrant. Default value is 15
|
81
|
+
# seconds. Maximum value is 60 seconds.
|
82
|
+
# @param [String] access_control_allow_origin The full origin URL where the
|
83
|
+
# livestream can be streamed. If this is not provided, it can be streamed from any
|
84
|
+
# domain.
|
85
|
+
# @return [PlaybackGrantInstance] Created PlaybackGrantInstance
|
86
|
+
def create(ttl: :unset, access_control_allow_origin: :unset)
|
87
|
+
data = Twilio::Values.of({'Ttl' => ttl, 'AccessControlAllowOrigin' => access_control_allow_origin, })
|
88
|
+
|
89
|
+
payload = @version.create('POST', @uri, data: data)
|
90
|
+
|
91
|
+
PlaybackGrantInstance.new(@version, payload, sid: @solution[:sid], )
|
92
|
+
end
|
93
|
+
|
94
|
+
##
|
95
|
+
# Fetch the PlaybackGrantInstance
|
96
|
+
# @return [PlaybackGrantInstance] Fetched PlaybackGrantInstance
|
97
|
+
def fetch
|
98
|
+
payload = @version.fetch('GET', @uri)
|
99
|
+
|
100
|
+
PlaybackGrantInstance.new(@version, payload, sid: @solution[:sid], )
|
101
|
+
end
|
102
|
+
|
103
|
+
##
|
104
|
+
# Provide a user friendly representation
|
105
|
+
def to_s
|
106
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
107
|
+
"#<Twilio.Media.V1.PlaybackGrantContext #{context}>"
|
108
|
+
end
|
109
|
+
|
110
|
+
##
|
111
|
+
# Provide a detailed, user friendly representation
|
112
|
+
def inspect
|
113
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
114
|
+
"#<Twilio.Media.V1.PlaybackGrantContext #{context}>"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
class PlaybackGrantInstance < InstanceResource
|
119
|
+
##
|
120
|
+
# Initialize the PlaybackGrantInstance
|
121
|
+
# @param [Version] version Version that contains the resource
|
122
|
+
# @param [Hash] payload payload that contains response from Twilio
|
123
|
+
# @param [String] sid The unique string generated to identify the PlayerStreamer
|
124
|
+
# resource that this PlaybackGrant authorizes views for.
|
125
|
+
# @return [PlaybackGrantInstance] PlaybackGrantInstance
|
126
|
+
def initialize(version, payload, sid: nil)
|
127
|
+
super(version)
|
128
|
+
|
129
|
+
# Marshaled Properties
|
130
|
+
@properties = {
|
131
|
+
'sid' => payload['sid'],
|
132
|
+
'url' => payload['url'],
|
133
|
+
'account_sid' => payload['account_sid'],
|
134
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
135
|
+
'grant' => payload['grant'],
|
136
|
+
}
|
137
|
+
|
138
|
+
# Context
|
139
|
+
@instance_context = nil
|
140
|
+
@params = {'sid' => sid, }
|
141
|
+
end
|
142
|
+
|
143
|
+
##
|
144
|
+
# Generate an instance context for the instance, the context is capable of
|
145
|
+
# performing various actions. All instance actions are proxied to the context
|
146
|
+
# @return [PlaybackGrantContext] PlaybackGrantContext for this PlaybackGrantInstance
|
147
|
+
def context
|
148
|
+
unless @instance_context
|
149
|
+
@instance_context = PlaybackGrantContext.new(@version, @params['sid'], )
|
150
|
+
end
|
151
|
+
@instance_context
|
152
|
+
end
|
153
|
+
|
154
|
+
##
|
155
|
+
# @return [String] The unique string that identifies the PlayerStreamer associated with this PlaybackGrant.
|
156
|
+
def sid
|
157
|
+
@properties['sid']
|
158
|
+
end
|
159
|
+
|
160
|
+
##
|
161
|
+
# @return [String] The absolute URL of the resource
|
162
|
+
def url
|
163
|
+
@properties['url']
|
164
|
+
end
|
165
|
+
|
166
|
+
##
|
167
|
+
# @return [String] The SID of the Account that created the resource
|
168
|
+
def account_sid
|
169
|
+
@properties['account_sid']
|
170
|
+
end
|
171
|
+
|
172
|
+
##
|
173
|
+
# @return [Time] The ISO 8601 date and time in GMT when the resource was created
|
174
|
+
def date_created
|
175
|
+
@properties['date_created']
|
176
|
+
end
|
177
|
+
|
178
|
+
##
|
179
|
+
# @return [Hash] The grant that authorizes the player sdk to connect to the livestream
|
180
|
+
def grant
|
181
|
+
@properties['grant']
|
182
|
+
end
|
183
|
+
|
184
|
+
##
|
185
|
+
# Create the PlaybackGrantInstance
|
186
|
+
# @param [String] ttl The time to live of the PlaybackGrant. Default value is 15
|
187
|
+
# seconds. Maximum value is 60 seconds.
|
188
|
+
# @param [String] access_control_allow_origin The full origin URL where the
|
189
|
+
# livestream can be streamed. If this is not provided, it can be streamed from any
|
190
|
+
# domain.
|
191
|
+
# @return [PlaybackGrantInstance] Created PlaybackGrantInstance
|
192
|
+
def create(ttl: :unset, access_control_allow_origin: :unset)
|
193
|
+
context.create(ttl: ttl, access_control_allow_origin: access_control_allow_origin, )
|
194
|
+
end
|
195
|
+
|
196
|
+
##
|
197
|
+
# Fetch the PlaybackGrantInstance
|
198
|
+
# @return [PlaybackGrantInstance] Fetched PlaybackGrantInstance
|
199
|
+
def fetch
|
200
|
+
context.fetch
|
201
|
+
end
|
202
|
+
|
203
|
+
##
|
204
|
+
# Provide a user friendly representation
|
205
|
+
def to_s
|
206
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
207
|
+
"<Twilio.Media.V1.PlaybackGrantInstance #{values}>"
|
208
|
+
end
|
209
|
+
|
210
|
+
##
|
211
|
+
# Provide a detailed, user friendly representation
|
212
|
+
def inspect
|
213
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
214
|
+
"<Twilio.Media.V1.PlaybackGrantInstance #{values}>"
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|