class Twilio::REST::Serverless::V1::ServiceContext::EnvironmentContext::VariableContext
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Public Class Methods
Initialize the VariableContext
@param [Version] version Version
that contains the resource @param [String] service_sid The SID of the Service to fetch the Variable
resource from.
@param [String] environment_sid The SID of the Environment with the Variable
resource to fetch.
@param [String] sid The SID of the Variable resource to fetch. @return [VariableContext] VariableContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb 189 def initialize(version, service_sid, environment_sid, sid) 190 super(version) 191 192 # Path Solution 193 @solution = {service_sid: service_sid, environment_sid: environment_sid, sid: sid, } 194 @uri = "/Services/#{@solution[:service_sid]}/Environments/#{@solution[:environment_sid]}/Variables/#{@solution[:sid]}" 195 end
Public Instance Methods
Delete the VariableInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb 236 def delete 237 @version.delete('DELETE', @uri) 238 end
Fetch the VariableInstance
@return [VariableInstance] Fetched VariableInstance
# File lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb 200 def fetch 201 payload = @version.fetch('GET', @uri) 202 203 VariableInstance.new( 204 @version, 205 payload, 206 service_sid: @solution[:service_sid], 207 environment_sid: @solution[:environment_sid], 208 sid: @solution[:sid], 209 ) 210 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb 249 def inspect 250 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 251 "#<Twilio.Serverless.V1.VariableContext #{context}>" 252 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb 242 def to_s 243 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 244 "#<Twilio.Serverless.V1.VariableContext #{context}>" 245 end
Update the VariableInstance
@param [String] key A string by which the Variable resource can be referenced.
It can be a maximum of 128 characters.
@param [String] value A string that contains the actual value of the Variable.
It can be a maximum of 450 bytes in size.
@return [VariableInstance] Updated VariableInstance
# File lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb 219 def update(key: :unset, value: :unset) 220 data = Twilio::Values.of({'Key' => key, 'Value' => value, }) 221 222 payload = @version.update('POST', @uri, data: data) 223 224 VariableInstance.new( 225 @version, 226 payload, 227 service_sid: @solution[:service_sid], 228 environment_sid: @solution[:environment_sid], 229 sid: @solution[:sid], 230 ) 231 end