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

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

Public Class Methods

new(version, sid) click to toggle source

Initialize the ServiceContext @param [Version] version Version that contains the resource @param [String] sid The `sid` or `unique_name` of the Service resource to fetch. @return [ServiceContext] ServiceContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/serverless/v1/service.rb
180 def initialize(version, sid)
181   super(version)
182 
183   # Path Solution
184   @solution = {sid: sid, }
185   @uri = "/Services/#{@solution[:sid]}"
186 
187   # Dependents
188   @environments = nil
189   @functions = nil
190   @assets = nil
191   @builds = nil
192 end

Public Instance Methods

assets(sid=:unset) click to toggle source

Access the assets @return [AssetList] @return [AssetContext] if sid was passed.

    # File lib/twilio-ruby/rest/serverless/v1/service.rb
271 def assets(sid=:unset)
272   raise ArgumentError, 'sid cannot be nil' if sid.nil?
273 
274   if sid != :unset
275     return AssetContext.new(@version, @solution[:sid], sid, )
276   end
277 
278   unless @assets
279     @assets = AssetList.new(@version, service_sid: @solution[:sid], )
280   end
281 
282   @assets
283 end
builds(sid=:unset) click to toggle source

Access the builds @return [BuildList] @return [BuildContext] if sid was passed.

    # File lib/twilio-ruby/rest/serverless/v1/service.rb
289 def builds(sid=:unset)
290   raise ArgumentError, 'sid cannot be nil' if sid.nil?
291 
292   if sid != :unset
293     return BuildContext.new(@version, @solution[:sid], sid, )
294   end
295 
296   unless @builds
297     @builds = BuildList.new(@version, service_sid: @solution[:sid], )
298   end
299 
300   @builds
301 end
delete() click to toggle source

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

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

Access the environments @return [EnvironmentList] @return [EnvironmentContext] if sid was passed.

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

Fetch the ServiceInstance @return [ServiceInstance] Fetched ServiceInstance

    # File lib/twilio-ruby/rest/serverless/v1/service.rb
197 def fetch
198   payload = @version.fetch('GET', @uri)
199 
200   ServiceInstance.new(@version, payload, sid: @solution[:sid], )
201 end
functions(sid=:unset) click to toggle source

Access the functions @return [FunctionList] @return [FunctionContext] if sid was passed.

    # File lib/twilio-ruby/rest/serverless/v1/service.rb
253 def functions(sid=:unset)
254   raise ArgumentError, 'sid cannot be nil' if sid.nil?
255 
256   if sid != :unset
257     return FunctionContext.new(@version, @solution[:sid], sid, )
258   end
259 
260   unless @functions
261     @functions = FunctionList.new(@version, service_sid: @solution[:sid], )
262   end
263 
264   @functions
265 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/serverless/v1/service.rb
312 def inspect
313   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
314   "#<Twilio.Serverless.V1.ServiceContext #{context}>"
315 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/serverless/v1/service.rb
305 def to_s
306   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
307   "#<Twilio.Serverless.V1.ServiceContext #{context}>"
308 end
update(include_credentials: :unset, friendly_name: :unset, ui_editable: :unset) click to toggle source

Update the ServiceInstance @param [Boolean] include_credentials Whether to inject Account credentials into

a function invocation context.

@param [String] friendly_name A descriptive string that you create to describe

the Service resource. It can be a maximum of 255 characters.

@param [Boolean] ui_editable Whether the Service resource's properties and

subresources can be edited via the UI. The default value is `false`.

@return [ServiceInstance] Updated ServiceInstance

    # File lib/twilio-ruby/rest/serverless/v1/service.rb
219 def update(include_credentials: :unset, friendly_name: :unset, ui_editable: :unset)
220   data = Twilio::Values.of({
221       'IncludeCredentials' => include_credentials,
222       'FriendlyName' => friendly_name,
223       'UiEditable' => ui_editable,
224   })
225 
226   payload = @version.update('POST', @uri, data: data)
227 
228   ServiceInstance.new(@version, payload, sid: @solution[:sid], )
229 end