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

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil, function_sid: nil, sid: nil) ⇒ FunctionVersionInstance

Initialize the FunctionVersionInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this FunctionVersion resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 230

def initialize(version, payload , service_sid: nil, function_sid: nil, sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'service_sid' => payload['service_sid'],
        'function_sid' => payload['function_sid'],
        'path' => payload['path'],
        'visibility' => payload['visibility'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'url' => payload['url'],
        'links' => payload['links'],
    }

    # Context
    @instance_context = nil
    @params = { 'service_sid' => service_sid  || @properties['service_sid']  ,'function_sid' => function_sid  || @properties['function_sid']  ,'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Function Version resource.

Returns:



270
271
272
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 270

def 
    @properties['account_sid']
end

#contextFunctionVersionContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



255
256
257
258
259
260
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 255

def context
    unless @instance_context
        @instance_context = FunctionVersionContext.new(@version , @params['service_sid'], @params['function_sid'], @params['sid'])
    end
    @instance_context
end

#date_createdTime

Returns The date and time in GMT when the Function Version resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



300
301
302
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 300

def date_created
    @properties['date_created']
end

#fetchFunctionVersionInstance

Fetch the FunctionVersionInstance

Returns:



319
320
321
322
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 319

def fetch

    context.fetch
end

#function_sidString

Returns The SID of the Function resource that is the parent of the Function Version resource.

Returns:

  • (String)

    The SID of the Function resource that is the parent of the Function Version resource.



282
283
284
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 282

def function_sid
    @properties['function_sid']
end

#function_version_contentfunction_version_content

Access the function_version_content

Returns:



327
328
329
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 327

def function_version_content
    context.function_version_content
end

#inspectObject

Provide a detailed, user friendly representation



340
341
342
343
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 340

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Serverless.V1.FunctionVersionInstance #{values}>"
end

Returns:

  • (Hash)


312
313
314
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 312

def links
    @properties['links']
end

#pathString

Returns The URL-friendly string by which the Function Version resource can be referenced. It can be a maximum of 255 characters. All paths begin with a forward slash (‘/’). If a Function Version creation request is submitted with a path not containing a leading slash, the path will automatically be prepended with one.

Returns:

  • (String)

    The URL-friendly string by which the Function Version resource can be referenced. It can be a maximum of 255 characters. All paths begin with a forward slash (‘/’). If a Function Version creation request is submitted with a path not containing a leading slash, the path will automatically be prepended with one.



288
289
290
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 288

def path
    @properties['path']
end

#service_sidString

Returns The SID of the Service that the Function Version resource is associated with.

Returns:

  • (String)

    The SID of the Service that the Function Version resource is associated with.



276
277
278
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 276

def service_sid
    @properties['service_sid']
end

#sidString

Returns The unique string that we created to identify the Function Version resource.

Returns:

  • (String)

    The unique string that we created to identify the Function Version resource.



264
265
266
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 264

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



333
334
335
336
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 333

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Serverless.V1.FunctionVersionInstance #{values}>"
end

#urlString

Returns The absolute URL of the Function Version resource.

Returns:

  • (String)

    The absolute URL of the Function Version resource.



306
307
308
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 306

def url
    @properties['url']
end

#visibilityVisibility

Returns:

  • (Visibility)


294
295
296
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 294

def visibility
    @properties['visibility']
end