Class: Twilio::REST::Autopilot::V1::AssistantContext::FieldTypeContext::FieldValueContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.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, field_type_sid, sid) ⇒ FieldValueContext

Initialize the FieldValueContext

Parameters:

  • version (Version)

    Version that contains the resource

  • assistant_sid (String)

    The SID of the Assistant that is the parent of the FieldType associated with the resource to fetch.

  • field_type_sid (String)

    The SID of the Field Type associated with the Field Value to fetch.

  • sid (String)

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


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

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

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

Instance Method Details

#deleteBoolean

Delete the FieldValueInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


230
231
232
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb', line 230

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

#fetchFieldValueInstance

Fetch the FieldValueInstance

Returns:


215
216
217
218
219
220
221
222
223
224
225
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb', line 215

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

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

#inspectObject

Provide a detailed, user friendly representation


243
244
245
246
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb', line 243

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

#to_sObject

Provide a user friendly representation


236
237
238
239
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb', line 236

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