Class: Twilio::REST::Preview::Understand::AssistantContext::FieldTypeContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Preview::Understand::AssistantContext::FieldTypeContext
- Defined in:
- lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb,
lib/twilio-ruby/rest/preview/understand/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].
Defined Under Namespace
Classes: FieldValueContext, FieldValueInstance, FieldValueList, FieldValuePage
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the FieldTypeInstance.
-
#fetch ⇒ FieldTypeInstance
Fetch the FieldTypeInstance.
-
#field_values(sid = :unset) ⇒ FieldValueList, FieldValueContext
Access the field_values.
-
#initialize(version, assistant_sid, sid) ⇒ FieldTypeContext
constructor
Initialize the FieldTypeContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, unique_name: :unset) ⇒ FieldTypeInstance
Update the FieldTypeInstance.
Constructor Details
#initialize(version, assistant_sid, sid) ⇒ FieldTypeContext
Initialize the FieldTypeContext
160 161 162 163 164 165 166 167 168 169 |
# File 'lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb', line 160 def initialize(version, assistant_sid, sid) super(version) # Path Solution @solution = { assistant_sid: assistant_sid, sid: sid, } @uri = "/Assistants/#{@solution[:assistant_sid]}/FieldTypes/#{@solution[:sid]}" # Dependents @field_values = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the FieldTypeInstance
173 174 175 176 |
# File 'lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb', line 173 def delete @version.delete('DELETE', @uri) end |
#fetch ⇒ FieldTypeInstance
Fetch the FieldTypeInstance
181 182 183 184 185 186 187 188 189 190 |
# File 'lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb', line 181 def fetch payload = @version.fetch('GET', @uri) FieldTypeInstance.new( @version, payload, assistant_sid: @solution[:assistant_sid], sid: @solution[:sid], ) end |
#field_values(sid = :unset) ⇒ FieldValueList, FieldValueContext
Access the field_values
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb', line 220 def field_values(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return FieldValueContext.new(@version, @solution[:assistant_sid], @solution[:sid],sid ) end unless @field_values @field_values = FieldValueList.new( @version, assistant_sid: @solution[:assistant_sid], field_type_sid: @solution[:sid], ) end @field_values end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
245 246 247 248 |
# File 'lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb', line 245 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Preview.Understand.FieldTypeContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
238 239 240 241 |
# File 'lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb', line 238 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Preview.Understand.FieldTypeContext #{context}>" end |
#update(friendly_name: :unset, unique_name: :unset) ⇒ FieldTypeInstance
Update the FieldTypeInstance
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb', line 197 def update( friendly_name: :unset, unique_name: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'UniqueName' => unique_name, }) payload = @version.update('POST', @uri, data: data) FieldTypeInstance.new( @version, payload, assistant_sid: @solution[:assistant_sid], sid: @solution[:sid], ) end |