Class: Twilio::REST::Video::V1::RecordingInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the RecordingInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The Recording Sid that uniquely identifies the Recording to fetch.



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 266

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']),
      'sid' => payload['sid'],
      'source_sid' => payload['source_sid'],
      'size' => payload['size'].to_i,
      'url' => payload['url'],
      'type' => payload['type'],
      'duration' => payload['duration'] == nil ? payload['duration'] : payload['duration'].to_i,
      'container_format' => payload['container_format'],
      'codec' => payload['codec'],
      'grouping_sids' => payload['grouping_sids'],
      'track_name' => payload['track_name'],
      'offset' => payload['offset'].to_i,
      'links' => payload['links'],
  }

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

Instance Method Details

#account_sidString

Returns Twilio Account SID.

Returns:

  • (String)

    Twilio Account SID.



306
307
308
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 306

def 
  @properties['account_sid']
end

#codecrecording.Codec

Returns The codec used to encode the track.

Returns:

  • (recording.Codec)

    The codec used to encode the track.



366
367
368
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 366

def codec
  @properties['codec']
end

#container_formatrecording.Format

Returns The file format for this Recording.

Returns:

  • (recording.Format)

    The file format for this Recording.



360
361
362
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 360

def container_format
  @properties['container_format']
end

#contextRecordingContext

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

Returns:



297
298
299
300
301
302
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 297

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

#date_createdTime

Returns Date when the media recording began writing.

Returns:

  • (Time)

    Date when the media recording began writing.



318
319
320
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 318

def date_created
  @properties['date_created']
end

#deleteBoolean

Deletes the RecordingInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

def delete
  context.delete
end

#durationString

Returns Duration of the Recording in seconds.

Returns:

  • (String)

    Duration of the Recording in seconds.



354
355
356
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 354

def duration
  @properties['duration']
end

#fetchRecordingInstance

Fetch a RecordingInstance

Returns:



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

def fetch
  context.fetch
end

#grouping_sidsHash

Returns A list of Sids related to this Recording.

Returns:

  • (Hash)

    A list of Sids related to this Recording.



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

def grouping_sids
  @properties['grouping_sids']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

Returns The links.

Returns:

  • (String)

    The links



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

def links
  @properties['links']
end

#offsetString

Returns Offset in milliseconds for this track.

Returns:

  • (String)

    Offset in milliseconds for this track.



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

def offset
  @properties['offset']
end

#sidString

Returns A 34-character string that uniquely identifies this Recording.

Returns:

  • (String)

    A 34-character string that uniquely identifies this Recording.



324
325
326
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 324

def sid
  @properties['sid']
end

#sizeString

Returns Size of the recorded track, in bytes.

Returns:

  • (String)

    Size of the recorded track, in bytes.



336
337
338
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 336

def size
  @properties['size']
end

#source_sidString

Returns A 34-character string that uniquely identifies the source of this Recording.

Returns:

  • (String)

    A 34-character string that uniquely identifies the source of this Recording.



330
331
332
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 330

def source_sid
  @properties['source_sid']
end

#statusrecording.Status

Returns The status of the Recording.

Returns:

  • (recording.Status)

    The status of the Recording.



312
313
314
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 312

def status
  @properties['status']
end

#to_sObject

Provide a user friendly representation



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

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

#track_nameString

Returns The name that was given to the source track of this recording.

Returns:

  • (String)

    The name that was given to the source track of this recording.



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

def track_name
  @properties['track_name']
end

#typerecording.Type

Returns Indicates the media type for this recording.

Returns:

  • (recording.Type)

    Indicates the media type for this recording.



348
349
350
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 348

def type
  @properties['type']
end

#urlString

Returns The absolute URL for this resource.

Returns:

  • (String)

    The absolute URL for this resource.



342
343
344
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 342

def url
  @properties['url']
end