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.



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 244

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.



284
285
286
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 284

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.



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

def codec
  @properties['codec']
end

#container_formatrecording.Format

Returns The file format for this Recording.

Returns:

  • (recording.Format)

    The file format for this Recording.



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

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:



275
276
277
278
279
280
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 275

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.



296
297
298
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 296

def date_created
  @properties['date_created']
end

#deleteBoolean

Deletes the RecordingInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

def delete
  context.delete
end

#durationString

Returns Duration of the Recording in seconds.

Returns:

  • (String)

    Duration of the Recording in seconds.



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

def duration
  @properties['duration']
end

#fetchRecordingInstance

Fetch a RecordingInstance

Returns:



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

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.



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

def grouping_sids
  @properties['grouping_sids']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

Returns The links.

Returns:

  • (String)

    The links



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

def links
  @properties['links']
end

#offsetString

Returns Offset in miliseconds for this track.

Returns:

  • (String)

    Offset in miliseconds for this track.



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

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.



302
303
304
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 302

def sid
  @properties['sid']
end

#sizeString

Returns Size of the recorded track, in bytes.

Returns:

  • (String)

    Size of the recorded track, in bytes.



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

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.



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

def source_sid
  @properties['source_sid']
end

#statusrecording.Status

Returns The status of the Recording.

Returns:

  • (recording.Status)

    The status of the Recording.



290
291
292
# File 'lib/twilio-ruby/rest/video/v1/recording.rb', line 290

def status
  @properties['status']
end

#to_sObject

Provide a user friendly representation



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

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.



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

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.



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

def type
  @properties['type']
end

#urlString

Returns The absolute URL for this resource.

Returns:

  • (String)

    The absolute URL for this resource.



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

def url
  @properties['url']
end