Class: Twilio::REST::Media::V1::PlayerStreamerInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the PlayerStreamerInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/twilio-ruby/rest/media/v1/player_streamer.rb', line 282

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']),
        'video' => payload['video'],
        'links' => payload['links'],
        'sid' => payload['sid'],
        'status' => payload['status'],
        'url' => payload['url'],
        'status_callback' => payload['status_callback'],
        'status_callback_method' => payload['status_callback_method'],
        'ended_reason' => payload['ended_reason'],
        '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 PlayerStreamer resource.

Returns:



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

def 
    @properties['account_sid']
end

#contextPlayerStreamerContext

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

Returns:



310
311
312
313
314
315
# File 'lib/twilio-ruby/rest/media/v1/player_streamer.rb', line 310

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



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

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:



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

def date_updated
    @properties['date_updated']
end

#ended_reasonEndedReason

Returns:

  • (EndedReason)


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

def ended_reason
    @properties['ended_reason']
end

#fetchPlayerStreamerInstance

Fetch the PlayerStreamerInstance

Returns:



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

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



426
427
428
429
# File 'lib/twilio-ruby/rest/media/v1/player_streamer.rb', line 426

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

Returns The URLs of related resources.

Returns:

  • (Hash)

    The URLs of related resources.



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

def links
    @properties['links']
end

#max_durationString

Returns The maximum time, in seconds, that the PlayerStreamer is active (‘created` or `started`) 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 PlayerStreamer, regardless of whether media is still streaming.

Returns:

  • (String)

    The maximum time, in seconds, that the PlayerStreamer is active (‘created` or `started`) 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 PlayerStreamer, regardless of whether media is still streaming.



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

def max_duration
    @properties['max_duration']
end

#playback_grantplayback_grant

Access the playback_grant

Returns:



413
414
415
# File 'lib/twilio-ruby/rest/media/v1/player_streamer.rb', line 413

def playback_grant
    context.playback_grant
end

#sidString

Returns The unique string generated to identify the PlayerStreamer resource.

Returns:

  • (String)

    The unique string generated to identify the PlayerStreamer resource.



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

def sid
    @properties['sid']
end

#statusStatus

Returns:

  • (Status)


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

def status
    @properties['status']
end

#status_callbackString

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

Returns:

  • (String)

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



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

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`.



373
374
375
# File 'lib/twilio-ruby/rest/media/v1/player_streamer.rb', line 373

def status_callback_method
    @properties['status_callback_method']
end

#to_sObject

Provide a user friendly representation



419
420
421
422
# File 'lib/twilio-ruby/rest/media/v1/player_streamer.rb', line 419

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

#update(status: nil) ⇒ PlayerStreamerInstance

Update the PlayerStreamerInstance

Parameters:

  • status (UpdateStatus) (defaults to: nil)

Returns:



401
402
403
404
405
406
407
408
# File 'lib/twilio-ruby/rest/media/v1/player_streamer.rb', line 401

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.



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

def url
    @properties['url']
end

#videoBoolean

Returns Specifies whether the PlayerStreamer is configured to stream video. Defaults to ‘true`.

Returns:

  • (Boolean)

    Specifies whether the PlayerStreamer is configured to stream video. Defaults to ‘true`.



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

def video
    @properties['video']
end