Class: Twilio::REST::Knowledge::V2::KnowledgeInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Knowledge::V2::KnowledgeInstance
- Defined in:
- lib/twilio-ruby/rest/knowledge/v2/knowledge.rb
Instance Method Summary collapse
-
#code ⇒ String
The Twilio error code.
-
#context ⇒ KnowledgeContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#created_at ⇒ Time
The date and time in GMT when the Knowledge was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
-
#delete ⇒ Boolean
Delete the KnowledgeInstance.
-
#description ⇒ String
A detailed description of the knowledge source and when to use it.
-
#fetch ⇒ KnowledgeInstance
Fetch the KnowledgeInstance.
-
#id ⇒ String
The unique identifier of knowledge source.
-
#initialize(version, payload, kb_id: nil, knowledge_id: nil) ⇒ KnowledgeInstance
constructor
Initialize the KnowledgeInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#message ⇒ String
A human readable message describing the error.
-
#more_info ⇒ String
A URL to a [Twilio error directory](www.twilio.com/docs/api/errors) page with more information about the error code.
-
#name ⇒ String
The name of the knowledge source.
- #source ⇒ KnowledgeSourceTypes
-
#status ⇒ String
The status of processing the knowledge source (‘SCHEDULED’, ‘QUEUED’, ‘PROCESSING’, ‘COMPLETED’, ‘FAILED’).
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(refresh: :unset, knowledge_core: :unset) ⇒ KnowledgeInstance
Update the KnowledgeInstance.
-
#updated_at ⇒ Time
The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
Constructor Details
#initialize(version, payload, kb_id: nil, knowledge_id: nil) ⇒ KnowledgeInstance
Initialize the KnowledgeInstance
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 |
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge.rb', line 569 def initialize(version, payload , kb_id: nil, knowledge_id: nil) apiV1Version = ApiV1Version.new version.domain, version super(apiV1Version) # Marshaled Properties @properties = { 'name' => payload['name'], 'description' => payload['description'], 'source' => payload['source'], 'id' => payload['id'], 'status' => payload['status'], 'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']), 'updated_at' => Twilio.deserialize_iso8601_datetime(payload['updated_at']), 'code' => payload['code'], 'message' => payload['message'], 'more_info' => payload['more_info'], } # Context @instance_context = nil @params = { 'kb_id' => kb_id || @properties['kb_id'] ,'knowledge_id' => knowledge_id || @properties['knowledge_id'] , } end |
Instance Method Details
#code ⇒ String
Returns The Twilio error code.
648 649 650 |
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge.rb', line 648 def code @properties['code'] end |
#context ⇒ KnowledgeContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
597 598 599 600 601 602 |
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge.rb', line 597 def context unless @instance_context @instance_context = KnowledgeContext.new(@version , @params['kb_id'], @params['knowledge_id']) end @instance_context end |
#created_at ⇒ Time
Returns The date and time in GMT when the Knowledge was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
636 637 638 |
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge.rb', line 636 def created_at @properties['created_at'] end |
#delete ⇒ Boolean
Delete the KnowledgeInstance
667 668 669 670 |
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge.rb', line 667 def delete context.delete end |
#description ⇒ String
Returns A detailed description of the knowledge source and when to use it. This helps provide context about the content and its intended purpose.
612 613 614 |
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge.rb', line 612 def description @properties['description'] end |
#fetch ⇒ KnowledgeInstance
Fetch the KnowledgeInstance
675 676 677 678 |
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge.rb', line 675 def fetch context.fetch end |
#id ⇒ String
Returns The unique identifier of knowledge source.
624 625 626 |
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge.rb', line 624 def id @properties['id'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
705 706 707 708 |
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge.rb', line 705 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Knowledge.V2.KnowledgeInstance #{values}>" end |
#message ⇒ String
Returns A human readable message describing the error.
654 655 656 |
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge.rb', line 654 def @properties['message'] end |
#more_info ⇒ String
Returns A URL to a [Twilio error directory](www.twilio.com/docs/api/errors) page with more information about the error code.
660 661 662 |
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge.rb', line 660 def more_info @properties['more_info'] end |
#name ⇒ String
Returns The name of the knowledge source.
606 607 608 |
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge.rb', line 606 def name @properties['name'] end |
#source ⇒ KnowledgeSourceTypes
618 619 620 |
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge.rb', line 618 def source @properties['source'] end |
#status ⇒ String
Returns The status of processing the knowledge source (‘SCHEDULED’, ‘QUEUED’, ‘PROCESSING’, ‘COMPLETED’, ‘FAILED’).
630 631 632 |
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge.rb', line 630 def status @properties['status'] end |
#to_s ⇒ Object
Provide a user friendly representation
698 699 700 701 |
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge.rb', line 698 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Knowledge.V2.KnowledgeInstance #{values}>" end |
#update(refresh: :unset, knowledge_core: :unset) ⇒ KnowledgeInstance
Update the KnowledgeInstance
685 686 687 688 689 690 691 692 693 694 |
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge.rb', line 685 def update( refresh: :unset, knowledge_core: :unset ) context.update( refresh: refresh, knowledge_core: knowledge_core, ) end |
#updated_at ⇒ Time
Returns The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
642 643 644 |
# File 'lib/twilio-ruby/rest/knowledge/v2/knowledge.rb', line 642 def updated_at @properties['updated_at'] end |