Class: Twilio::REST::Video::V1::CompositionInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/video/v1/composition.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ CompositionInstance

Initialize the CompositionInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this Composition resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 288

def initialize(version, payload , sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'status' => payload['status'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_completed' => Twilio.deserialize_iso8601_datetime(payload['date_completed']),
        'date_deleted' => Twilio.deserialize_iso8601_datetime(payload['date_deleted']),
        'sid' => payload['sid'],
        'room_sid' => payload['room_sid'],
        'audio_sources' => payload['audio_sources'],
        'audio_sources_excluded' => payload['audio_sources_excluded'],
        'video_layout' => payload['video_layout'],
        'resolution' => payload['resolution'],
        'trim' => payload['trim'],
        'format' => payload['format'],
        'bitrate' => payload['bitrate'] == nil ? payload['bitrate'] : payload['bitrate'].to_i,
        'size' => payload['size'],
        'duration' => payload['duration'] == nil ? payload['duration'] : payload['duration'].to_i,
        'media_external_location' => payload['media_external_location'],
        'status_callback' => payload['status_callback'],
        'status_callback_method' => payload['status_callback_method'],
        'url' => payload['url'],
        'links' => payload['links'],
    }

    # Context
    @instance_context = nil
    @params = { 'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Composition resource.

Returns:



334
335
336
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 334

def 
    @properties['account_sid']
end

#audio_sourcesArray<String>

Returns The array of track names to include in the composition. The composition includes all audio sources specified in ‘audio_sources` except those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`.

Returns:

  • (Array<String>)

    The array of track names to include in the composition. The composition includes all audio sources specified in ‘audio_sources` except those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`.



376
377
378
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 376

def audio_sources
    @properties['audio_sources']
end

#audio_sources_excludedArray<String>

Returns The array of track names to exclude from the composition. The composition includes all audio sources specified in ‘audio_sources` except for those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty.

Returns:

  • (Array<String>)

    The array of track names to exclude from the composition. The composition includes all audio sources specified in ‘audio_sources` except for those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty.



382
383
384
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 382

def audio_sources_excluded
    @properties['audio_sources_excluded']
end

#bitrateString

Returns The average bit rate of the composition’s media.

Returns:

  • (String)

    The average bit rate of the composition’s media.



412
413
414
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 412

def bitrate
    @properties['bitrate']
end

#contextCompositionContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



325
326
327
328
329
330
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 325

def context
    unless @instance_context
        @instance_context = CompositionContext.new(@version , @params['sid'])
    end
    @instance_context
end

#date_completedTime

Returns The date and time in GMT when the composition’s media processing task finished, specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:

  • (Time)

    The date and time in GMT when the composition’s media processing task finished, specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.



352
353
354
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 352

def date_completed
    @properties['date_completed']
end

#date_createdTime

Returns The date and time in GMT when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



346
347
348
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 346

def date_created
    @properties['date_created']
end

#date_deletedTime

Returns The date and time in GMT when the composition generated media was deleted, specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:

  • (Time)

    The date and time in GMT when the composition generated media was deleted, specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.



358
359
360
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 358

def date_deleted
    @properties['date_deleted']
end

#deleteBoolean

Delete the CompositionInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



461
462
463
464
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 461

def delete

    context.delete
end

#durationString

Returns The duration of the composition’s media file in seconds.

Returns:

  • (String)

    The duration of the composition’s media file in seconds.



424
425
426
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 424

def duration
    @properties['duration']
end

#fetchCompositionInstance

Fetch the CompositionInstance

Returns:



469
470
471
472
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 469

def fetch

    context.fetch
end

#formatFormat

Returns:

  • (Format)


406
407
408
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 406

def format
    @properties['format']
end

#inspectObject

Provide a detailed, user friendly representation



483
484
485
486
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 483

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Video.V1.CompositionInstance #{values}>"
end

Returns The URL of the media file associated with the composition.

Returns:

  • (Hash)

    The URL of the media file associated with the composition.



454
455
456
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 454

def links
    @properties['links']
end

#media_external_locationString

Returns The URL of the media file associated with the composition when stored externally. See [External S3 Compositions](/docs/video/api/external-s3-compositions) for more details.

Returns:

  • (String)

    The URL of the media file associated with the composition when stored externally. See [External S3 Compositions](/docs/video/api/external-s3-compositions) for more details.



430
431
432
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 430

def media_external_location
    @properties['media_external_location']
end

#resolutionString

Returns The dimensions of the video image in pixels expressed as columns (width) and rows (height). The string’s format is ‘widthxheight`, such as `640x480`.

Returns:

  • (String)

    The dimensions of the video image in pixels expressed as columns (width) and rows (height). The string’s format is ‘widthxheight`, such as `640x480`.



394
395
396
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 394

def resolution
    @properties['resolution']
end

#room_sidString

Returns The SID of the Group Room that generated the audio and video tracks used in the composition. All media sources included in a composition must belong to the same Group Room.

Returns:

  • (String)

    The SID of the Group Room that generated the audio and video tracks used in the composition. All media sources included in a composition must belong to the same Group Room.



370
371
372
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 370

def room_sid
    @properties['room_sid']
end

#sidString

Returns The unique string that we created to identify the Composition resource.

Returns:

  • (String)

    The unique string that we created to identify the Composition resource.



364
365
366
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 364

def sid
    @properties['sid']
end

#sizeString

Returns The size of the composed media file in bytes.

Returns:

  • (String)

    The size of the composed media file in bytes.



418
419
420
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 418

def size
    @properties['size']
end

#statusStatus

Returns:

  • (Status)


340
341
342
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 340

def status
    @properties['status']
end

#status_callbackString

Returns The URL called using the ‘status_callback_method` to send status information on every composition event.

Returns:

  • (String)

    The URL called using the ‘status_callback_method` to send status information on every composition event.



436
437
438
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 436

def status_callback
    @properties['status_callback']
end

#status_callback_methodString

Returns The HTTP method used to call ‘status_callback`. Can be: `POST` or `GET`, defaults to `POST`.

Returns:

  • (String)

    The HTTP method used to call ‘status_callback`. Can be: `POST` or `GET`, defaults to `POST`.



442
443
444
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 442

def status_callback_method
    @properties['status_callback_method']
end

#to_sObject

Provide a user friendly representation



476
477
478
479
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 476

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Video.V1.CompositionInstance #{values}>"
end

#trimBoolean

Returns Whether to remove intervals with no media, as specified in the POST request that created the composition. Compositions with ‘trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info.

Returns:

  • (Boolean)

    Whether to remove intervals with no media, as specified in the POST request that created the composition. Compositions with ‘trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info.



400
401
402
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 400

def trim
    @properties['trim']
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource.



448
449
450
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 448

def url
    @properties['url']
end

#video_layoutHash

Returns An object that describes the video layout of the composition in terms of regions. See [Specifying Video Layouts](www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info.

Returns:



388
389
390
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 388

def video_layout
    @properties['video_layout']
end