class Twilio::REST::Serverless::V1::ServiceContext::EnvironmentContext

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Public Class Methods

new(version, service_sid, sid) click to toggle source

Initialize the EnvironmentContext @param [Version] version Version that contains the resource @param [String] service_sid The SID of the Service to fetch the Environment

resource from.

@param [String] sid The SID of the Environment resource to fetch. @return [EnvironmentContext] EnvironmentContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/serverless/v1/service/environment.rb
175 def initialize(version, service_sid, sid)
176   super(version)
177 
178   # Path Solution
179   @solution = {service_sid: service_sid, sid: sid, }
180   @uri = "/Services/#{@solution[:service_sid]}/Environments/#{@solution[:sid]}"
181 
182   # Dependents
183   @variables = nil
184   @deployments = nil
185   @logs = nil
186 end

Public Instance Methods

delete() click to toggle source

Delete the EnvironmentInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/serverless/v1/service/environment.rb
205 def delete
206    @version.delete('DELETE', @uri)
207 end
deployments(sid=:unset) click to toggle source

Access the deployments @return [DeploymentList] @return [DeploymentContext] if sid was passed.

    # File lib/twilio-ruby/rest/serverless/v1/service/environment.rb
235 def deployments(sid=:unset)
236   raise ArgumentError, 'sid cannot be nil' if sid.nil?
237 
238   if sid != :unset
239     return DeploymentContext.new(@version, @solution[:service_sid], @solution[:sid], sid, )
240   end
241 
242   unless @deployments
243     @deployments = DeploymentList.new(
244         @version,
245         service_sid: @solution[:service_sid],
246         environment_sid: @solution[:sid],
247     )
248   end
249 
250   @deployments
251 end
fetch() click to toggle source

Fetch the EnvironmentInstance @return [EnvironmentInstance] Fetched EnvironmentInstance

    # File lib/twilio-ruby/rest/serverless/v1/service/environment.rb
191 def fetch
192   payload = @version.fetch('GET', @uri)
193 
194   EnvironmentInstance.new(
195       @version,
196       payload,
197       service_sid: @solution[:service_sid],
198       sid: @solution[:sid],
199   )
200 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/serverless/v1/service/environment.rb
284 def inspect
285   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
286   "#<Twilio.Serverless.V1.EnvironmentContext #{context}>"
287 end
logs(sid=:unset) click to toggle source

Access the logs @return [LogList] @return [LogContext] if sid was passed.

    # File lib/twilio-ruby/rest/serverless/v1/service/environment.rb
257 def logs(sid=:unset)
258   raise ArgumentError, 'sid cannot be nil' if sid.nil?
259 
260   if sid != :unset
261     return LogContext.new(@version, @solution[:service_sid], @solution[:sid], sid, )
262   end
263 
264   unless @logs
265     @logs = LogList.new(
266         @version,
267         service_sid: @solution[:service_sid],
268         environment_sid: @solution[:sid],
269     )
270   end
271 
272   @logs
273 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/serverless/v1/service/environment.rb
277 def to_s
278   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
279   "#<Twilio.Serverless.V1.EnvironmentContext #{context}>"
280 end
variables(sid=:unset) click to toggle source

Access the variables @return [VariableList] @return [VariableContext] if sid was passed.

    # File lib/twilio-ruby/rest/serverless/v1/service/environment.rb
213 def variables(sid=:unset)
214   raise ArgumentError, 'sid cannot be nil' if sid.nil?
215 
216   if sid != :unset
217     return VariableContext.new(@version, @solution[:service_sid], @solution[:sid], sid, )
218   end
219 
220   unless @variables
221     @variables = VariableList.new(
222         @version,
223         service_sid: @solution[:service_sid],
224         environment_sid: @solution[:sid],
225     )
226   end
227 
228   @variables
229 end