Class: Twilio::REST::Preview::Understand::ServiceContext::IntentContext::SampleContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Preview::Understand::ServiceContext::IntentContext::SampleContext
- Defined in:
- lib/twilio-ruby/rest/preview/understand/service/intent/sample.rb
Overview
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 [email protected].
Instance Method Summary collapse
-
#delete ⇒ Boolean
Deletes the SampleInstance.
-
#fetch ⇒ SampleInstance
Fetch a SampleInstance.
-
#initialize(version, service_sid, intent_sid, sid) ⇒ SampleContext
constructor
Initialize the SampleContext.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(language: :unset, tagged_text: :unset) ⇒ SampleInstance
Update the SampleInstance.
Constructor Details
#initialize(version, service_sid, intent_sid, sid) ⇒ SampleContext
Initialize the SampleContext
192 193 194 195 196 197 198 |
# File 'lib/twilio-ruby/rest/preview/understand/service/intent/sample.rb', line 192 def initialize(version, service_sid, intent_sid, sid) super(version) # Path Solution @solution = {service_sid: service_sid, intent_sid: intent_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Intents/#{@solution[:intent_sid]}/Samples/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Deletes the SampleInstance
247 248 249 |
# File 'lib/twilio-ruby/rest/preview/understand/service/intent/sample.rb', line 247 def delete @version.delete('delete', @uri) end |
#fetch ⇒ SampleInstance
Fetch a SampleInstance
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/twilio-ruby/rest/preview/understand/service/intent/sample.rb', line 203 def fetch params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) SampleInstance.new( @version, payload, service_sid: @solution[:service_sid], intent_sid: @solution[:intent_sid], sid: @solution[:sid], ) end |
#to_s ⇒ Object
Provide a user friendly representation
253 254 255 256 |
# File 'lib/twilio-ruby/rest/preview/understand/service/intent/sample.rb', line 253 def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Preview.Understand.SampleContext #{context}>" end |
#update(language: :unset, tagged_text: :unset) ⇒ SampleInstance
Update the SampleInstance
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/twilio-ruby/rest/preview/understand/service/intent/sample.rb', line 226 def update(language: :unset, tagged_text: :unset) data = Twilio::Values.of({'Language' => language, 'TaggedText' => tagged_text, }) payload = @version.update( 'POST', @uri, data: data, ) SampleInstance.new( @version, payload, service_sid: @solution[:service_sid], intent_sid: @solution[:intent_sid], sid: @solution[:sid], ) end |