Class: Twilio::REST::Media::V1::MediaProcessorInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the MediaProcessorInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/twilio-ruby/rest/media/v1/media_processor.rb', line 278

def initialize(version, payload , sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'sid' => payload['sid'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'extension' => payload['extension'],
        'extension_context' => payload['extension_context'],
        'status' => payload['status'],
        'url' => payload['url'],
        'ended_reason' => payload['ended_reason'],
        'status_callback' => payload['status_callback'],
        'status_callback_method' => payload['status_callback_method'],
        'max_duration' => payload['max_duration'] == nil ? payload['max_duration'] : payload['max_duration'].to_i,
    }

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

Returns:



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

def 
    @properties['account_sid']
end

#contextMediaProcessorContext

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

Returns:



306
307
308
309
310
311
# File 'lib/twilio-ruby/rest/media/v1/media_processor.rb', line 306

def context
    unless @instance_context
        @instance_context = MediaProcessorContext.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:



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

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:



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

def date_updated
    @properties['date_updated']
end

#ended_reasonString

Returns The reason why a MediaProcessor ended. When a MediaProcessor is in progress, will be ‘null`. When a MediaProcessor is completed, can be `ended-via-api`, `max-duration-exceeded`, `error-loading-extension`, `error-streaming-media` or `internal-service-error`. See [ended reasons](/docs/live/api/mediaprocessors#mediaprocessor-ended-reason-values) for more details.

Returns:

  • (String)

    The reason why a MediaProcessor ended. When a MediaProcessor is in progress, will be ‘null`. When a MediaProcessor is completed, can be `ended-via-api`, `max-duration-exceeded`, `error-loading-extension`, `error-streaming-media` or `internal-service-error`. See [ended reasons](/docs/live/api/mediaprocessors#mediaprocessor-ended-reason-values) for more details.



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

def ended_reason
    @properties['ended_reason']
end

#extensionString

Returns The [Media Extension](/docs/live/media-extensions-overview) name or URL. Ex: ‘video-composer-v2`.

Returns:

  • (String)

    The [Media Extension](/docs/live/media-extensions-overview) name or URL. Ex: ‘video-composer-v2`



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

def extension
    @properties['extension']
end

#extension_contextString

Returns The context of the Media Extension, represented as a JSON dictionary. See the documentation for the specific [Media Extension](/docs/live/media-extensions-overview) you are using for more information about the context to send.

Returns:

  • (String)

    The context of the Media Extension, represented as a JSON dictionary. See the documentation for the specific [Media Extension](/docs/live/media-extensions-overview) you are using for more information about the context to send.



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

def extension_context
    @properties['extension_context']
end

#fetchMediaProcessorInstance

Fetch the MediaProcessorInstance

Returns:



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

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



415
416
417
418
# File 'lib/twilio-ruby/rest/media/v1/media_processor.rb', line 415

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

#max_durationString

Returns The maximum time, in seconds, that the MediaProcessor can run before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the MediaProcessor, regardless of whether media is still streaming.

Returns:

  • (String)

    The maximum time, in seconds, that the MediaProcessor can run before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the MediaProcessor, regardless of whether media is still streaming.



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

def max_duration
    @properties['max_duration']
end

#sidString

Returns The unique string generated to identify the MediaProcessor resource.

Returns:

  • (String)

    The unique string generated to identify the MediaProcessor resource.



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

def sid
    @properties['sid']
end

#statusStatus

Returns:

  • (Status)


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

def status
    @properties['status']
end

#status_callbackString

Returns The URL to which Twilio will send asynchronous webhook requests for every MediaProcessor event. See [Status Callbacks](/docs/live/api/status-callbacks) for details.

Returns:

  • (String)

    The URL to which Twilio will send asynchronous webhook requests for every MediaProcessor event. See [Status Callbacks](/docs/live/api/status-callbacks) for details.



369
370
371
# File 'lib/twilio-ruby/rest/media/v1/media_processor.rb', line 369

def status_callback
    @properties['status_callback']
end

#status_callback_methodString

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

Returns:

  • (String)

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



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

def status_callback_method
    @properties['status_callback_method']
end

#to_sObject

Provide a user friendly representation



408
409
410
411
# File 'lib/twilio-ruby/rest/media/v1/media_processor.rb', line 408

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

#update(status: nil) ⇒ MediaProcessorInstance

Update the MediaProcessorInstance

Parameters:

  • status (UpdateStatus) (defaults to: nil)

Returns:



397
398
399
400
401
402
403
404
# File 'lib/twilio-ruby/rest/media/v1/media_processor.rb', line 397

def update(
    status: nil
)

    context.update(
        status: status, 
    )
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource.



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

def url
    @properties['url']
end