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
Overview
PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].
Defined Under Namespace
Classes: DeploymentContext, DeploymentInstance, DeploymentList, DeploymentPage, LogContext, LogInstance, LogList, LogPage, VariableContext, VariableInstance, VariableList, VariablePage
Instance Method Summary collapse
-
#delete ⇒ Boolean
Deletes the EnvironmentInstance.
-
#deployments(sid = :unset) ⇒ DeploymentList, DeploymentContext
Access the deployments.
-
#fetch ⇒ EnvironmentInstance
Fetch a EnvironmentInstance.
-
#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
182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 182 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 @variables = nil @deployments = nil @logs = nil end |
Instance Method Details
#delete ⇒ Boolean
Deletes the EnvironmentInstance
218 219 220 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 218 def delete @version.delete('delete', @uri) end |
#deployments(sid = :unset) ⇒ DeploymentList, DeploymentContext
Access the deployments
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 248 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 a EnvironmentInstance
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 198 def fetch params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) EnvironmentInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
297 298 299 300 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 297 def inspect context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Serverless.V1.EnvironmentContext #{context}>" end |
#logs(sid = :unset) ⇒ LogList, LogContext
Access the logs
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 270 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
290 291 292 293 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 290 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
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/environment.rb', line 226 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 |