Class: Twilio::REST::Preview::Understand::AssistantContext::QueryContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/understand/assistant/query.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

Constructor Details

#initialize(version, assistant_sid, sid) ⇒ QueryContext

Initialize the QueryContext



222
223
224
225
226
227
228
# File 'lib/twilio-ruby/rest/preview/understand/assistant/query.rb', line 222

def initialize(version, assistant_sid, sid)
  super(version)

  # Path Solution
  @solution = {assistant_sid: assistant_sid, sid: sid, }
  @uri = "/Assistants/#{@solution[:assistant_sid]}/Queries/#{@solution[:sid]}"
end

Instance Method Details

#deleteBoolean

Deletes the QueryInstance



267
268
269
# File 'lib/twilio-ruby/rest/preview/understand/assistant/query.rb', line 267

def delete
  @version.delete('delete', @uri)
end

#fetchQueryInstance

Fetch a QueryInstance



233
234
235
236
237
238
239
240
241
242
243
# File 'lib/twilio-ruby/rest/preview/understand/assistant/query.rb', line 233

def fetch
  params = Twilio::Values.of({})

  payload = @version.fetch(
      'GET',
      @uri,
      params,
  )

  QueryInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], sid: @solution[:sid], )
end

#inspectObject

Provide a detailed, user friendly representation



280
281
282
283
# File 'lib/twilio-ruby/rest/preview/understand/assistant/query.rb', line 280

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Preview.Understand.QueryContext #{context}>"
end

#to_sObject

Provide a user friendly representation



273
274
275
276
# File 'lib/twilio-ruby/rest/preview/understand/assistant/query.rb', line 273

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Preview.Understand.QueryContext #{context}>"
end

#update(sample_sid: :unset, status: :unset) ⇒ QueryInstance

Update the QueryInstance



252
253
254
255
256
257
258
259
260
261
262
# File 'lib/twilio-ruby/rest/preview/understand/assistant/query.rb', line 252

def update(sample_sid: :unset, status: :unset)
  data = Twilio::Values.of({'SampleSid' => sample_sid, 'Status' => status, })

  payload = @version.update(
      'POST',
      @uri,
      data: data,
  )

  QueryInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], sid: @solution[:sid], )
end