class Twilio::REST::Autopilot::V1::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
Initialize the FieldTypeContext
@param [Version] version Version
that contains the resource @param [String] assistant_sid The SID of the
{Assistant}[https://www.twilio.com/docs/autopilot/api/assistant] that is the parent of the resource to fetch.
@param [String] sid The Twilio-provided string that uniquely identifies the
FieldType resource to fetch.
@return [FieldTypeContext] FieldTypeContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb 178 def initialize(version, assistant_sid, sid) 179 super(version) 180 181 # Path Solution 182 @solution = {assistant_sid: assistant_sid, sid: sid, } 183 @uri = "/Assistants/#{@solution[:assistant_sid]}/FieldTypes/#{@solution[:sid]}" 184 185 # Dependents 186 @field_values = nil 187 end
Public Instance Methods
Delete the FieldTypeInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb 227 def delete 228 @version.delete('DELETE', @uri) 229 end
Fetch the FieldTypeInstance
@return [FieldTypeInstance] Fetched FieldTypeInstance
# File lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb 192 def fetch 193 payload = @version.fetch('GET', @uri) 194 195 FieldTypeInstance.new( 196 @version, 197 payload, 198 assistant_sid: @solution[:assistant_sid], 199 sid: @solution[:sid], 200 ) 201 end
Access the field_values
@return [FieldValueList] @return [FieldValueContext] if sid was passed.
# File lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb 235 def field_values(sid=:unset) 236 raise ArgumentError, 'sid cannot be nil' if sid.nil? 237 238 if sid != :unset 239 return FieldValueContext.new(@version, @solution[:assistant_sid], @solution[:sid], sid, ) 240 end 241 242 unless @field_values 243 @field_values = FieldValueList.new( 244 @version, 245 assistant_sid: @solution[:assistant_sid], 246 field_type_sid: @solution[:sid], 247 ) 248 end 249 250 @field_values 251 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb 262 def inspect 263 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 264 "#<Twilio.Autopilot.V1.FieldTypeContext #{context}>" 265 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb 255 def to_s 256 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 257 "#<Twilio.Autopilot.V1.FieldTypeContext #{context}>" 258 end
Update the FieldTypeInstance
@param [String] friendly_name A descriptive string that you create to describe
the resource. It is not unique and can be up to 255 characters long.
@param [String] unique_name An application-defined string that uniquely
identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique.
@return [FieldTypeInstance] Updated FieldTypeInstance
# File lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb 211 def update(friendly_name: :unset, unique_name: :unset) 212 data = Twilio::Values.of({'FriendlyName' => friendly_name, 'UniqueName' => unique_name, }) 213 214 payload = @version.update('POST', @uri, data: data) 215 216 FieldTypeInstance.new( 217 @version, 218 payload, 219 assistant_sid: @solution[:assistant_sid], 220 sid: @solution[:sid], 221 ) 222 end