class Twilio::REST::Preview::Understand::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
Initialize the SampleContext
@param [Version] version Version
that contains the resource @param [String] assistant_sid The unique ID of the Assistant. @param [String] task_sid The unique ID of the Task associated with this Sample. @param [String] sid A 34 character string that uniquely identifies this
resource.
@return [SampleContext] SampleContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb 196 def initialize(version, assistant_sid, task_sid, sid) 197 super(version) 198 199 # Path Solution 200 @solution = {assistant_sid: assistant_sid, task_sid: task_sid, sid: sid, } 201 @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Samples/#{@solution[:sid]}" 202 end
Public Instance Methods
Delete the SampleInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb 249 def delete 250 @version.delete('DELETE', @uri) 251 end
Fetch the SampleInstance
@return [SampleInstance] Fetched SampleInstance
# File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb 207 def fetch 208 payload = @version.fetch('GET', @uri) 209 210 SampleInstance.new( 211 @version, 212 payload, 213 assistant_sid: @solution[:assistant_sid], 214 task_sid: @solution[:task_sid], 215 sid: @solution[:sid], 216 ) 217 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb 262 def inspect 263 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 264 "#<Twilio.Preview.Understand.SampleContext #{context}>" 265 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb 255 def to_s 256 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 257 "#<Twilio.Preview.Understand.SampleContext #{context}>" 258 end
Update the SampleInstance
@param [String] language An ISO language-country string of the sample. @param [String] tagged_text The text example of how end-users may express this
task. The sample may contain Field tag blocks.
@param [String] source_channel The communication channel the sample was
captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or *slack*. If not included the value will be null
@return [SampleInstance] Updated SampleInstance
# File lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb 228 def update(language: :unset, tagged_text: :unset, source_channel: :unset) 229 data = Twilio::Values.of({ 230 'Language' => language, 231 'TaggedText' => tagged_text, 232 'SourceChannel' => source_channel, 233 }) 234 235 payload = @version.update('POST', @uri, data: data) 236 237 SampleInstance.new( 238 @version, 239 payload, 240 assistant_sid: @solution[:assistant_sid], 241 task_sid: @solution[:task_sid], 242 sid: @solution[:sid], 243 ) 244 end