Class: Twilio::REST::Assistants::V1::Knowledge::KnowledgeStatusInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, id: nil) ⇒ KnowledgeStatusInstance

Initialize the KnowledgeStatusInstance

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

  • sid (String)

    The SID of the Call resource to fetch.



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge/knowledge_status.rb', line 133

def initialize(version, payload , id: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'status' => payload['status'],
        'last_status' => payload['last_status'],
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
    }

    # Context
    @instance_context = nil
    @params = { '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:



162
163
164
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge/knowledge_status.rb', line 162

def 
    @properties['account_sid']
end

#contextKnowledgeStatusContext

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

Returns:



153
154
155
156
157
158
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge/knowledge_status.rb', line 153

def context
    unless @instance_context
        @instance_context = KnowledgeStatusContext.new(@version , @params['id'])
    end
    @instance_context
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:



180
181
182
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge/knowledge_status.rb', line 180

def date_updated
    @properties['date_updated']
end

#fetchKnowledgeStatusInstance

Fetch the KnowledgeStatusInstance

Returns:



187
188
189
190
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge/knowledge_status.rb', line 187

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



201
202
203
204
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge/knowledge_status.rb', line 201

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

#last_statusString

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

Returns:

  • (String)

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



174
175
176
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge/knowledge_status.rb', line 174

def last_status
    @properties['last_status']
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’)



168
169
170
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge/knowledge_status.rb', line 168

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



194
195
196
197
# File 'lib/twilio-ruby/rest/assistants/v1/knowledge/knowledge_status.rb', line 194

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