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

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

Instance Method Summary collapse

Constructor Details

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

Initialize the FunctionVersionContentContext

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String)

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

  • function_sid (String)

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

  • sid (String)

    The SID of the Function Version content to fetch.



55
56
57
58
59
60
61
62
63
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb', line 55

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]}/Content"

    
end

Instance Method Details

#fetchFunctionVersionContentInstance

Fetch the FunctionVersionContentInstance

Returns:



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb', line 67

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    FunctionVersionContentInstance.new(
        @version,
        payload,
        service_sid: @solution[:service_sid],
        function_sid: @solution[:function_sid],
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



95
96
97
98
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb', line 95

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

#to_sObject

Provide a user friendly representation



88
89
90
91
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb', line 88

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