Class: Twilio::REST::Assistants::V1::AssistantContext::AssistantsToolContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, assistant_id, id) ⇒ AssistantsToolContext

Initialize the AssistantsToolContext

Parameters:

  • version (Version)

    Version that contains the resource

  • assistant_id (String)

    The assistant ID.

  • id (String)

    The tool ID.



162
163
164
165
166
167
168
169
170
171
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 162

def initialize(version, assistant_id, id)
    super(version)
    

    # Path Solution
    @solution = { assistant_id: assistant_id, id: id,  }
    @uri = "/Assistants/#{@solution[:assistant_id]}/Tools/#{@solution[:id]}"

    
end

Instance Method Details

#createAssistantsToolInstance

Create the AssistantsToolInstance

Returns:



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 175

def create

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.create('POST', @uri, headers: headers)
    AssistantsToolInstance.new(
        @version,
        payload,
        assistant_id: @solution[:assistant_id],
        id: @solution[:id],
    )
end

#create_with_metadataAssistantsToolInstance

Create the AssistantsToolInstanceMetadata

Returns:



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 195

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, headers: headers)
    assistants_tool_instance = AssistantsToolInstance.new(
        @version,
        response.body,
        assistant_id: @solution[:assistant_id],
        id: @solution[:id],
    )
    .new(
        @version,
        assistants_tool_instance,
        response.headers,
        response.status_code
    )
end

#deleteBoolean

Delete the AssistantsToolInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



221
222
223
224
225
226
227
228
229
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 221

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadataBoolean

Delete the AssistantsToolInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 234

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      assistantsTool_instance = AssistantsToolInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      .new(@version, assistantsTool_instance, response.headers, response.status_code)
end

#inspectObject

Provide a detailed, user friendly representation



260
261
262
263
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 260

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

#to_sObject

Provide a user friendly representation



253
254
255
256
# File 'lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb', line 253

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