Class: Twilio::REST::Knowledge::V2::ChunkInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/knowledge/v2/chunk.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, kb_id: nil, knowledge_id: nil) ⇒ ChunkInstance

Initialize the ChunkInstance

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

  • sid (String)

    The SID of the Call resource to fetch.



265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/twilio-ruby/rest/knowledge/v2/chunk.rb', line 265

def initialize(version, payload , kb_id: nil, knowledge_id: nil)
    
    apiV1Version = ApiV1Version.new version.domain, version
    super(apiV1Version)
    
    # Marshaled Properties
    @properties = { 
        'content' => payload['content'],
        'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']),
        'chunk_index' => payload['chunk_index'] == nil ? payload['chunk_index'] : payload['chunk_index'].to_i,
        'document_title' => payload['document_title'],
        'document_url' => payload['document_url'],
        'document_number' => payload['document_number'] == nil ? payload['document_number'] : payload['document_number'].to_i,
    }
end

Instance Method Details

#chunk_indexString

Returns 0-based position of this chunk within its source document for a single ingestion run.

Returns:

  • (String)

    0-based position of this chunk within its source document for a single ingestion run.



296
297
298
# File 'lib/twilio-ruby/rest/knowledge/v2/chunk.rb', line 296

def chunk_index
    @properties['chunk_index']
end

#contentString

Returns The chunk content.

Returns:

  • (String)

    The chunk content.



284
285
286
# File 'lib/twilio-ruby/rest/knowledge/v2/chunk.rb', line 284

def content
    @properties['content']
end

#created_atTime

Returns The date and time in GMT when the Chunk was created specified in ISO 8601 format.

Returns:

  • (Time)

    The date and time in GMT when the Chunk was created specified in ISO 8601 format.



290
291
292
# File 'lib/twilio-ruby/rest/knowledge/v2/chunk.rb', line 290

def created_at
    @properties['created_at']
end

#document_numberString

Returns Physical page number (1-based). PDF sources only; omitted for all other source types.

Returns:

  • (String)

    Physical page number (1-based). PDF sources only; omitted for all other source types.



314
315
316
# File 'lib/twilio-ruby/rest/knowledge/v2/chunk.rb', line 314

def document_number
    @properties['document_number']
end

#document_titleString

Returns Human-readable title of the source document. Web: HTML from the crawled page. File: filename from Unstructured metadata. Text: knowledge name from the knowledge source.</p> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>String</tt>)</span> — <div class='inline'><p>Human-readable title of the source document. Web: HTML <title> from the crawled page. File: filename from Unstructured metadata. Text: knowledge name from the knowledge source.</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 302 303 304</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/twilio-ruby/rest/knowledge/v2/chunk.rb', line 302</span> <span class='kw'>def</span> <span class='id identifier rubyid_document_title'>document_title</span> <span class='ivar'>@properties</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>document_title</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="document_url-instance_method"> #<strong>document_url</strong> ⇒ <tt>String</tt> </h3><div class="docstring"> <div class="discussion"> <p>Returns Specific page URL this chunk was crawled from. Web sources only; null for File and Text sources.</p> </div> </div> <div class="tags"> <p class="tag_title">Returns:</p> <ul class="return"> <li> <span class='type'>(<tt>String</tt>)</span> — <div class='inline'><p>Specific page URL this chunk was crawled from. Web sources only; null for File and Text sources.</p></div> </li> </ul> </div><table class="source_code"> <tr> <td> <pre class="lines"> 308 309 310</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/twilio-ruby/rest/knowledge/v2/chunk.rb', line 308</span> <span class='kw'>def</span> <span class='id identifier rubyid_document_url'>document_url</span> <span class='ivar'>@properties</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>document_url</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="inspect-instance_method"> #<strong>inspect</strong> ⇒ <tt>Object</tt> </h3><div class="docstring"> <div class="discussion"> <p>Provide a detailed, user friendly representation</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 326 327 328</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/twilio-ruby/rest/knowledge/v2/chunk.rb', line 326</span> <span class='kw'>def</span> <span class='id identifier rubyid_inspect'>inspect</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'><Twilio.Knowledge.V2.ChunkInstance></span><span class='tstring_end'>"</span></span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> <div class="method_details "> <h3 class="signature " id="to_s-instance_method"> #<strong>to_s</strong> ⇒ <tt>Object</tt> </h3><div class="docstring"> <div class="discussion"> <p>Provide a user friendly representation</p> </div> </div> <div class="tags"> </div><table class="source_code"> <tr> <td> <pre class="lines"> 320 321 322</pre> </td> <td> <pre class="code"><span class="info file"># File 'lib/twilio-ruby/rest/knowledge/v2/chunk.rb', line 320</span> <span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'><Twilio.Knowledge.V2.ChunkInstance></span><span class='tstring_end'>"</span></span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> </div> </div> <div id="footer"> Generated on Mon Aug 24 10:50:40 2026 by <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.9.45 (ruby-4.0.2). </div> </div> </body> </html>