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

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 FunctionContext @param [Version] version Version that contains the resource @param [String] service_sid The SID of the Service to fetch the Function

resource from.

@param [String] sid The SID of the Function resource to fetch. @return [FunctionContext] FunctionContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/serverless/v1/service/function.rb
172 def initialize(version, service_sid, sid)
173   super(version)
174 
175   # Path Solution
176   @solution = {service_sid: service_sid, sid: sid, }
177   @uri = "/Services/#{@solution[:service_sid]}/Functions/#{@solution[:sid]}"
178 
179   # Dependents
180   @function_versions = nil
181 end

Public Instance Methods

delete() click to toggle source

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

    # File lib/twilio-ruby/rest/serverless/v1/service/function.rb
195 def delete
196    @version.delete('DELETE', @uri)
197 end
fetch() click to toggle source

Fetch the FunctionInstance @return [FunctionInstance] Fetched FunctionInstance

    # File lib/twilio-ruby/rest/serverless/v1/service/function.rb
186 def fetch
187   payload = @version.fetch('GET', @uri)
188 
189   FunctionInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
190 end
function_versions(sid=:unset) click to toggle source

Access the function_versions @return [FunctionVersionList] @return [FunctionVersionContext] if sid was passed.

    # File lib/twilio-ruby/rest/serverless/v1/service/function.rb
216 def function_versions(sid=:unset)
217   raise ArgumentError, 'sid cannot be nil' if sid.nil?
218 
219   if sid != :unset
220     return FunctionVersionContext.new(@version, @solution[:service_sid], @solution[:sid], sid, )
221   end
222 
223   unless @function_versions
224     @function_versions = FunctionVersionList.new(
225         @version,
226         service_sid: @solution[:service_sid],
227         function_sid: @solution[:sid],
228     )
229   end
230 
231   @function_versions
232 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/serverless/v1/service/function.rb
243 def inspect
244   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
245   "#<Twilio.Serverless.V1.FunctionContext #{context}>"
246 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/serverless/v1/service/function.rb
236 def to_s
237   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
238   "#<Twilio.Serverless.V1.FunctionContext #{context}>"
239 end
update(friendly_name: nil) click to toggle source

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

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

@return [FunctionInstance] Updated FunctionInstance

    # File lib/twilio-ruby/rest/serverless/v1/service/function.rb
204 def update(friendly_name: nil)
205   data = Twilio::Values.of({'FriendlyName' => friendly_name, })
206 
207   payload = @version.update('POST', @uri, data: data)
208 
209   FunctionInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
210 end