Class: Twilio::REST::Assistants::V1::AssistantContext::AssistantsKnowledgeInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, assistant_id: nil, id: nil) ⇒ AssistantsKnowledgeInstance

Initialize the AssistantsKnowledgeInstance

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

  • sid (String)

    The SID of the Call resource to fetch.



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 225

def initialize(version, payload , assistant_id: nil, id: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'description' => payload['description'],
        'id' => payload['id'],
        'account_sid' => payload['account_sid'],
        'knowledge_source_details' => payload['knowledge_source_details'],
        'name' => payload['name'],
        'status' => payload['status'],
        'type' => payload['type'],
        'url' => payload['url'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
    }

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

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Knowledge resource.

Returns:



272
273
274
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 272

def 
    @properties['account_sid']
end

#contextAssistantsKnowledgeContext

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

Returns:



251
252
253
254
255
256
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 251

def context
    unless @instance_context
        @instance_context = AssistantsKnowledgeContext.new(@version , @params['assistant_id'], @params['id'])
    end
    @instance_context
end

#createAssistantsKnowledgeInstance

Create the AssistantsKnowledgeInstance

Returns:



321
322
323
324
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 321

def create

    context.create
end

#date_createdTime

Returns The date and time in GMT when the Knowledge was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



308
309
310
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 308

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



314
315
316
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 314

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the AssistantsKnowledgeInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



329
330
331
332
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 329

def delete

    context.delete
end

#descriptionString

Returns The type of knowledge source.

Returns:

  • (String)

    The type of knowledge source.



260
261
262
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 260

def description
    @properties['description']
end

#idString

Returns The description of knowledge.

Returns:

  • (String)

    The description of knowledge.



266
267
268
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 266

def id
    @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation



343
344
345
346
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 343

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

#knowledge_source_detailsHash

Returns The details of the knowledge source based on the type.

Returns:

  • (Hash)

    The details of the knowledge source based on the type.



278
279
280
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 278

def knowledge_source_details
    @properties['knowledge_source_details']
end

#nameString

Returns The name of the knowledge source.

Returns:

  • (String)

    The name of the knowledge source.



284
285
286
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 284

def name
    @properties['name']
end

#statusString

Returns The status of processing the knowledge source (‘QUEUED’, ‘PROCESSING’, ‘COMPLETED’, ‘FAILED’).

Returns:

  • (String)

    The status of processing the knowledge source (‘QUEUED’, ‘PROCESSING’, ‘COMPLETED’, ‘FAILED’)



290
291
292
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 290

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



336
337
338
339
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 336

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

#typeString

Returns The type of knowledge source (‘Web’, ‘Database’, ‘Text’, ‘File’).

Returns:

  • (String)

    The type of knowledge source (‘Web’, ‘Database’, ‘Text’, ‘File’)



296
297
298
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 296

def type
    @properties['type']
end

#urlString

Returns The url of the knowledge resource.

Returns:

  • (String)

    The url of the knowledge resource.



302
303
304
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb', line 302

def url
    @properties['url']
end