Class: Twilio::REST::Preview::Understand::ServiceContext::IntentContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Preview::Understand::ServiceContext::IntentContext
- Defined in:
- lib/twilio-ruby/rest/preview/understand/service/intent.rb,
lib/twilio-ruby/rest/preview/understand/service/intent/field.rb,
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].
Defined Under Namespace
Classes: FieldContext, FieldInstance, FieldList, FieldPage, SampleContext, SampleInstance, SampleList, SamplePage
Instance Method Summary collapse
-
#delete ⇒ Boolean
Deletes the IntentInstance.
-
#fetch ⇒ IntentInstance
Fetch a IntentInstance.
-
#fields(sid = :unset) ⇒ FieldList, FieldContext
Access the fields.
-
#initialize(version, service_sid, sid) ⇒ IntentContext
constructor
Initialize the IntentContext.
-
#samples(sid = :unset) ⇒ SampleList, SampleContext
Access the samples.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, unique_name: :unset) ⇒ IntentInstance
Update the IntentInstance.
Constructor Details
#initialize(version, service_sid, sid) ⇒ IntentContext
Initialize the IntentContext
175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/twilio-ruby/rest/preview/understand/service/intent.rb', line 175 def initialize(version, service_sid, sid) super(version) # Path Solution @solution = {service_sid: service_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Intents/#{@solution[:sid]}" # Dependents @fields = nil @samples = nil end |
Instance Method Details
#delete ⇒ Boolean
Deletes the IntentInstance
222 223 224 |
# File 'lib/twilio-ruby/rest/preview/understand/service/intent.rb', line 222 def delete @version.delete('delete', @uri) end |
#fetch ⇒ IntentInstance
Fetch a IntentInstance
190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/twilio-ruby/rest/preview/understand/service/intent.rb', line 190 def fetch params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) IntentInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#fields(sid = :unset) ⇒ FieldList, FieldContext
Access the fields
230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/twilio-ruby/rest/preview/understand/service/intent.rb', line 230 def fields(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return FieldContext.new(@version, @solution[:service_sid], @solution[:sid], sid, ) end unless @fields @fields = FieldList.new(@version, service_sid: @solution[:service_sid], intent_sid: @solution[:sid], ) end @fields end |
#samples(sid = :unset) ⇒ SampleList, SampleContext
Access the samples
248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/twilio-ruby/rest/preview/understand/service/intent.rb', line 248 def samples(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return SampleContext.new(@version, @solution[:service_sid], @solution[:sid], sid, ) end unless @samples @samples = SampleList.new(@version, service_sid: @solution[:service_sid], intent_sid: @solution[:sid], ) end @samples end |
#to_s ⇒ Object
Provide a user friendly representation
264 265 266 267 |
# File 'lib/twilio-ruby/rest/preview/understand/service/intent.rb', line 264 def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Preview.Understand.IntentContext #{context}>" end |
#update(friendly_name: :unset, unique_name: :unset) ⇒ IntentInstance
Update the IntentInstance
207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/twilio-ruby/rest/preview/understand/service/intent.rb', line 207 def update(friendly_name: :unset, unique_name: :unset) data = Twilio::Values.of({'FriendlyName' => friendly_name, 'UniqueName' => unique_name, }) payload = @version.update( 'POST', @uri, data: data, ) IntentInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |