Class: Twilio::REST::Autopilot::V1::AssistantContext::ModelBuildContext

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

Initialize the ModelBuildContext

Parameters:

  • version (Version)

    Version that contains the resource

  • assistant_sid (String)

    The SID of the [Assistant](www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to fetch.

  • sid (String)

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



186
187
188
189
190
191
192
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/model_build.rb', line 186

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

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

Instance Method Details

#deleteBoolean

Deletes the ModelBuildInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



241
242
243
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/model_build.rb', line 241

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

#fetchModelBuildInstance

Fetch a ModelBuildInstance

Returns:



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/model_build.rb', line 197

def fetch
  params = Twilio::Values.of({})

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

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

#inspectObject

Provide a detailed, user friendly representation



254
255
256
257
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/model_build.rb', line 254

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

#to_sObject

Provide a user friendly representation



247
248
249
250
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/model_build.rb', line 247

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

#update(unique_name: :unset) ⇒ ModelBuildInstance

Update the ModelBuildInstance

Parameters:

  • unique_name (String) (defaults to: :unset)

    An application-defined string that uniquely identifies the resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the ‘sid` in the URL path to address the resource.

Returns:



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/model_build.rb', line 221

def update(unique_name: :unset)
  data = Twilio::Values.of({'UniqueName' => unique_name, })

  payload = @version.update(
      'POST',
      @uri,
      data: data,
  )

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