Class: Twilio::REST::Preview::Marketplace::InstalledAddOnContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb,
lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.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: InstalledAddOnExtensionContext, InstalledAddOnExtensionInstance, InstalledAddOnExtensionList, InstalledAddOnExtensionPage

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ InstalledAddOnContext

Initialize the InstalledAddOnContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The Installed Add-on Sid that uniquely identifies this resource



197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 197

def initialize(version, sid)
  super(version)

  # Path Solution
  @solution = {
      sid: sid,
  }
  @uri = "/InstalledAddOns/#{@solution[:sid]}"

  # Dependents
  @extensions = nil
end

Instance Method Details

#deleteBoolean

Deletes the InstalledAddOnInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



213
214
215
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 213

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

#extensions(sid = :unset) ⇒ InstalledAddOnExtensionList, InstalledAddOnExtensionContext

Access the extensions

Returns:

Raises:

  • (ArgumentError)


266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 266

def extensions(sid=:unset)
  raise ArgumentError, 'sid cannot be nil' if sid.nil?

  if sid != :unset
    return InstalledAddOnExtensionContext.new(
        @version,
        @solution[:sid],
        sid,
    )
  end

  unless @extensions
    @extensions = InstalledAddOnExtensionList.new(
        @version,
        installed_add_on_sid: @solution[:sid],
    )
  end

  @extensions
end

#fetchInstalledAddOnInstance

Fetch a InstalledAddOnInstance

Returns:



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 220

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

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

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

#to_sObject

Provide a user friendly representation



289
290
291
292
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 289

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

#update(configuration: :unset, unique_name: :unset) ⇒ InstalledAddOnInstance

Update the InstalledAddOnInstance

Parameters:

  • configuration (Hash) (defaults to: :unset)

    The JSON object representing the configuration of the Add-on installation.

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

    The human-readable string that uniquely identifies this Add-on installation for an Account.

Returns:



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 243

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

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

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