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

  • sid (String) (defaults to: nil)

    The SID of the MediaProcessor resource to fetch.


257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/twilio-ruby/rest/media/v1/media_processor.rb', line 257

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'].to_i,
  }

  # 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


294
295
296
# File 'lib/twilio-ruby/rest/media/v1/media_processor.rb', line 294

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:


285
286
287
288
289
290
# File 'lib/twilio-ruby/rest/media/v1/media_processor.rb', line 285

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


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

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


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

def date_updated
  @properties['date_updated']
end

#ended_reasonString

Returns The reason why a MediaProcessor ended.

Returns:

  • (String)

    The reason why a MediaProcessor ended


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

def ended_reason
  @properties['ended_reason']
end

#extensionString

Returns The Media Extension name or URL.

Returns:

  • (String)

    The Media Extension name or URL


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

def extension
  @properties['extension']
end

#extension_contextString

Returns The Media Extension context.

Returns:

  • (String)

    The Media Extension context


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

def extension_context
  @properties['extension_context']
end

#fetchMediaProcessorInstance

Fetch the MediaProcessorInstance

Returns:


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

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


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

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

#max_durationString

Returns Maximum MediaProcessor duration in seconds.

Returns:

  • (String)

    Maximum MediaProcessor duration in seconds


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

def max_duration
  @properties['max_duration']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource


300
301
302
# File 'lib/twilio-ruby/rest/media/v1/media_processor.rb', line 300

def sid
  @properties['sid']
end

#statusmedia_processor.Status

Returns The status of the MediaProcessor.

Returns:


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

def status
  @properties['status']
end

#status_callbackString

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

Returns:

  • (String)

    The URL to which Twilio will send MediaProcessor event updates


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

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


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

def status_callback_method
  @properties['status_callback_method']
end

#to_sObject

Provide a user friendly representation


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

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 (media_processor.UpdateStatus) (defaults to: nil)

    The status of the MediaProcessor. Can be `ended`.

Returns:


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

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


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

def url
  @properties['url']
end