Class: Twilio::REST::Preview::Marketplace::InstalledAddOnContext::InstalledAddOnExtensionContext

Inherits:
InstanceContext
  • 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, installed_add_on_sid, sid) ⇒ InstalledAddOnExtensionContext

Initialize the InstalledAddOnExtensionContext

Parameters:

  • version (Version)

    Version that contains the resource

  • installed_add_on_sid (String)

    The SID of the InstalledAddOn resource with the extension to update.

  • sid (String)

    The SID of the InstalledAddOn Extension resource to update.



139
140
141
142
143
144
145
146
147
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb', line 139

def initialize(version, installed_add_on_sid, sid)
    super(version)

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

    
end

Instance Method Details

#fetchInstalledAddOnExtensionInstance

Fetch the InstalledAddOnExtensionInstance

Returns:



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb', line 151

def fetch

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

#inspectObject

Provide a detailed, user friendly representation



205
206
207
208
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb', line 205

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

#to_sObject

Provide a user friendly representation



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

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

#update(enabled: nil) ⇒ InstalledAddOnExtensionInstance

Update the InstalledAddOnExtensionInstance

Parameters:

  • enabled (Boolean) (defaults to: nil)

    Whether the Extension should be invoked.

Returns:



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb', line 172

def update(
    enabled: nil
)

    data = Twilio::Values.of({
        'Enabled' => enabled,
    })

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