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

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.



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

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:



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 154

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    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



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

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

#inspectObject

Provide a detailed, user friendly representation



194
195
196
197
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 194

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

#to_sObject

Provide a user friendly representation



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

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