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

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

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

  • service_sid (String) (defaults to: nil)

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

  • function_sid (String) (defaults to: nil)

    The SID of the function that is the parent of the function version.

  • sid (String) (defaults to: nil)

    The SID of the Function Version resource to fetch.



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 244

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,
      'function_sid' => function_sid,
      'sid' => sid || @properties['sid'],
  }
end

Instance Method Details

#account_sidString

Returns The SID of the Account that created the Function Version resource.

Returns:

  • (String)

    The SID of the Account that created the Function Version resource



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

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:



273
274
275
276
277
278
279
280
281
282
283
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 273

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 ISO 8601 date and time in GMT when the Function Version resource was created.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the Function Version resource was created



323
324
325
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 323

def date_created
  @properties['date_created']
end

#fetchFunctionVersionInstance

Fetch a FunctionVersionInstance

Returns:



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

def fetch
  context.fetch
end

#function_sidString

Returns The SID of the function that is the parent of the function version.

Returns:

  • (String)

    The SID of the function that is the parent of the function version



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

def function_sid
  @properties['function_sid']
end

#function_version_contentfunction_version_content

Access the function_version_content

Returns:



349
350
351
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 349

def function_version_content
  context.function_version_content
end

#inspectObject

Provide a detailed, user friendly representation



362
363
364
365
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 362

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

Returns The links.

Returns:

  • (String)

    The links



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

def links
  @properties['links']
end

#pathString

Returns The URL-friendly string by which the function version can be referenced.

Returns:

  • (String)

    The URL-friendly string by which the function version can be referenced



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

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



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

def service_sid
  @properties['service_sid']
end

#sidString

Returns The unique string that identifies the Function Version resource.

Returns:

  • (String)

    The unique string that identifies the Function Version resource



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

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



355
356
357
358
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 355

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



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

def url
  @properties['url']
end

#visibilityfunction_version.Visibility

Returns The access control that determines how the function version can be accessed.

Returns:

  • (function_version.Visibility)

    The access control that determines how the function version can be accessed



317
318
319
# File 'lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb', line 317

def visibility
  @properties['visibility']
end