class Twilio::REST::Autopilot::V1::AssistantContext::TaskContext::SampleContext

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.

Public Class Methods

new(version, assistant_sid, task_sid, sid) click to toggle source

Initialize the SampleContext @param [Version] version Version that contains the resource @param [String] assistant_sid The SID of the

{Assistant}[https://www.twilio.com/docs/autopilot/api/assistant] that is the
parent of the Task associated with the resource to fetch.

@param [String] task_sid The SID of the

{Task}[https://www.twilio.com/docs/autopilot/api/task] associated with the
Sample resource to create.

@param [String] sid The Twilio-provided string that uniquely identifies the

Sample resource to fetch.

@return [SampleContext] SampleContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb
214 def initialize(version, assistant_sid, task_sid, sid)
215   super(version)
216 
217   # Path Solution
218   @solution = {assistant_sid: assistant_sid, task_sid: task_sid, sid: sid, }
219   @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Samples/#{@solution[:sid]}"
220 end

Public Instance Methods

delete() click to toggle source

Delete the SampleInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb
270 def delete
271    @version.delete('DELETE', @uri)
272 end
fetch() click to toggle source

Fetch the SampleInstance @return [SampleInstance] Fetched SampleInstance

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb
225 def fetch
226   payload = @version.fetch('GET', @uri)
227 
228   SampleInstance.new(
229       @version,
230       payload,
231       assistant_sid: @solution[:assistant_sid],
232       task_sid: @solution[:task_sid],
233       sid: @solution[:sid],
234   )
235 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb
283 def inspect
284   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
285   "#<Twilio.Autopilot.V1.SampleContext #{context}>"
286 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb
276 def to_s
277   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
278   "#<Twilio.Autopilot.V1.SampleContext #{context}>"
279 end
update(language: :unset, tagged_text: :unset, source_channel: :unset) click to toggle source

Update the SampleInstance @param [String] language The {ISO

language-country}[https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html]
string that specifies the language used for the sample. For example: `en-US`.

@param [String] tagged_text The text example of how end users might express the

task. The sample can contain {Field tag
blocks}[https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging].

@param [String] source_channel The communication channel from which the sample

was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`,
`slack`, or null if not included.

@return [SampleInstance] Updated SampleInstance

    # File lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb
249 def update(language: :unset, tagged_text: :unset, source_channel: :unset)
250   data = Twilio::Values.of({
251       'Language' => language,
252       'TaggedText' => tagged_text,
253       'SourceChannel' => source_channel,
254   })
255 
256   payload = @version.update('POST', @uri, data: data)
257 
258   SampleInstance.new(
259       @version,
260       payload,
261       assistant_sid: @solution[:assistant_sid],
262       task_sid: @solution[:task_sid],
263       sid: @solution[:sid],
264   )
265 end