Class: Twilio::REST::Serverless::V1::ServiceContext::FunctionContext::FunctionVersionContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb,
lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb

Overview

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

Defined Under Namespace

Classes: FunctionVersionContentContext, FunctionVersionContentInstance, FunctionVersionContentList, FunctionVersionContentPage

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid, function_sid, sid) ⇒ FunctionVersionContext

Initialize the FunctionVersionContext

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String)

    The SID of the Service to fetch the Function Version resource from.

  • function_sid (String)

    The SID of the function that is the parent of the Function Version resource to fetch.

  • sid (String)

    The SID of the Function Version resource to fetch.



139
140
141
142
143
144
145
146
147
148
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 139

def initialize(version, service_sid, function_sid, sid)
    super(version)

    # Path Solution
    @solution = { service_sid: service_sid, function_sid: function_sid, sid: sid,  }
    @uri = "/Services/#{@solution[:service_sid]}/Functions/#{@solution[:function_sid]}/Versions/#{@solution[:sid]}"

    # Dependents
    @function_version_content = nil
end

Instance Method Details

#fetchFunctionVersionInstance

Fetch the FunctionVersionInstance

Returns:



152
153
154
155
156
157
158
159
160
161
162
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 152

def fetch

    payload = @version.fetch('GET', @uri)
    FunctionVersionInstance.new(
        @version,
        payload,
        service_sid: @solution[:service_sid],
        function_sid: @solution[:function_sid],
        sid: @solution[:sid],
    )
end

#function_version_contentFunctionVersionContentList, FunctionVersionContentContext

Access the function_version_content



168
169
170
171
172
173
174
175
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 168

def function_version_content
    FunctionVersionContentContext.new(
            @version,
            @solution[:service_sid],
            @solution[:function_sid],
            @solution[:sid]
            )
end

#inspectObject

Provide a detailed, user friendly representation



186
187
188
189
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 186

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Serverless.V1.FunctionVersionContext #{context}>"
end

#to_sObject

Provide a user friendly representation



179
180
181
182
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 179

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Serverless.V1.FunctionVersionContext #{context}>"
end