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

Defined Under Namespace

Classes: InstalledAddOnExtensionContext, InstalledAddOnExtensionInstance, InstalledAddOnExtensionInstanceMetadata, InstalledAddOnExtensionList, InstalledAddOnExtensionListResponse, InstalledAddOnExtensionPage, InstalledAddOnExtensionPageMetadata

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ InstalledAddOnContext

Initialize the InstalledAddOnContext

Parameters:

  • Version that contains the resource

  • The SID of the InstalledAddOn resource to update.



233
234
235
236
237
238
239
240
241
242
243
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 233

def initialize(version, sid)
    super(version)
    

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

    # Dependents
    @extensions = nil
end

Instance Method Details

#deleteBoolean

Delete the InstalledAddOnInstance

Returns:

  • True if delete succeeds, false otherwise



247
248
249
250
251
252
253
254
255
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 247

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 InstalledAddOnInstanceMetadata

Returns:

  • True if delete succeeds, false otherwise



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 260

def 

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

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

Access the extensions

Raises:

Returns:

  • if sid was passed.



388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 388

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 the InstalledAddOnInstance

Returns:

  • Fetched InstalledAddOnInstance



279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 279

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    InstalledAddOnInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#fetch_with_metadataInstalledAddOnInstance

Fetch the InstalledAddOnInstanceMetadata

Returns:

  • Fetched InstalledAddOnInstance



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 298

def 

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

#inspectObject

Provide a detailed, user friendly representation



413
414
415
416
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 413

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

#to_sObject

Provide a user friendly representation



406
407
408
409
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 406

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:

  • (defaults to: :unset)

    Valid JSON object that conform to the configuration schema exposed by the associated AvailableAddOn resource. This is only required by Add-ons that need to be configured

  • (defaults to: :unset)

    An application-defined string that uniquely identifies the resource. This value must be unique within the Account.

Returns:

  • Updated InstalledAddOnInstance



325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 325

def update(
    configuration: :unset, 
    unique_name: :unset
)

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

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

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

Update the InstalledAddOnInstanceMetadata

Parameters:

  • (defaults to: :unset)

    Valid JSON object that conform to the configuration schema exposed by the associated AvailableAddOn resource. This is only required by Add-ons that need to be configured

  • (defaults to: :unset)

    An application-defined string that uniquely identifies the resource. This value must be unique within the Account.

Returns:

  • Updated InstalledAddOnInstance



354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 354

def (
  configuration: :unset, 
  unique_name: :unset
)

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

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    installed_add_on_instance = InstalledAddOnInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    InstalledAddOnInstanceMetadata.new(
        @version,
        installed_add_on_instance,
        response.headers,
        response.status_code
    )
end