Class: Twilio::REST::Video::V1::CompositionHookInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the CompositionHookInstance

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 CompositionHook resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 333

def initialize(version, payload , sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'friendly_name' => payload['friendly_name'],
        'enabled' => payload['enabled'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'sid' => payload['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'],
        'status_callback' => payload['status_callback'],
        'status_callback_method' => payload['status_callback_method'],
        'url' => payload['url'],
    }

    # 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 CompositionHook resource.

Returns:



373
374
375
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 373

def 
    @properties['account_sid']
end

#audio_sourcesArray<String>

Returns The array of track names to include in the compositions created by the composition hook. A composition triggered by the composition hook 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`. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request.

Returns:

  • (Array<String>)

    The array of track names to include in the compositions created by the composition hook. A composition triggered by the composition hook 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`. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request



409
410
411
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 409

def audio_sources
    @properties['audio_sources']
end

#audio_sources_excludedArray<String>

Returns The array of track names to exclude from the compositions created by the composition hook. A composition triggered by the composition hook 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 compositions created by the composition hook. A composition triggered by the composition hook 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.



415
416
417
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 415

def audio_sources_excluded
    @properties['audio_sources_excluded']
end

#contextCompositionHookContext

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

Returns:



364
365
366
367
368
369
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 364

def context
    unless @instance_context
        @instance_context = CompositionHookContext.new(@version , @params['sid'])
    end
    @instance_context
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:



391
392
393
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 391

def date_created
    @properties['date_created']
end

#date_updatedTime

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

Returns:



397
398
399
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 397

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the CompositionHookInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



464
465
466
467
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 464

def delete

    context.delete
end

#enabledBoolean

Returns Whether the CompositionHook is active. When ‘true`, the CompositionHook is triggered for every completed Group Room on the account. When `false`, the CompositionHook is never triggered.

Returns:

  • (Boolean)

    Whether the CompositionHook is active. When ‘true`, the CompositionHook is triggered for every completed Group Room on the account. When `false`, the CompositionHook is never triggered.



385
386
387
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 385

def enabled
    @properties['enabled']
end

#fetchCompositionHookInstance

Fetch the CompositionHookInstance

Returns:



472
473
474
475
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 472

def fetch

    context.fetch
end

#formatFormat

Returns:

  • (Format)


439
440
441
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 439

def format
    @properties['format']
end

#friendly_nameString

Returns The string that you assigned to describe the resource. Can be up to 100 characters long and must be unique within the account.

Returns:

  • (String)

    The string that you assigned to describe the resource. Can be up to 100 characters long and must be unique within the account.



379
380
381
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 379

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



526
527
528
529
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 526

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Video.V1.CompositionHookInstance #{values}>"
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`.



427
428
429
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 427

def resolution
    @properties['resolution']
end

#sidString

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

Returns:

  • (String)

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



403
404
405
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 403

def sid
    @properties['sid']
end

#status_callbackString

Returns The URL we call using the ‘status_callback_method` to send status information to your application.

Returns:

  • (String)

    The URL we call using the ‘status_callback_method` to send status information to your application.



445
446
447
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 445

def status_callback
    @properties['status_callback']
end

#status_callback_methodString

Returns The HTTP method we should use to call ‘status_callback`. Can be `POST` or `GET` and defaults to `POST`.

Returns:

  • (String)

    The HTTP method we should use to call ‘status_callback`. Can be `POST` or `GET` and defaults to `POST`.



451
452
453
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 451

def status_callback_method
    @properties['status_callback_method']
end

#to_sObject

Provide a user friendly representation



519
520
521
522
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 519

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

#trimBoolean

Returns Whether intervals with no media are clipped, as specified in the POST request that created the CompositionHook resource. 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 intervals with no media are clipped, as specified in the POST request that created the CompositionHook resource. 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.



433
434
435
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 433

def trim
    @properties['trim']
end

#update(friendly_name: nil, enabled: :unset, video_layout: :unset, audio_sources: :unset, audio_sources_excluded: :unset, trim: :unset, format: :unset, resolution: :unset, status_callback: :unset, status_callback_method: :unset) ⇒ CompositionHookInstance

Update the CompositionHookInstance

Parameters:

  • friendly_name (String) (defaults to: nil)

    A descriptive string that you create to describe the resource. It can be up to 100 characters long and it must be unique within the account.

  • enabled (Boolean) (defaults to: :unset)

    Whether the composition hook is active. When ‘true`, the composition hook will be triggered for every completed Group Room in the account. When `false`, the composition hook never triggers.

  • video_layout (Object) (defaults to: :unset)

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

  • audio_sources (Array[String]) (defaults to: :unset)

    An array of track names from the same group room to merge into the compositions created by the composition hook. Can include zero or more track names. A composition triggered by the composition hook includes all audio sources specified in ‘audio_sources` except those specified in `audio_sources_excluded`. The track names in this parameter 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`.

  • audio_sources_excluded (Array[String]) (defaults to: :unset)

    An array of track names to exclude. A composition triggered by the composition hook includes all audio sources specified in ‘audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter 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.

  • trim (Boolean) (defaults to: :unset)

    Whether to clip the intervals where there is no active media in the compositions triggered by the composition hook. The default is ‘true`. 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.

  • format (Format) (defaults to: :unset)
  • resolution (String) (defaults to: :unset)

    A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to ‘640x480`. The string’s format is ‘widthxheight` where: * 16 <= `width` <= 1280 * 16 <= `height` <= 1280 * `width` * `height` <= 921,600 Typical values are: * HD = `1280x720` * PAL = `1024x576` * VGA = `640x480` * CIF = `320x240` Note that the `resolution` imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See [Specifying Video Layouts](www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info.

  • status_callback (String) (defaults to: :unset)

    The URL we should call using the ‘status_callback_method` to send status information to your application on every composition event. If not provided, status callback events will not be dispatched.

  • status_callback_method (String) (defaults to: :unset)

    The HTTP method we should use to call ‘status_callback`. Can be: `POST` or `GET` and the default is `POST`.

Returns:



490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 490

def update(
    friendly_name: nil, 
    enabled: :unset, 
    video_layout: :unset, 
    audio_sources: :unset, 
    audio_sources_excluded: :unset, 
    trim: :unset, 
    format: :unset, 
    resolution: :unset, 
    status_callback: :unset, 
    status_callback_method: :unset
)

    context.update(
        friendly_name: friendly_name, 
        enabled: enabled, 
        video_layout: video_layout, 
        audio_sources: audio_sources, 
        audio_sources_excluded: audio_sources_excluded, 
        trim: trim, 
        format: format, 
        resolution: resolution, 
        status_callback: status_callback, 
        status_callback_method: status_callback_method, 
    )
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource.



457
458
459
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 457

def url
    @properties['url']
end

#video_layoutHash

Returns A JSON object that describes the video layout of the composition in terms of regions as specified in the HTTP POST request that created the CompositionHook resource. See [POST Parameters](www.twilio.com/docs/video/api/compositions-resource#http-post-parameters) for more information. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request.

Returns:

  • (Hash)

    A JSON object that describes the video layout of the composition in terms of regions as specified in the HTTP POST request that created the CompositionHook resource. See [POST Parameters](www.twilio.com/docs/video/api/compositions-resource#http-post-parameters) for more information. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request



421
422
423
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 421

def video_layout
    @properties['video_layout']
end