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.



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/twilio-ruby/rest/media/v1/player_streamer.rb', line 250

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

  # 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



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

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:



277
278
279
280
281
282
# File 'lib/twilio-ruby/rest/media/v1/player_streamer.rb', line 277

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



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

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



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

def date_updated
  @properties['date_updated']
end

#ended_reasonplayer_streamer.EndedReason

Returns The reason why a PlayerStreamer ended.

Returns:



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

def ended_reason
  @properties['ended_reason']
end

#fetchPlayerStreamerInstance

Fetch the PlayerStreamerInstance

Returns:



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

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



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

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



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

def links
  @properties['links']
end

#playback_grantplayback_grant

Access the playback_grant

Returns:



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

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



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

def sid
  @properties['sid']
end

#statusplayer_streamer.Status

Returns The status of the PlayerStreamer.

Returns:



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

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



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

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



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

def status_callback_method
  @properties['status_callback_method']
end

#to_sObject

Provide a user friendly representation



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

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:



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

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



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

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



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

def video
  @properties['video']
end