Class: Twilio::REST::Autopilot::V1::AssistantContext::TaskContext::FieldContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/autopilot/v1/assistant/task/field.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, task_sid, sid) ⇒ FieldContext

Initialize the FieldContext

Parameters:

  • version (Version)

    Version that contains the resource

  • assistant_sid (String)

    The SID of the [Assistant](www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource to fetch.

  • task_sid (String)

    The SID of the [Task](www.twilio.com/docs/autopilot/api/task) resource associated with the Field resource to fetch.

  • sid (String)

    The Twilio-provided string that uniquely identifies the Field resource to fetch.



204
205
206
207
208
209
210
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/field.rb', line 204

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

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

Instance Method Details

#deleteBoolean

Deletes the FieldInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



236
237
238
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/field.rb', line 236

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

#fetchFieldInstance

Fetch a FieldInstance

Returns:



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/field.rb', line 215

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

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

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

#inspectObject

Provide a detailed, user friendly representation



249
250
251
252
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/field.rb', line 249

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

#to_sObject

Provide a user friendly representation



242
243
244
245
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/task/field.rb', line 242

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