Class: Twilio::REST::Preview::Understand::ServiceContext::QueryContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/understand/service/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, service_sid, sid) ⇒ QueryContext

Initialize the QueryContext

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String)

    The service_sid

  • sid (String)

    The sid



209
210
211
212
213
214
215
# File 'lib/twilio-ruby/rest/preview/understand/service/query.rb', line 209

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

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

Instance Method Details

#deleteBoolean

Deletes the QueryInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



252
253
254
# File 'lib/twilio-ruby/rest/preview/understand/service/query.rb', line 252

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

#fetchQueryInstance

Fetch a QueryInstance

Returns:



220
221
222
223
224
225
226
227
228
229
230
# File 'lib/twilio-ruby/rest/preview/understand/service/query.rb', line 220

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

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

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

#to_sObject

Provide a user friendly representation



258
259
260
261
# File 'lib/twilio-ruby/rest/preview/understand/service/query.rb', line 258

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

Parameters:

  • sample_sid (String) (defaults to: :unset)

    The sample_sid

  • status (String) (defaults to: :unset)

    The status

Returns:



237
238
239
240
241
242
243
244
245
246
247
# File 'lib/twilio-ruby/rest/preview/understand/service/query.rb', line 237

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, service_sid: @solution[:service_sid], sid: @solution[:sid], )
end