Class: Twilio::REST::FlexApi::V1::PluginContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::FlexApi::V1::PluginContext
- 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
-
#fetch(flex_metadata: :unset) ⇒ PluginInstance
Fetch the PluginInstance.
-
#initialize(version, sid) ⇒ PluginContext
constructor
Initialize the PluginContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#plugin_versions(sid = :unset) ⇒ PluginVersionsList, PluginVersionsContext
Access the plugin_versions.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, description: :unset, flex_metadata: :unset) ⇒ PluginInstance
Update the PluginInstance.
Constructor Details
#initialize(version, sid) ⇒ PluginContext
Initialize the PluginContext
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
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 |
#inspect ⇒ Object
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
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_s ⇒ Object
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
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 |