Class: Twilio::REST::Media::V1::MediaRecordingInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/media/v1/media_recording.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) ⇒ MediaRecordingInstance

Initialize the MediaRecordingInstance

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 MediaRecording resource to fetch.


240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/twilio-ruby/rest/media/v1/media_recording.rb', line 240

def initialize(version, payload, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'duration' => payload['duration'].to_i,
      'format' => payload['format'],
      'links' => payload['links'],
      'processor_sid' => payload['processor_sid'],
      'resolution' => payload['resolution'],
      'source_sid' => payload['source_sid'],
      'sid' => payload['sid'],
      'media_size' => payload['media_size'].to_i,
      'status' => payload['status'],
      '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 that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource


280
281
282
# File 'lib/twilio-ruby/rest/media/v1/media_recording.rb', line 280

def 
  @properties['account_sid']
end

#contextMediaRecordingContext

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

Returns:


271
272
273
274
275
276
# File 'lib/twilio-ruby/rest/media/v1/media_recording.rb', line 271

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


286
287
288
# File 'lib/twilio-ruby/rest/media/v1/media_recording.rb', line 286

def date_created
  @properties['date_created']
end

#date_updatedTime

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

Returns:

  • (Time)

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


292
293
294
# File 'lib/twilio-ruby/rest/media/v1/media_recording.rb', line 292

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the MediaRecordingInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


371
372
373
# File 'lib/twilio-ruby/rest/media/v1/media_recording.rb', line 371

def delete
  context.delete
end

#durationString

Returns The duration of the MediaRecording.

Returns:

  • (String)

    The duration of the MediaRecording


298
299
300
# File 'lib/twilio-ruby/rest/media/v1/media_recording.rb', line 298

def duration
  @properties['duration']
end

#fetchMediaRecordingInstance

Fetch the MediaRecordingInstance

Returns:


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

def fetch
  context.fetch
end

#formatmedia_recording.Format

Returns The format of the MediaRecording.

Returns:


304
305
306
# File 'lib/twilio-ruby/rest/media/v1/media_recording.rb', line 304

def format
  @properties['format']
end

#inspectObject

Provide a detailed, user friendly representation


391
392
393
394
# File 'lib/twilio-ruby/rest/media/v1/media_recording.rb', line 391

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

Returns The URLs of related resources.

Returns:

  • (String)

    The URLs of related resources


310
311
312
# File 'lib/twilio-ruby/rest/media/v1/media_recording.rb', line 310

def links
  @properties['links']
end

#media_sizeString

Returns The size of the recording media.

Returns:

  • (String)

    The size of the recording media


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

def media_size
  @properties['media_size']
end

#processor_sidString

Returns The SID of the MediaProcessor.

Returns:

  • (String)

    The SID of the MediaProcessor


316
317
318
# File 'lib/twilio-ruby/rest/media/v1/media_recording.rb', line 316

def processor_sid
  @properties['processor_sid']
end

#resolutionString

Returns The dimensions of the video image in pixels.

Returns:

  • (String)

    The dimensions of the video image in pixels


322
323
324
# File 'lib/twilio-ruby/rest/media/v1/media_recording.rb', line 322

def resolution
  @properties['resolution']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource


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

def sid
  @properties['sid']
end

#source_sidString

Returns The SID of the resource that generated the original media.

Returns:

  • (String)

    The SID of the resource that generated the original media


328
329
330
# File 'lib/twilio-ruby/rest/media/v1/media_recording.rb', line 328

def source_sid
  @properties['source_sid']
end

#statusmedia_recording.Status

Returns The status of the MediaRecording.

Returns:


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

def status
  @properties['status']
end

#status_callbackString

Returns The URL to which Twilio will send MediaRecording event updates.

Returns:

  • (String)

    The URL to which Twilio will send MediaRecording event updates


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

def status_callback
  @properties['status_callback']
end

#status_callback_methodString

Returns The HTTP method Twilio should use to call the `status_callback` URL.

Returns:

  • (String)

    The HTTP method Twilio should use to call the `status_callback` URL


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

def status_callback_method
  @properties['status_callback_method']
end

#to_sObject

Provide a user friendly representation


384
385
386
387
# File 'lib/twilio-ruby/rest/media/v1/media_recording.rb', line 384

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

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource


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

def url
  @properties['url']
end