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

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

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

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

  • sid (String) (defaults to: nil)

    The SID of the Composition resource to fetch.



332
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
359
360
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 332

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'].to_i,
      'size' => payload['size'].to_i,
      'duration' => payload['duration'].to_i,
      '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 that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource



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

def 
  @properties['account_sid']
end

#audio_sourcesString

Returns The array of track names to include in the composition.

Returns:

  • (String)

    The array of track names to include in the composition



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

def audio_sources
  @properties['audio_sources']
end

#audio_sources_excludedString

Returns The array of track names to exclude from the composition.

Returns:

  • (String)

    The array of track names to exclude from the composition



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

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



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

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:



366
367
368
369
370
371
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 366

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

#date_completedTime

Returns Date when the media processing task finished.

Returns:

  • (Time)

    Date when the media processing task finished



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

def date_completed
  @properties['date_completed']
end

#date_createdTime

Returns The ISO 8601 date and time in GMT when the resource was created.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the resource was created



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

def date_created
  @properties['date_created']
end

#date_deletedTime

Returns The ISO 8601 date and time in GMT when the composition generated media was deleted.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the composition generated media was deleted



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

def date_deleted
  @properties['date_deleted']
end

#deleteBoolean

Deletes the CompositionInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



491
492
493
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 491

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



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

def duration
  @properties['duration']
end

#fetchCompositionInstance

Fetch a CompositionInstance

Returns:



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

def fetch
  context.fetch
end

#formatcomposition.Format

Returns The container format of the composition’s media files as specified in the POST request that created the Composition resource.

Returns:

  • (composition.Format)

    The container format of the composition’s media files as specified in the POST request that created the Composition resource



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

def format
  @properties['format']
end

#inspectObject

Provide a detailed, user friendly representation



504
505
506
507
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 504

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:

  • (String)

    The URL of the media file associated with the composition



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

def links
  @properties['links']
end

#resolutionString

Returns The dimensions of the video image in pixels expressed as columns (width) and rows (height).

Returns:

  • (String)

    The dimensions of the video image in pixels expressed as columns (width) and rows (height)



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

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.

Returns:

  • (String)

    The SID of the Group Room that generated the audio and video tracks used in the composition



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

def room_sid
  @properties['room_sid']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource



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

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



459
460
461
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 459

def size
  @properties['size']
end

#statuscomposition.Status

Returns The status of the composition.

Returns:

  • (composition.Status)

    The status of the composition



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

def status
  @properties['status']
end

#to_sObject

Provide a user friendly representation



497
498
499
500
# File 'lib/twilio-ruby/rest/video/v1/composition.rb', line 497

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.

Returns:

  • (Boolean)

    Whether to remove intervals with no media



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

def trim
  @properties['trim']
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource



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

def url
  @properties['url']
end

#video_layoutHash

Returns An object that describes the video layout of the composition.

Returns:

  • (Hash)

    An object that describes the video layout of the composition



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

def video_layout
  @properties['video_layout']
end