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

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, installed_add_on_sid: nil, sid: nil) ⇒ InstalledAddOnExtensionInstance

Initialize the InstalledAddOnExtensionInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this InstalledAddOnExtension resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb', line 235

def initialize(version, payload , installed_add_on_sid: nil, sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'installed_add_on_sid' => payload['installed_add_on_sid'],
        'friendly_name' => payload['friendly_name'],
        'product_name' => payload['product_name'],
        'unique_name' => payload['unique_name'],
        'enabled' => payload['enabled'],
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = { 'installed_add_on_sid' => installed_add_on_sid  || @properties['installed_add_on_sid']  ,'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#contextInstalledAddOnExtensionContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



258
259
260
261
262
263
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb', line 258

def context
    unless @instance_context
        @instance_context = InstalledAddOnExtensionContext.new(@version , @params['installed_add_on_sid'], @params['sid'])
    end
    @instance_context
end

#enabledBoolean

Returns Whether the Extension will be invoked.

Returns:

  • (Boolean)

    Whether the Extension will be invoked.



297
298
299
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb', line 297

def enabled
    @properties['enabled']
end

#fetchInstalledAddOnExtensionInstance

Fetch the InstalledAddOnExtensionInstance

Returns:



310
311
312
313
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb', line 310

def fetch

    context.fetch
end

#friendly_nameString

Returns The string that you assigned to describe the resource.

Returns:

  • (String)

    The string that you assigned to describe the resource.



279
280
281
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb', line 279

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



337
338
339
340
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb', line 337

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Preview.Marketplace.InstalledAddOnExtensionInstance #{values}>"
end

#installed_add_on_sidString

Returns The SID of the InstalledAddOn resource to which this extension applies.

Returns:

  • (String)

    The SID of the InstalledAddOn resource to which this extension applies.



273
274
275
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb', line 273

def installed_add_on_sid
    @properties['installed_add_on_sid']
end

#product_nameString

Returns The name of the Product this Extension is used within.

Returns:

  • (String)

    The name of the Product this Extension is used within.



285
286
287
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb', line 285

def product_name
    @properties['product_name']
end

#sidString

Returns The unique string that we created to identify the InstalledAddOn Extension resource.

Returns:

  • (String)

    The unique string that we created to identify the InstalledAddOn Extension resource.



267
268
269
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb', line 267

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



330
331
332
333
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb', line 330

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Preview.Marketplace.InstalledAddOnExtensionInstance #{values}>"
end

#unique_nameString

Returns An application-defined string that uniquely identifies the resource.

Returns:

  • (String)

    An application-defined string that uniquely identifies the resource.



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

def unique_name
    @properties['unique_name']
end

#update(enabled: nil) ⇒ InstalledAddOnExtensionInstance

Update the InstalledAddOnExtensionInstance

Parameters:

  • enabled (Boolean) (defaults to: nil)

    Whether the Extension should be invoked.

Returns:



319
320
321
322
323
324
325
326
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb', line 319

def update(
    enabled: nil
)

    context.update(
        enabled: enabled, 
    )
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource.



303
304
305
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb', line 303

def url
    @properties['url']
end