Class: Twilio::REST::Intelligence::V2::TranscriptContext::MediaInstance

Inherits:
Twilio::REST::InstanceResource show all
Defined in:
lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb

Instance Method Summary collapse

Constructor Details

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

Initialize the MediaInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 139

def initialize(version, payload , sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'media_url' => payload['media_url'],
        'service_sid' => payload['service_sid'],
        'sid' => payload['sid'],
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = { 'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sidString

Returns The unique SID identifier of the Account.

Returns:

  • (String)

    The unique SID identifier of the Account.



169
170
171
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 169

def 
    @properties['account_sid']
end

#contextMediaContext

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

Returns:



160
161
162
163
164
165
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 160

def context
    unless @instance_context
        @instance_context = MediaContext.new(@version , @params['sid'])
    end
    @instance_context
end

#fetch(redacted: :unset) ⇒ MediaInstance

Fetch the MediaInstance

Parameters:

  • redacted (Boolean) (defaults to: :unset)

    Grant access to PII Redacted/Unredacted Media. If redaction is enabled, the default is ‘true` to access redacted media.

Returns:



201
202
203
204
205
206
207
208
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 201

def fetch(
    redacted: :unset
)

    context.fetch(
        redacted: redacted, 
    )
end

#inspectObject

Provide a detailed, user friendly representation



219
220
221
222
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 219

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

#media_urlString

Returns Downloadable URL for media, if stored in Twilio AI.

Returns:

  • (String)

    Downloadable URL for media, if stored in Twilio AI.



175
176
177
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 175

def media_url
    @properties['media_url']
end

#service_sidString

Returns The unique SID identifier of the Service.

Returns:

  • (String)

    The unique SID identifier of the Service.



181
182
183
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 181

def service_sid
    @properties['service_sid']
end

#sidString

Returns The unique SID identifier of the Transcript.

Returns:

  • (String)

    The unique SID identifier of the Transcript.



187
188
189
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 187

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



212
213
214
215
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 212

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

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



193
194
195
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 193

def url
    @properties['url']
end