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.



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 221

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_sid ⇒ String

Returns The unique SID identifier of the Account.

Returns:

  • (String) —

    The unique SID identifier of the Account.



252
253
254
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 252

def 
    @properties['account_sid']
end

#context ⇒ MediaContext

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

Returns:



243
244
245
246
247
248
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 243

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:



284
285
286
287
288
289
290
291
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 284

def fetch(
  redacted: :unset
)

    context.fetch(
        redacted: redacted, 
    )
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



302
303
304
305
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 302

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

#media_url ⇒ String

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

Returns:

  • (String) —

    Downloadable URL for media, if stored in Twilio AI.



258
259
260
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 258

def media_url
    @properties['media_url']
end

#service_sid ⇒ String

Returns The unique SID identifier of the Service.

Returns:

  • (String) —

    The unique SID identifier of the Service.



264
265
266
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 264

def service_sid
    @properties['service_sid']
end

#sid ⇒ String

Returns The unique SID identifier of the Transcript.

Returns:

  • (String) —

    The unique SID identifier of the Transcript.



270
271
272
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 270

def sid
    @properties['sid']
end

#to_s ⇒ Object

Provide a user friendly representation



295
296
297
298
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 295

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

#url ⇒ String

Returns The URL of this resource.

Returns:

  • (String) —

    The URL of this resource.



276
277
278
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript/media.rb', line 276

def url
    @properties['url']
end