Class: Twilio::REST::FlexApi::V1::PluginConfigurationContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/flex_api/v1/plugin_configuration.rb,
lib/twilio-ruby/rest/flex_api/v1/plugin_configuration/configured_plugin.rb

Defined Under Namespace

Classes: ConfiguredPluginContext, ConfiguredPluginInstance, ConfiguredPluginList, ConfiguredPluginPage

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ PluginConfigurationContext

Initialize the PluginConfigurationContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the Flex Plugin Configuration resource to fetch.



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

def initialize(version, sid)
    super(version)

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

    # Dependents
    @plugins = nil
end

Instance Method Details

#fetch(flex_metadata: :unset) ⇒ PluginConfigurationInstance

Fetch the PluginConfigurationInstance

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_configuration.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)
    PluginConfigurationInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



236
237
238
239
# File 'lib/twilio-ruby/rest/flex_api/v1/plugin_configuration.rb', line 236

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

#plugins(plugin_sid = :unset) ⇒ ConfiguredPluginList, ConfiguredPluginContext

Access the plugins

Returns:

Raises:

  • (ArgumentError)


211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/twilio-ruby/rest/flex_api/v1/plugin_configuration.rb', line 211

def plugins(plugin_sid=:unset)

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

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

    unless @plugins
        @plugins = ConfiguredPluginList.new(
            @version, configuration_sid: @solution[:sid], )
    end

 @plugins
end

#to_sObject

Provide a user friendly representation



229
230
231
232
# File 'lib/twilio-ruby/rest/flex_api/v1/plugin_configuration.rb', line 229

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