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.



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

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:



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

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

#fetch_with_metadataFunctionVersionContentInstance

Fetch the FunctionVersionContentInstanceMetadata

Returns:



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb', line 90

def 

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

#inspectObject

Provide a detailed, user friendly representation



124
125
126
127
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb', line 124

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

#to_sObject

Provide a user friendly representation



117
118
119
120
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version/function_version_content.rb', line 117

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