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



170
171
172
173
174
175
176
177
178
179
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 170

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



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

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

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

Access the extensions

Returns:

Raises:

  • (ArgumentError)


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

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:



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

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

#inspectObject

Provide a detailed, user friendly representation



269
270
271
272
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 269

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

#to_sObject

Provide a user friendly representation



262
263
264
265
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 262

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:



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb', line 216

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