Class: Twilio::REST::Media::V1::PlayerStreamerContext::PlaybackGrantContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/media/v1/player_streamer/playback_grant.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ PlaybackGrantContext

Initialize the PlaybackGrantContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the PlayerStreamer resource to fetch.


70
71
72
73
74
75
76
# File 'lib/twilio-ruby/rest/media/v1/player_streamer/playback_grant.rb', line 70

def initialize(version, sid)
  super(version)

  # Path Solution
  @solution = {sid: sid, }
  @uri = "/PlayerStreamers/#{@solution[:sid]}/PlaybackGrant"
end

Instance Method Details

#create(ttl: :unset, access_control_allow_origin: :unset) ⇒ PlaybackGrantInstance

Create the PlaybackGrantInstance

Parameters:

  • ttl (String) (defaults to: :unset)

    The time to live of the PlaybackGrant. Default value is 15 seconds. Maximum value is 60 seconds.

  • access_control_allow_origin (String) (defaults to: :unset)

    The full origin URL where the livestream can be streamed. If this is not provided, it can be streamed from any domain.

Returns:


86
87
88
89
90
91
92
# File 'lib/twilio-ruby/rest/media/v1/player_streamer/playback_grant.rb', line 86

def create(ttl: :unset, access_control_allow_origin: :unset)
  data = Twilio::Values.of({'Ttl' => ttl, 'AccessControlAllowOrigin' => access_control_allow_origin, })

  payload = @version.create('POST', @uri, data: data)

  PlaybackGrantInstance.new(@version, payload, sid: @solution[:sid], )
end

#fetchPlaybackGrantInstance

Fetch the PlaybackGrantInstance

Returns:


97
98
99
100
101
# File 'lib/twilio-ruby/rest/media/v1/player_streamer/playback_grant.rb', line 97

def fetch
  payload = @version.fetch('GET', @uri)

  PlaybackGrantInstance.new(@version, payload, sid: @solution[:sid], )
end

#inspectObject

Provide a detailed, user friendly representation


112
113
114
115
# File 'lib/twilio-ruby/rest/media/v1/player_streamer/playback_grant.rb', line 112

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Media.V1.PlaybackGrantContext #{context}>"
end

#to_sObject

Provide a user friendly representation


105
106
107
108
# File 'lib/twilio-ruby/rest/media/v1/player_streamer/playback_grant.rb', line 105

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Media.V1.PlaybackGrantContext #{context}>"
end