Class: Twilio::REST::Serverless::V1::ServiceContext::FunctionContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Serverless::V1::ServiceContext::FunctionContext
- Defined in:
- lib/twilio-ruby/rest/serverless/v1/service/function.rb,
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: FunctionVersionContext, FunctionVersionInstance, FunctionVersionList, FunctionVersionPage
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the FunctionInstance.
-
#fetch ⇒ FunctionInstance
Fetch the FunctionInstance.
-
#function_versions(sid = :unset) ⇒ FunctionVersionList, FunctionVersionContext
Access the function_versions.
-
#initialize(version, service_sid, sid) ⇒ FunctionContext
constructor
Initialize the FunctionContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: nil) ⇒ FunctionInstance
Update the FunctionInstance.
Constructor Details
#initialize(version, service_sid, sid) ⇒ FunctionContext
Initialize the FunctionContext
165 166 167 168 169 170 171 172 173 174 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/function.rb', line 165 def initialize(version, service_sid, sid) super(version) # Path Solution @solution = { service_sid: service_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/Functions/#{@solution[:sid]}" # Dependents @function_versions = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the FunctionInstance
178 179 180 181 182 183 184 185 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/function.rb', line 178 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ FunctionInstance
Fetch the FunctionInstance
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/function.rb', line 190 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) FunctionInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#function_versions(sid = :unset) ⇒ FunctionVersionList, FunctionVersionContext
Access the function_versions
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/function.rb', line 238 def function_versions(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return FunctionVersionContext.new(@version, @solution[:service_sid], @solution[:sid],sid ) end unless @function_versions @function_versions = FunctionVersionList.new( @version, service_sid: @solution[:service_sid], function_sid: @solution[:sid], ) end @function_versions end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
263 264 265 266 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/function.rb', line 263 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Serverless.V1.FunctionContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
256 257 258 259 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/function.rb', line 256 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Serverless.V1.FunctionContext #{context}>" end |
#update(friendly_name: nil) ⇒ FunctionInstance
Update the FunctionInstance
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/twilio-ruby/rest/serverless/v1/service/function.rb', line 211 def update( friendly_name: nil ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) FunctionInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |