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

  • sid (String) (defaults to: nil)

    The SID of the PlayerStreamer resource to fetch.


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

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'].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


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

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:


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

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


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

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


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

def date_updated
  @properties['date_updated']
end

#ended_reasonplayer_streamer.EndedReason

Returns The reason why a PlayerStreamer ended.

Returns:


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

def ended_reason
  @properties['ended_reason']
end

#fetchPlayerStreamerInstance

Fetch the PlayerStreamerInstance

Returns:


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

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


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

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

Returns The URLs of related resources.

Returns:

  • (String)

    The URLs of related resources


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

def links
  @properties['links']
end

#max_durationString

Returns Maximum PlayerStreamer duration in seconds.

Returns:

  • (String)

    Maximum PlayerStreamer duration in seconds


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

def max_duration
  @properties['max_duration']
end

#playback_grantplayback_grant

Access the playback_grant

Returns:


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

def playback_grant
  context.playback_grant
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource


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

def sid
  @properties['sid']
end

#statusplayer_streamer.Status

Returns The status of the PlayerStreamer.

Returns:


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

def status
  @properties['status']
end

#status_callbackString

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

Returns:

  • (String)

    The URL to which Twilio will send PlayerStreamer event updates


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

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


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

def status_callback_method
  @properties['status_callback_method']
end

#to_sObject

Provide a user friendly representation


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

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

    The status the PlayerStreamer should be transitioned to. Can be: `ended`.

Returns:


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

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


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

def url
  @properties['url']
end

#videoBoolean

Returns Whether the PlayerStreamer is configured to stream video.

Returns:

  • (Boolean)

    Whether the PlayerStreamer is configured to stream video


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

def video
  @properties['video']
end