Class: Twilio::REST::FlexApi::V1::PluginContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/flex_api/v1/plugin.rb,
lib/twilio-ruby/rest/flex_api/v1/plugin/plugin_versions.rb

Defined Under Namespace

Classes: PluginVersionsContext, PluginVersionsInstance, PluginVersionsList, PluginVersionsPage

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ PluginContext

Initialize the PluginContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the Flex Plugin resource to update.



175
176
177
178
179
180
181
182
183
184
# File 'lib/twilio-ruby/rest/flex_api/v1/plugin.rb', line 175

def initialize(version, sid)
    super(version)

    # Path Solution
    @solution = { sid: sid,  }
    @uri = "/PluginService/Plugins/#{@solution[:sid]}"

    # Dependents
    @plugin_versions = nil
end

Instance Method Details

#fetch(flex_metadata: :unset) ⇒ PluginInstance

Fetch the PluginInstance

Parameters:

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

    The Flex-Metadata HTTP request header

Returns:



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/twilio-ruby/rest/flex_api/v1/plugin.rb', line 189

def fetch(
    flex_metadata: :unset
)

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

#inspectObject

Provide a detailed, user friendly representation



267
268
269
270
# File 'lib/twilio-ruby/rest/flex_api/v1/plugin.rb', line 267

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

#plugin_versions(sid = :unset) ⇒ PluginVersionsList, PluginVersionsContext

Access the plugin_versions

Returns:

Raises:

  • (ArgumentError)


242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/twilio-ruby/rest/flex_api/v1/plugin.rb', line 242

def plugin_versions(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return PluginVersionsContext.new(@version, @solution[:sid],sid )
    end

    unless @plugin_versions
        @plugin_versions = PluginVersionsList.new(
            @version, plugin_sid: @solution[:sid], )
    end

 @plugin_versions
end

#to_sObject

Provide a user friendly representation



260
261
262
263
# File 'lib/twilio-ruby/rest/flex_api/v1/plugin.rb', line 260

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

#update(friendly_name: :unset, description: :unset, flex_metadata: :unset) ⇒ PluginInstance

Update the PluginInstance

Parameters:

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

    The Flex Plugin’s friendly name.

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

    A descriptive string that you update to describe the plugin resource. It can be up to 500 characters long

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

    The Flex-Metadata HTTP request header

Returns:



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/twilio-ruby/rest/flex_api/v1/plugin.rb', line 213

def update(
    friendly_name: :unset, 
    description: :unset, 
    flex_metadata: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'Description' => description,
    })

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