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 SID of the InstalledAddOn resource to fetch.


177
178
179
180
181
182
183
184
185
186
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 177

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:

  • (Boolean)

    true if delete succeeds, false otherwise


191
192
193
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 191

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

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

Access the extensions

Returns:

Raises:

  • (ArgumentError)

227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 227

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:


198
199
200
201
202
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 198

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

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

#inspectObject

Provide a detailed, user friendly representation


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

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

#to_sObject

Provide a user friendly representation


243
244
245
246
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 243

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)

    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

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

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

Returns:


212
213
214
215
216
217
218
219
220
221
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 212

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