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

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

Defined Under Namespace

Classes: MediaContext, MediaInstance, MediaList, MediaPage, OperatorResultContext, OperatorResultInstance, OperatorResultList, OperatorResultPage, SentenceInstance, SentenceList, SentencePage

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ TranscriptContext

Initialize the TranscriptContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    A 34 character string that uniquely identifies this Transcript.



218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript.rb', line 218

def initialize(version, sid)
    super(version)

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

    # Dependents
    @sentences = nil
    @media = nil
    @operator_results = nil
end

Instance Method Details

#deleteBoolean

Delete the TranscriptInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



233
234
235
236
237
238
239
240
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript.rb', line 233

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchTranscriptInstance

Fetch the TranscriptInstance

Returns:



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript.rb', line 245

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    TranscriptInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



311
312
313
314
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript.rb', line 311

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

#mediaMediaList, MediaContext

Access the media

Returns:



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

def media
    MediaContext.new(
            @version,
            @solution[:sid]
            )
end

#operator_results(operator_sid = :unset) ⇒ OperatorResultList, OperatorResultContext

Access the operator_results

Returns:

Raises:

  • (ArgumentError)


286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript.rb', line 286

def operator_results(operator_sid=:unset)

    raise ArgumentError, 'operator_sid cannot be nil' if operator_sid.nil?

    if operator_sid != :unset
        return OperatorResultContext.new(@version, @solution[:sid],operator_sid )
    end

    unless @operator_results
        @operator_results = OperatorResultList.new(
            @version, transcript_sid: @solution[:sid], )
    end

 @operator_results
end

#sentencesSentenceList, SentenceContext

Access the sentences

Returns:



265
266
267
268
269
270
271
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript.rb', line 265

def sentences
  unless @sentences
    @sentences = SentenceList.new(
            @version, transcript_sid: @solution[:sid], )
  end
  @sentences
end

#to_sObject

Provide a user friendly representation



304
305
306
307
# File 'lib/twilio-ruby/rest/intelligence/v2/transcript.rb', line 304

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