Class: Twilio::REST::Serverless::V1::ServiceContext::EnvironmentContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Serverless::V1::ServiceContext::EnvironmentContext
- Defined in:
- lib/twilio-ruby/rest/serverless/v1/service/environment.rb,
lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb,
lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb,
lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb
Defined Under Namespace
Classes: DeploymentContext, DeploymentInstance, DeploymentInstanceMetadata, DeploymentList, DeploymentListResponse, DeploymentPage, DeploymentPageMetadata, LogContext, LogInstance, LogInstanceMetadata, LogList, LogListResponse, LogPage, LogPageMetadata, VariableContext, VariableInstance, VariableInstanceMetadata, VariableList, VariableListResponse, VariablePage, VariablePageMetadata
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the EnvironmentInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the EnvironmentInstanceMetadata.
-
#deployments(sid = :unset) ⇒ DeploymentList, DeploymentContext
Access the deployments.
-
#fetch ⇒ EnvironmentInstance
Fetch the EnvironmentInstance.
-
#fetch_with_metadata ⇒ EnvironmentInstance
Fetch the EnvironmentInstanceMetadata.
-
#initialize(version, service_sid, sid) ⇒ EnvironmentContext
constructor
Initialize the EnvironmentContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#logs(sid = :unset) ⇒ LogList, LogContext
Access the logs.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#variables(sid = :unset) ⇒ VariableList, VariableContext
Access the variables.
Constructor Details
#initialize(version, service_sid, sid) ⇒ EnvironmentContext
Initialize the EnvironmentContext
226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 226 def initialize(version, service_sid, sid) super(version) # Path Solution @solution = { service_sid: service_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Environments/#{@solution[:sid]}" # Dependents @logs = nil @variables = nil @deployments = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the EnvironmentInstance
242 243 244 245 246 247 248 249 250 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 242 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the EnvironmentInstanceMetadata
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 255 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) environment_instance = EnvironmentInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) EnvironmentInstanceMetadata.new(@version, environment_instance, response.headers, response.status_code) end |
#deployments(sid = :unset) ⇒ DeploymentList, DeploymentContext
Access the deployments
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 359 def deployments(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return DeploymentContext.new(@version, @solution[:service_sid], @solution[:sid],sid ) end unless @deployments @deployments = DeploymentList.new( @version, service_sid: @solution[:service_sid], environment_sid: @solution[:sid], ) end @deployments end |
#fetch ⇒ EnvironmentInstance
Fetch the EnvironmentInstance
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 274 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) EnvironmentInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ EnvironmentInstance
Fetch the EnvironmentInstanceMetadata
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 294 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) environment_instance = EnvironmentInstance.new( @version, response.body, service_sid: @solution[:service_sid], sid: @solution[:sid], ) EnvironmentInstanceMetadata.new( @version, environment_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
384 385 386 387 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 384 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Serverless.V1.EnvironmentContext #{context}>" end |
#logs(sid = :unset) ⇒ LogList, LogContext
Access the logs
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 321 def logs(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return LogContext.new(@version, @solution[:service_sid], @solution[:sid],sid ) end unless @logs @logs = LogList.new( @version, service_sid: @solution[:service_sid], environment_sid: @solution[:sid], ) end @logs end |
#to_s ⇒ Object
Provide a user friendly representation
377 378 379 380 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 377 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Serverless.V1.EnvironmentContext #{context}>" end |
#variables(sid = :unset) ⇒ VariableList, VariableContext
Access the variables
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 340 def variables(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return VariableContext.new(@version, @solution[:service_sid], @solution[:sid],sid ) end unless @variables @variables = VariableList.new( @version, service_sid: @solution[:service_sid], environment_sid: @solution[:sid], ) end @variables end |