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 update.



162
163
164
165
166
167
168
169
170
171
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 162

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



175
176
177
178
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 175

def delete

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

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

Access the extensions

Returns:

Raises:

  • (ArgumentError)


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 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:



183
184
185
186
187
188
189
190
191
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 183

def fetch

    payload = @version.fetch('GET', @uri)
    InstalledAddOnInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#to_sObject

Provide a user friendly representation



238
239
240
241
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 238

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 (Object) (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:



198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 198

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