Class: Twilio::REST::Knowledge::V2::KnowledgeBasisInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, kb_id: nil) ⇒ KnowledgeBasisInstance

Initialize the KnowledgeBasisInstance

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

  • sid (String)

    The SID of the Call resource to fetch.



601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge_basis.rb', line 601

def initialize(version, payload , kb_id: nil)
    
    apiV1Version = ApiV1Version.new version.domain, version
    super(apiV1Version)
    
    # Marshaled Properties
    @properties = { 
        'message' => payload['message'],
        'status_url' => payload['status_url'],
        'display_name' => payload['display_name'],
        'description' => payload['description'],
        'id' => payload['id'],
        'status' => payload['status'],
        'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']),
        'updated_at' => Twilio.deserialize_iso8601_datetime(payload['updated_at']),
        'version' => payload['version'] == nil ? payload['version'] : payload['version'].to_i,
    }

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

Instance Method Details

#contextKnowledgeBasisContext

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

Returns:



628
629
630
631
632
633
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge_basis.rb', line 628

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

#created_atTime

Returns The ISO 8601 timestamp when the Knowledge Base was created.

Returns:

  • (Time)

    The ISO 8601 timestamp when the Knowledge Base was created.



673
674
675
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge_basis.rb', line 673

def created_at
    @properties['created_at']
end

#deleteBoolean

Delete the KnowledgeBasisInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



692
693
694
695
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge_basis.rb', line 692

def delete

    context.delete
end

#descriptionString

Returns A human readable description of this resource, up to 128 characters.

Returns:

  • (String)

    A human readable description of this resource, up to 128 characters.



655
656
657
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge_basis.rb', line 655

def description
    @properties['description']
end

#display_nameString

Returns Provides a unique and addressable name to be assigned to this Knowledge Base. This name is assigned by the developer and can be used in addition to the ID. It is intended to be human-readable and unique within the account.

Returns:

  • (String)

    Provides a unique and addressable name to be assigned to this Knowledge Base. This name is assigned by the developer and can be used in addition to the ID. It is intended to be human-readable and unique within the account.



649
650
651
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge_basis.rb', line 649

def display_name
    @properties['display_name']
end

#fetchKnowledgeBasisInstance

Fetch the KnowledgeBasisInstance

Returns:



700
701
702
703
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge_basis.rb', line 700

def fetch

    context.fetch
end

#idString

Returns The unique identifier for the Knowledge Base.

Returns:

  • (String)

    The unique identifier for the Knowledge Base



661
662
663
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge_basis.rb', line 661

def id
    @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation



730
731
732
733
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge_basis.rb', line 730

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

#messageString

Returns:

  • (String)


637
638
639
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge_basis.rb', line 637

def message
    @properties['message']
end

#statusString

Returns The provisioning status of the Knowledge Base.

Returns:

  • (String)

    The provisioning status of the Knowledge Base



667
668
669
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge_basis.rb', line 667

def status
    @properties['status']
end

#status_urlString

Returns URI to check operation status.

Returns:

  • (String)

    URI to check operation status.



643
644
645
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge_basis.rb', line 643

def status_url
    @properties['status_url']
end

#to_sObject

Provide a user friendly representation



723
724
725
726
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge_basis.rb', line 723

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

#update(if_match: :unset, update_knowledge_base_request: nil) ⇒ KnowledgeBasisInstance

Update the KnowledgeBasisInstance

Parameters:

  • if_match (String) (defaults to: :unset)

    Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource’s current Entity Tag (ETag) matches the one provided, preventing accidental overwrites.

  • update_knowledge_base_request (UpdateKnowledgeBaseRequest) (defaults to: nil)

Returns:



710
711
712
713
714
715
716
717
718
719
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge_basis.rb', line 710

def update(
  if_match: :unset,
  update_knowledge_base_request: nil
)

    context.update(
        if_match: if_match, 
        update_knowledge_base_request: update_knowledge_base_request, 
    )
end

#updated_atTime

Returns The ISO 8601 timestamp when the Knowledge Base was last updated.

Returns:

  • (Time)

    The ISO 8601 timestamp when the Knowledge Base was last updated.



679
680
681
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge_basis.rb', line 679

def updated_at
    @properties['updated_at']
end

#versionString

Returns The current version number of the Knowledge Base. Incremented on each successful mutable update.

Returns:

  • (String)

    The current version number of the Knowledge Base. Incremented on each successful mutable update.



685
686
687
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge_basis.rb', line 685

def version
    @properties['version']
end