class Twilio::REST::Preview::Understand::AssistantContext::FieldTypeContext

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 help@twilio.com.

Public Class Methods

new(version, assistant_sid, sid) click to toggle source

Initialize the FieldTypeContext @param [Version] version Version that contains the resource @param [String] assistant_sid The assistant_sid @param [String] sid The sid @return [FieldTypeContext] FieldTypeContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb
172 def initialize(version, assistant_sid, sid)
173   super(version)
174 
175   # Path Solution
176   @solution = {assistant_sid: assistant_sid, sid: sid, }
177   @uri = "/Assistants/#{@solution[:assistant_sid]}/FieldTypes/#{@solution[:sid]}"
178 
179   # Dependents
180   @field_values = nil
181 end

Public Instance Methods

delete() click to toggle source

Delete the FieldTypeInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb
220 def delete
221    @version.delete('DELETE', @uri)
222 end
fetch() click to toggle source

Fetch the FieldTypeInstance @return [FieldTypeInstance] Fetched FieldTypeInstance

    # File lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb
186 def fetch
187   payload = @version.fetch('GET', @uri)
188 
189   FieldTypeInstance.new(
190       @version,
191       payload,
192       assistant_sid: @solution[:assistant_sid],
193       sid: @solution[:sid],
194   )
195 end
field_values(sid=:unset) click to toggle source

Access the field_values @return [FieldValueList] @return [FieldValueContext] if sid was passed.

    # File lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb
228 def field_values(sid=:unset)
229   raise ArgumentError, 'sid cannot be nil' if sid.nil?
230 
231   if sid != :unset
232     return FieldValueContext.new(@version, @solution[:assistant_sid], @solution[:sid], sid, )
233   end
234 
235   unless @field_values
236     @field_values = FieldValueList.new(
237         @version,
238         assistant_sid: @solution[:assistant_sid],
239         field_type_sid: @solution[:sid],
240     )
241   end
242 
243   @field_values
244 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb
255 def inspect
256   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
257   "#<Twilio.Preview.Understand.FieldTypeContext #{context}>"
258 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb
248 def to_s
249   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
250   "#<Twilio.Preview.Understand.FieldTypeContext #{context}>"
251 end
update(friendly_name: :unset, unique_name: :unset) click to toggle source

Update the FieldTypeInstance @param [String] friendly_name A user-provided string that identifies this

resource. It is non-unique and can up to 255 characters long.

@param [String] unique_name A user-provided string that uniquely identifies this

resource as an alternative to the sid. Unique up to 64 characters long.

@return [FieldTypeInstance] Updated FieldTypeInstance

    # File lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb
204 def update(friendly_name: :unset, unique_name: :unset)
205   data = Twilio::Values.of({'FriendlyName' => friendly_name, 'UniqueName' => unique_name, })
206 
207   payload = @version.update('POST', @uri, data: data)
208 
209   FieldTypeInstance.new(
210       @version,
211       payload,
212       assistant_sid: @solution[:assistant_sid],
213       sid: @solution[:sid],
214   )
215 end